blob: 3fb25a63d51e422f7ca68b40d5a2b5031cc1899a [file] [log] [blame]
// Copyright 2014 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#pragma once
#include "ui/views/widget/widget_delegate.h"
namespace content {
class WebContents;
namespace views {
class WebView;
// Manages the views-based root window that hosts the web contents. This object
// will be deleted automatically when the associated root window is destroyed.
class CefWindowDelegateView : public views::WidgetDelegateView {
CefWindowDelegateView(SkColor background_color,
bool always_on_top,
base::RepeatingClosure on_bounds_changed);
// Create the Widget and associated root window.
void Init(gfx::AcceleratedWidget parent_widget,
content::WebContents* web_contents,
const gfx::Rect& bounds);
// Initialize the Widget's content.
void InitContent();
// WidgetDelegateView methods:
bool CanResize() const override { return true; }
bool CanMaximize() const override { return true; }
View* GetContentsView() override { return this; }
// View methods:
void ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
SkColor background_color_;
views::WebView* web_view_;
bool always_on_top_;
base::RepeatingClosure on_bounds_changed_;