mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add initial Chrome runtime support for browser APIs (see issue #2969)
This change adds basic Chrome runtime implementations for CefBrowserContext and CefBrowserPlatformDelegate. A Chrome browser window with default frame and styling can now be created using CefBrowserHost::CreateBrowser and some CefClient callbacks will be triggered via the WebContentsObserver implementation in CefBrowserHostImpl. Any additional browser windows created via the Chrome UI will be unmanaged by CEF. The application message loop will block until all browser windows have been closed by the user.
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/bind_helpers.h"
|
||||
@@ -246,9 +245,6 @@ bool CefBrowserHost::CreateBrowser(
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(chrome-runtime): Add support for this method.
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
// Verify that the settings structure is a valid size.
|
||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||
@@ -291,9 +287,6 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(chrome-runtime): Add support for this method.
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
// Verify that the settings structure is a valid size.
|
||||
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||
NOTREACHED() << "invalid CefBrowserSettings structure size";
|
||||
@@ -1515,11 +1508,16 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
for (auto& observer : observers_)
|
||||
observer.OnBrowserDestroyed(this);
|
||||
|
||||
// If the WebContents still exists at this point, signal destruction before
|
||||
// browser destruction.
|
||||
if (web_contents()) {
|
||||
WebContentsDestroyed();
|
||||
}
|
||||
|
||||
// Disassociate the platform delegate from this browser.
|
||||
platform_delegate_->BrowserDestroyed(this);
|
||||
|
||||
registrar_.reset(nullptr);
|
||||
content::WebContentsObserver::Observe(nullptr);
|
||||
|
||||
// Delete objects created by the platform delegate that may be referenced by
|
||||
// the WebContents.
|
||||
@@ -2740,6 +2738,13 @@ void CefBrowserHostImpl::OnWebContentsFocused(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WebContentsDestroyed() {
|
||||
auto wc = web_contents();
|
||||
content::WebContentsObserver::Observe(nullptr);
|
||||
if (platform_delegate_)
|
||||
platform_delegate_->WebContentsDestroyed(wc);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
|
Reference in New Issue
Block a user