mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-22 07:27:55 +01:00
8733cb89c7
The Chrome browser can now be hosted in a Views-based application on Windows and Linux. To launch a fully-featured Chrome window using cefsimple: $ cefsimple --enable-chrome-runtime To launch a minimally-styled Views-hosted window using cefsimple: $ cefsimple --enable-chrome-runtime --use-views To launch a fully-styled Views-hosted window using cefclient: $ cefclient --enable-chrome-runtime --use-views Views unit tests also now pass with the Chrome runtime enabled: $ ceftests --gtest_filter=Views* --enable-chrome-runtime Known issues: - Popup browsers cannot be intercepted and reparented.
58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
// 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
|
|
|
|
#include "include/views/cef_browser_view.h"
|
|
#include "include/views/cef_browser_view_delegate.h"
|
|
#include "libcef/browser/views/browser_view_view.h"
|
|
#include "libcef/browser/views/view_view.h"
|
|
|
|
#include "chrome/browser/ui/browser.h"
|
|
#include "chrome/browser/ui/views/frame/browser_view.h"
|
|
|
|
namespace views {
|
|
class WebView;
|
|
} // namespace views
|
|
|
|
// 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>;
|
|
using Delegate = CefBrowserViewView::Delegate;
|
|
|
|
// |cef_delegate| may be nullptr.
|
|
// |browser_view_delegate| must be non-nullptr.
|
|
ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
|
|
Delegate* browser_view_delegate);
|
|
|
|
// Called by ChromeBrowserHostImpl.
|
|
void InitBrowser(std::unique_ptr<Browser> browser,
|
|
CefRefPtr<CefBrowserView> browser_view);
|
|
void Destroyed();
|
|
|
|
// View methods:
|
|
void ViewHierarchyChanged(
|
|
const views::ViewHierarchyChangedDetails& details) override;
|
|
void AddedToWidget() override;
|
|
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
|
|
|
private:
|
|
// Not owned by this object.
|
|
Delegate* browser_view_delegate_;
|
|
|
|
Browser* browser_ = nullptr;
|
|
views::WebView* web_view_ = nullptr;
|
|
|
|
bool destroyed_ = false;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserView);
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_VIEW_H_
|