2014-05-22 23:01:22 +02:00
|
|
|
// 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.
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_
|
2014-05-22 23:01:22 +02:00
|
|
|
#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 {
|
|
|
|
public:
|
2019-07-17 20:47:27 +02:00
|
|
|
CefWindowDelegateView(SkColor background_color,
|
|
|
|
bool always_on_top,
|
|
|
|
base::RepeatingClosure on_bounds_changed);
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
// Create the Widget and associated root window.
|
|
|
|
void Init(gfx::AcceleratedWidget parent_widget,
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
const gfx::Rect& bounds);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Initialize the Widget's content.
|
|
|
|
void InitContent();
|
|
|
|
|
|
|
|
// WidgetDelegateView methods:
|
2014-11-12 20:25:15 +01:00
|
|
|
bool CanResize() const override { return true; }
|
|
|
|
bool CanMaximize() const override { return true; }
|
|
|
|
View* GetContentsView() override { return this; }
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
// View methods:
|
2014-11-12 20:25:15 +01:00
|
|
|
void ViewHierarchyChanged(
|
2019-04-16 16:38:48 +02:00
|
|
|
const views::ViewHierarchyChangedDetails& details) override;
|
2019-07-17 20:47:27 +02:00
|
|
|
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkColor background_color_;
|
|
|
|
views::WebView* web_view_;
|
2018-02-28 05:47:36 +01:00
|
|
|
bool always_on_top_;
|
2019-07-17 20:47:27 +02:00
|
|
|
base::RepeatingClosure on_bounds_changed_;
|
2014-05-22 23:01:22 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefWindowDelegateView);
|
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_
|