2021-02-18 02:58:25 +01:00
|
|
|
// Copyright 2021 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|
|
|
|
#pragma once
|
|
|
|
|
2024-05-11 17:48:38 +02:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/views/cef_browser_view.h"
|
|
|
|
#include "cef/include/views/cef_browser_view_delegate.h"
|
|
|
|
#include "cef/libcef/browser/chrome/views/toolbar_view_impl.h"
|
|
|
|
#include "cef/libcef/browser/views/browser_view_view.h"
|
|
|
|
#include "cef/libcef/browser/views/view_view.h"
|
2021-02-18 02:58:25 +01:00
|
|
|
#include "chrome/browser/ui/browser.h"
|
|
|
|
#include "chrome/browser/ui/views/frame/browser_view.h"
|
|
|
|
|
|
|
|
namespace views {
|
|
|
|
class WebView;
|
|
|
|
} // namespace views
|
|
|
|
|
2023-09-07 19:28:27 +02:00
|
|
|
class CefBrowserViewImpl;
|
|
|
|
|
2021-02-18 02:58:25 +01:00
|
|
|
// A variant of CefBrowserViewView that extends BrowserView instead of
|
|
|
|
// views::WebView. See chrome_browser_frame.h for related documentation.
|
|
|
|
class ChromeBrowserView
|
|
|
|
: public CefViewView<BrowserView, CefBrowserViewDelegate> {
|
|
|
|
public:
|
|
|
|
using ParentClass = CefViewView<BrowserView, CefBrowserViewDelegate>;
|
|
|
|
|
2023-09-07 19:28:27 +02:00
|
|
|
// |cef_browser_view| is non-nullptr and will outlive this object.
|
|
|
|
explicit ChromeBrowserView(CefBrowserViewImpl* cef_browser_view);
|
2021-02-18 02:58:25 +01:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
ChromeBrowserView(const ChromeBrowserView&) = delete;
|
|
|
|
ChromeBrowserView& operator=(const ChromeBrowserView&) = delete;
|
|
|
|
|
2021-02-18 02:58:25 +01:00
|
|
|
// Called by ChromeBrowserHostImpl.
|
2023-09-07 19:28:27 +02:00
|
|
|
void InitBrowser(std::unique_ptr<Browser> browser);
|
2021-02-18 02:58:25 +01:00
|
|
|
void Destroyed();
|
|
|
|
|
|
|
|
// View methods:
|
|
|
|
void ViewHierarchyChanged(
|
|
|
|
const views::ViewHierarchyChangedDetails& details) override;
|
|
|
|
void AddedToWidget() override;
|
2024-03-29 17:48:33 +01:00
|
|
|
void RemovedFromWidget() override;
|
2021-02-18 02:58:25 +01:00
|
|
|
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
2023-08-31 19:16:46 +02:00
|
|
|
void OnGestureEvent(ui::GestureEvent* event) override;
|
2021-02-18 02:58:25 +01:00
|
|
|
|
2021-04-11 22:10:11 +02:00
|
|
|
// BrowserView methods:
|
2023-09-07 19:28:27 +02:00
|
|
|
ToolbarView* OverrideCreateToolbar() override;
|
2021-04-11 22:10:11 +02:00
|
|
|
|
|
|
|
CefRefPtr<CefToolbarViewImpl> cef_toolbar() const { return cef_toolbar_; }
|
2023-09-07 19:28:27 +02:00
|
|
|
CefBrowserViewImpl* cef_browser_view() const { return cef_browser_view_; }
|
2021-04-11 22:10:11 +02:00
|
|
|
|
2021-02-18 02:58:25 +01:00
|
|
|
private:
|
2024-05-11 17:48:38 +02:00
|
|
|
const raw_ptr<CefBrowserViewImpl> cef_browser_view_;
|
2021-02-18 02:58:25 +01:00
|
|
|
|
2024-05-11 17:48:38 +02:00
|
|
|
raw_ptr<views::WebView> web_view_ = nullptr;
|
2021-02-18 02:58:25 +01:00
|
|
|
|
|
|
|
bool destroyed_ = false;
|
|
|
|
|
2021-04-11 22:10:11 +02:00
|
|
|
CefRefPtr<CefToolbarViewImpl> cef_toolbar_;
|
2021-02-18 02:58:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|