mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
chrome: Add Views API integration (see issue #2969)
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.
This commit is contained in:
@@ -163,7 +163,8 @@ CefBrowserHostBase::CefBrowserHostBase(
|
||||
client_(client),
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
browser_info_(browser_info),
|
||||
request_context_(request_context) {
|
||||
request_context_(request_context),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_info_->browser().get());
|
||||
browser_info_->SetBrowser(this);
|
||||
@@ -205,6 +206,10 @@ CefRefPtr<CefRequestContext> CefBrowserHostBase::GetRequestContext() {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::HasView() {
|
||||
return is_views_hosted_;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::StartDownload(const CefString& url) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
@@ -790,3 +795,19 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const {
|
||||
return web_contents->GetBrowserContext();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_)
|
||||
return nullptr;
|
||||
return platform_delegate_->GetWindowWidget();
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView> CefBrowserHostBase::GetBrowserView() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (is_views_hosted_ && platform_delegate_)
|
||||
return platform_delegate_->GetBrowserView();
|
||||
return nullptr;
|
||||
}
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
Reference in New Issue
Block a user