mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 70.0.3538.0 (#587811)
Known issues: - The CefLoadCRLSetsFile function needs to be re-implemented (see issue #2497). - Linux: GTK2 support has been removed. The cefclient sample needs to be updated to use GTK3 (see issue #2014).
This commit is contained in:
@@ -519,7 +519,7 @@ HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
|
||||
// that can be stored in the settings map (for example, default values set
|
||||
// via DefaultProvider::SetWebsiteSetting).
|
||||
host_content_settings_map_ =
|
||||
new HostContentSettingsMap(GetPrefs(), false, false, false);
|
||||
new HostContentSettingsMap(GetPrefs(), false, false, false, false);
|
||||
|
||||
// Change the default plugin policy.
|
||||
const base::CommandLine* command_line =
|
||||
|
@@ -749,7 +749,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefDevToolsFrontend* devtools_frontend_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
base::ObserverList<Observer> observers_;
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
|
||||
// Used to provide unique incremental IDs for each find request.
|
||||
int find_request_id_counter_ = 0;
|
||||
|
@@ -222,16 +222,16 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
||||
DCHECK(global_request_context_->HasOneRef());
|
||||
global_request_context_ = NULL;
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::ExtensionsBrowserClient::Set(NULL);
|
||||
extensions_browser_client_.reset();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
|
||||
chrome_extra_parts_[i]->PostMainMessageLoopRun();
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostDestroyThreads() {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::ExtensionsBrowserClient::Set(NULL);
|
||||
extensions_browser_client_.reset();
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
// Delete the DesktopTestViewsDelegate.
|
||||
delete views::ViewsDelegate::GetInstance();
|
||||
|
@@ -111,12 +111,6 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
network::NetworkConnectionTracker*
|
||||
ChromeBrowserProcessStub::network_connection_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
network::NetworkQualityTracker*
|
||||
ChromeBrowserProcessStub::network_quality_tracker() {
|
||||
NOTREACHED();
|
||||
|
@@ -49,7 +49,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
network::NetworkConnectionTracker* network_connection_tracker() override;
|
||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
|
@@ -772,6 +772,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
}
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::ShouldEnableStrictSiteIsolation() {
|
||||
// TODO(cef): Enable this mode once we figure out why it breaks ceftests that
|
||||
// rely on command-line arguments passed to the renderer process. It looks
|
||||
// like the first renderer process is getting all of the callbacks despite
|
||||
// multiple renderer processes being launched.
|
||||
// For example, V8RendererTest::OnBrowserCreated appears to get the same
|
||||
// kV8TestCmdArg value twice when running with:
|
||||
// --gtest_filter=V8Test.ContextEvalCspBypassUnsafeEval:V8Test.ContextEntered
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetApplicationLocale() {
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
@@ -1074,16 +1085,16 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
bool is_navigation,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
scoped_refptr<content::RedirectChecker>* redirect_checker) {
|
||||
const GURL& url,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
auto* web_request_api =
|
||||
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
|
||||
browser_context);
|
||||
return web_request_api->MaybeProxyURLLoaderFactory(
|
||||
frame, is_navigation, factory_request, redirect_checker);
|
||||
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
|
||||
factory_request);
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
|
@@ -62,6 +62,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::BrowserContext* context2) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
bool ShouldEnableStrictSiteIsolation() override;
|
||||
std::string GetApplicationLocale() override;
|
||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||
void GetQuotaSettings(
|
||||
@@ -141,8 +142,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
bool is_navigation,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
scoped_refptr<content::RedirectChecker>* redirect_checker) override;
|
||||
const GURL& url,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request) override;
|
||||
|
||||
bool HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||
#include "chrome_elf/chrome_elf_main.h"
|
||||
#include "components/crash/content/app/crashpad.h"
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
@@ -71,6 +72,16 @@ void DisableFMA3() {
|
||||
}
|
||||
#endif // defined(ARCH_CPU_X86_64)
|
||||
|
||||
// Transfer state from chrome_elf.dll to the libcef.dll. Accessed when
|
||||
// loading chrome://system.
|
||||
void InitInstallDetails() {
|
||||
static bool initialized = false;
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = true;
|
||||
install_static::InitializeFromPrimaryModule();
|
||||
}
|
||||
|
||||
// Signal chrome_elf to initialize crash reporting, rather than doing it in
|
||||
// DllMain. See https://crbug.com/656800 for details.
|
||||
void InitCrashReporter() {
|
||||
@@ -156,6 +167,7 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
#if defined(ARCH_CPU_X86_64)
|
||||
DisableFMA3();
|
||||
#endif
|
||||
InitInstallDetails();
|
||||
InitCrashReporter();
|
||||
#endif
|
||||
|
||||
@@ -215,6 +227,7 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
#if defined(ARCH_CPU_X86_64)
|
||||
DisableFMA3();
|
||||
#endif
|
||||
InitInstallDetails();
|
||||
InitCrashReporter();
|
||||
#endif
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include "base/format_macros.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "content/browser/storage_partition_impl.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "net/cookies/parsed_cookie.h"
|
||||
@@ -307,7 +309,7 @@ bool CefCookieManagerImpl::SetStoragePath(
|
||||
// facilitate unit test expectations. This task runner MUST be
|
||||
// configured with BLOCK_SHUTDOWN.
|
||||
CefContentBrowserClient::Get()->background_task_runner(),
|
||||
persist_session_cookies, NULL);
|
||||
persist_session_cookies, nullptr);
|
||||
} else {
|
||||
NOTREACHED() << "The cookie storage directory could not be created";
|
||||
storage_path_.clear();
|
||||
@@ -317,7 +319,8 @@ bool CefCookieManagerImpl::SetStoragePath(
|
||||
// Set the new cookie store that will be used for all new requests. The old
|
||||
// cookie store, if any, will be automatically flushed and closed when no
|
||||
// longer referenced.
|
||||
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
|
||||
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), nullptr,
|
||||
g_browser_process->net_log()));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_store_->SetPersistSessionCookies(true);
|
||||
storage_path_ = new_path;
|
||||
|
@@ -62,4 +62,16 @@ ExtensionHostQueue* CefExtensionHostDelegate::GetExtensionHostQueue() const {
|
||||
return CefExtensionsBrowserClient::Get()->GetExtensionHostQueue();
|
||||
}
|
||||
|
||||
gfx::Size CefExtensionHostDelegate::EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
const gfx::Size& natural_size) {
|
||||
NOTREACHED();
|
||||
return gfx::Size();
|
||||
}
|
||||
|
||||
void CefExtensionHostDelegate::ExitPictureInPicture() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -35,6 +35,10 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
content::MediaStreamType type,
|
||||
const Extension* extension) override;
|
||||
ExtensionHostQueue* GetExtensionHostQueue() const override;
|
||||
gfx::Size EnterPictureInPicture(content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
const gfx::Size& natural_size) override;
|
||||
void ExitPictureInPicture() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionHostDelegate);
|
||||
|
@@ -38,7 +38,8 @@ class CefExtensionWebContentsObserver
|
||||
|
||||
// Our content script observers. Declare at top so that it will outlive all
|
||||
// other members, since they might add themselves as observers.
|
||||
base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
|
||||
base::ObserverList<ScriptExecutionObserver>::Unchecked
|
||||
script_execution_observers_;
|
||||
|
||||
std::unique_ptr<ScriptExecutor> script_executor_;
|
||||
|
||||
|
29
libcef/browser/extensions/extensions_browser_api_provider.cc
Normal file
29
libcef/browser/extensions/extensions_browser_api_provider.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/extensions/chrome_api_registration.h"
|
||||
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
|
||||
|
||||
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
|
||||
#include "extensions/browser/api/generated_api_registration.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
CefExtensionsBrowserAPIProvider::CefExtensionsBrowserAPIProvider() =
|
||||
default;
|
||||
CefExtensionsBrowserAPIProvider::~CefExtensionsBrowserAPIProvider() =
|
||||
default;
|
||||
|
||||
void CefExtensionsBrowserAPIProvider::RegisterExtensionFunctions(
|
||||
ExtensionFunctionRegistry* registry) {
|
||||
// CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
26
libcef/browser/extensions/extensions_browser_api_provider.h
Normal file
26
libcef/browser/extensions/extensions_browser_api_provider.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018 The Chromium 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_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "extensions/browser/extensions_browser_api_provider.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class CefExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider {
|
||||
public:
|
||||
CefExtensionsBrowserAPIProvider();
|
||||
~CefExtensionsBrowserAPIProvider() override;
|
||||
|
||||
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserAPIProvider);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
|
@@ -9,15 +9,14 @@
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/extensions/chrome_api_registration.h"
|
||||
#include "libcef/browser/extensions/component_extension_resource_manager.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/extensions/extensions_api_client.h"
|
||||
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/extensions/chrome_url_request_util.h"
|
||||
#include "chrome/browser/extensions/event_router_forwarder.h"
|
||||
@@ -25,11 +24,10 @@
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "extensions/browser/api/extensions_api_client.h"
|
||||
#include "extensions/browser/api/generated_api_registration.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
|
||||
#include "extensions/browser/app_sorting.h"
|
||||
#include "extensions/browser/core_extensions_browser_api_provider.h"
|
||||
#include "extensions/browser/event_router.h"
|
||||
#include "extensions/browser/extension_function_registry.h"
|
||||
#include "extensions/browser/extension_host_delegate.h"
|
||||
#include "extensions/browser/mojo/interface_registration.h"
|
||||
#include "extensions/browser/serial_extension_host_queue.h"
|
||||
@@ -43,7 +41,10 @@ namespace extensions {
|
||||
|
||||
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
||||
: api_client_(new CefExtensionsAPIClient),
|
||||
resource_manager_(new CefComponentExtensionResourceManager) {}
|
||||
resource_manager_(new CefComponentExtensionResourceManager) {
|
||||
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
|
||||
AddAPIProvider(std::make_unique<CefExtensionsBrowserAPIProvider>());
|
||||
}
|
||||
|
||||
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {}
|
||||
|
||||
@@ -276,20 +277,6 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() {
|
||||
return CefExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
void CefExtensionsBrowserClient::RegisterExtensionFunctions(
|
||||
ExtensionFunctionRegistry* registry) const {
|
||||
// Register core extension-system APIs.
|
||||
api::GeneratedFunctionRegistry::RegisterAll(registry);
|
||||
|
||||
// CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
|
||||
}
|
||||
|
||||
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
|
||||
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
|
||||
registry,
|
||||
|
@@ -89,8 +89,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
||||
bool IsLoggedInAsPublicAccount() override;
|
||||
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
||||
void RegisterExtensionFunctions(
|
||||
ExtensionFunctionRegistry* registry) const override;
|
||||
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
||||
content::RenderFrameHost*>* registry,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
@@ -140,7 +140,7 @@ class CefNativeMenuWin : public MenuWrapper {
|
||||
MenuAction menu_action_;
|
||||
|
||||
// A list of listeners to call when the menu opens.
|
||||
base::ObserverList<MenuListener> listeners_;
|
||||
base::ObserverList<MenuListener>::Unchecked listeners_;
|
||||
|
||||
// Keep track of whether the listeners have already been called at least
|
||||
// once.
|
||||
|
@@ -19,7 +19,7 @@ namespace {
|
||||
|
||||
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
||||
CEF_REQUIRE_IOT();
|
||||
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
|
||||
// TODO(cef): Re-implement via NetworkService.
|
||||
}
|
||||
|
||||
void LoadFromDisk(const base::FilePath& path) {
|
||||
|
@@ -445,10 +445,7 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list,
|
||||
bool allowed_from_caller) {
|
||||
if (!allowed_from_caller)
|
||||
return false;
|
||||
const net::CookieList& cookie_list) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
@@ -475,10 +472,7 @@ bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||
|
||||
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options,
|
||||
bool allowed_from_caller) {
|
||||
if (!allowed_from_caller)
|
||||
return false;
|
||||
net::CookieOptions* options) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
|
@@ -41,12 +41,10 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
bool started,
|
||||
int net_error) override;
|
||||
bool OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list,
|
||||
bool allowed_from_caller) override;
|
||||
const net::CookieList& cookie_list) override;
|
||||
bool OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options,
|
||||
bool allowed_from_caller) override;
|
||||
net::CookieOptions* options) override;
|
||||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
const base::FilePath& absolute_path) const override;
|
||||
|
@@ -503,8 +503,8 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||
// Set the new cookie store that will be used for all new requests. The old
|
||||
// cookie store, if any, will be automatically flushed and closed when no
|
||||
// longer referenced.
|
||||
std::unique_ptr<net::CookieMonster> cookie_monster(
|
||||
new net::CookieMonster(persistent_store.get(), NULL));
|
||||
std::unique_ptr<net::CookieMonster> cookie_monster(new net::CookieMonster(
|
||||
persistent_store.get(), nullptr, io_state_->net_log_));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_monster->SetPersistSessionCookies(true);
|
||||
io_state_->cookie_store_path_ = path;
|
||||
|
@@ -245,7 +245,6 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
// Matching the attributes from BrowserCompositorMac.
|
||||
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
|
||||
true /* should_register_frame_sink_id */);
|
||||
|
||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||
@@ -291,7 +290,7 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
// necessary to remove all connections to its old ui::Compositor.
|
||||
if (is_showing_)
|
||||
delegated_frame_host_->WasHidden();
|
||||
delegated_frame_host_->ResetCompositor();
|
||||
delegated_frame_host_->DetachFromCompositor();
|
||||
#endif
|
||||
|
||||
PlatformDestroyCompositorWidget();
|
||||
@@ -362,7 +361,7 @@ void CefRenderWidgetHostViewOSR::Show() {
|
||||
#if defined(OS_MACOSX)
|
||||
browser_compositor_->SetRenderWidgetHostIsHidden(false);
|
||||
#else
|
||||
delegated_frame_host_->SetCompositor(compositor_.get());
|
||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
|
||||
GetRootLayer()->bounds().size(), false);
|
||||
#endif
|
||||
@@ -387,7 +386,7 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
||||
browser_compositor_->SetRenderWidgetHostIsHidden(true);
|
||||
#else
|
||||
GetDelegatedFrameHost()->WasHidden();
|
||||
GetDelegatedFrameHost()->ResetCompositor();
|
||||
GetDelegatedFrameHost()->DetachFromCompositor();
|
||||
#endif
|
||||
|
||||
is_showing_ = false;
|
||||
@@ -536,6 +535,10 @@ void CefRenderWidgetHostViewOSR::ClearCompositorFrame() {
|
||||
GetDelegatedFrameHost()->ClearDelegatedFrame();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) {
|
||||
@@ -907,11 +910,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
return true;
|
||||
}
|
||||
|
||||
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
|
||||
// but it is not necessary here because the final target view is responsible
|
||||
// for converting before computing the final transform.
|
||||
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
|
||||
point, target_view, transformed_point, source);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||
@@ -974,10 +973,6 @@ void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
||||
render_widget_host_->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
|
||||
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
|
||||
}
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||
|
@@ -34,6 +34,11 @@
|
||||
#include "ui/gfx/win/window_impl.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#endif
|
||||
|
||||
namespace content {
|
||||
class RenderWidgetHost;
|
||||
class RenderWidgetHostImpl;
|
||||
@@ -135,6 +140,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
viz::CompositorFrame frame,
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
void InitAsFullscreen(
|
||||
@@ -202,7 +208,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override;
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||
void DidReceiveFirstFrameAfterNavigation() override;
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool InstallTransparency();
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/common/view_messages.h"
|
||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
||||
#include "ui/display/screen.h"
|
||||
@@ -44,10 +45,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
void DidReceiveFirstFrameAfterNavigation() override {
|
||||
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
|
||||
}
|
||||
|
||||
void DestroyCompositorForShutdown() override {}
|
||||
|
||||
bool SynchronizeVisualProperties(
|
||||
|
@@ -111,7 +111,7 @@ class CefPrefStore : public PersistentPrefStore {
|
||||
bool committed_;
|
||||
|
||||
std::unique_ptr<ReadErrorDelegate> error_delegate_;
|
||||
base::ObserverList<PrefStore::Observer, true> observers_;
|
||||
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPrefStore);
|
||||
};
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "printing/pdf_metafile_skia.h"
|
||||
#include "printing/metafile_skia.h"
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
@@ -148,7 +148,7 @@ void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
DCHECK_GT(data->size(), 0U);
|
||||
|
||||
PdfMetafileSkia metafile;
|
||||
MetafileSkia metafile;
|
||||
metafile.InitFromData(static_cast<const void*>(data->front()), data->size());
|
||||
|
||||
base::File file(path,
|
||||
|
@@ -44,7 +44,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "mojo/public/cpp/system/buffer.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/pdf_metafile_skia.h"
|
||||
#include "printing/metafile_skia.h"
|
||||
#include "printing/print_settings.h"
|
||||
#include "printing/printed_document.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@@ -98,8 +98,7 @@ void CefPrintViewManagerBase::PrintDocument(
|
||||
print_job_->StartConversionToNativeFormat(print_data, page_size, content_area,
|
||||
offsets);
|
||||
#else
|
||||
std::unique_ptr<PdfMetafileSkia> metafile =
|
||||
std::make_unique<PdfMetafileSkia>();
|
||||
std::unique_ptr<MetafileSkia> metafile = std::make_unique<MetafileSkia>();
|
||||
CHECK(metafile->InitFromData(print_data->front(), print_data->size()));
|
||||
|
||||
// Update the rendered document. It will send notifications to the listener.
|
||||
@@ -183,8 +182,7 @@ void CefPrintViewManagerBase::OnDidPrintDocument(
|
||||
auto* client = PrintCompositeClient::FromWebContents(web_contents());
|
||||
if (IsOopifEnabled() && print_job_->document()->settings().is_modifiable()) {
|
||||
client->DoCompositeDocumentToPdf(
|
||||
params.document_cookie, render_frame_host, content.metafile_data_handle,
|
||||
content.data_size, content.subframe_content_info,
|
||||
params.document_cookie, render_frame_host, content,
|
||||
base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone,
|
||||
weak_ptr_factory_.GetWeakPtr(), params));
|
||||
return;
|
||||
|
@@ -18,20 +18,18 @@ import("//tools/json_schema_compiler/json_features.gni")
|
||||
#schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s"
|
||||
#schema_dependencies = [ "//extensions/common/api" ]
|
||||
#
|
||||
#json_schema_api("api") {
|
||||
#generated_json_strings("api") {
|
||||
# sources = schema_sources
|
||||
# schemas = true
|
||||
# bundle = true
|
||||
# configs = [ "//build/config:precompiled_headers" ]
|
||||
# bundle_name = "Cef"
|
||||
#
|
||||
# deps = schema_dependencies
|
||||
#}
|
||||
#
|
||||
#json_schema_api("api_registration") {
|
||||
#function_registration("api_registration") {
|
||||
# sources = schema_sources
|
||||
# impl_dir = "//cef/libcef/browser/extensions/api"
|
||||
# bundle_registration = true
|
||||
# configs = [ "//build/config:precompiled_headers" ]
|
||||
# bundle_name = "Cef"
|
||||
#
|
||||
|
89
libcef/common/extensions/extensions_api_provider.cc
Normal file
89
libcef/common/extensions/extensions_api_provider.cc
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/extensions/extensions_api_provider.h"
|
||||
|
||||
#include "libcef/common/extensions/chrome_generated_schemas.h"
|
||||
|
||||
#include "cef/grit/cef_resources.h"
|
||||
//#include "cef/libcef/common/extensions/api/generated_schemas.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_api_features.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
||||
#include "chrome/common/extensions/chrome_aliases.h"
|
||||
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
||||
#include "extensions/common/features/json_feature_provider_source.h"
|
||||
#include "extensions/common/permissions/permissions_info.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
CefExtensionsAPIProvider::CefExtensionsAPIProvider() {
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddAPIFeatures(FeatureProvider* provider) {
|
||||
AddCEFAPIFeatures(provider);
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddManifestFeatures(
|
||||
FeatureProvider* provider) {
|
||||
AddCEFManifestFeatures(provider);
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddPermissionFeatures(
|
||||
FeatureProvider* provider) {
|
||||
AddCEFPermissionFeatures(provider);
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddBehaviorFeatures(
|
||||
FeatureProvider* provider) {
|
||||
// No CEF-specific behavior features.
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddAPIJSONSources(
|
||||
JSONFeatureProviderSource* json_source) {
|
||||
// Extension API features specific to CEF. See
|
||||
// libcef/common/extensions/api/README.txt for additional details.
|
||||
json_source->LoadJSON(IDR_CEF_EXTENSION_API_FEATURES);
|
||||
}
|
||||
|
||||
bool CefExtensionsAPIProvider::IsAPISchemaGenerated(const std::string& name) {
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return true;
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
base::StringPiece CefExtensionsAPIProvider::GetAPISchema(
|
||||
const std::string& name) {
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return api::cef::CefGeneratedSchemas::Get(name);
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
return api::cef::ChromeGeneratedSchemas::Get(name);
|
||||
|
||||
return base::StringPiece();
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::AddPermissionsProviders(
|
||||
PermissionsInfo* permissions_info) {
|
||||
permissions_info->AddProvider(chrome_api_permissions_,
|
||||
GetChromePermissionAliases());
|
||||
}
|
||||
|
||||
void CefExtensionsAPIProvider::RegisterManifestHandlers() {
|
||||
RegisterChromeManifestHandlers();
|
||||
}
|
||||
|
||||
} // namespace extensions
|
37
libcef/common/extensions/extensions_api_provider.h
Normal file
37
libcef/common/extensions/extensions_api_provider.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2018 The Chromium 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_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
||||
#define CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
|
||||
#include "extensions/common/extensions_api_provider.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class CefExtensionsAPIProvider : public ExtensionsAPIProvider {
|
||||
public:
|
||||
CefExtensionsAPIProvider();
|
||||
|
||||
// ExtensionsAPIProvider:
|
||||
void AddAPIFeatures(FeatureProvider* provider) override;
|
||||
void AddManifestFeatures(FeatureProvider* provider) override;
|
||||
void AddPermissionFeatures(FeatureProvider* provider) override;
|
||||
void AddBehaviorFeatures(FeatureProvider* provider) override;
|
||||
void AddAPIJSONSources(JSONFeatureProviderSource* json_source) override;
|
||||
bool IsAPISchemaGenerated(const std::string& name) override;
|
||||
base::StringPiece GetAPISchema(const std::string& name) override;
|
||||
void AddPermissionsProviders(PermissionsInfo* permissions_info) override;
|
||||
void RegisterManifestHandlers() override;
|
||||
|
||||
private:
|
||||
const ChromeAPIPermissions chrome_api_permissions_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsAPIProvider);
|
||||
};
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_API_PROVIDER_H_
|
@@ -8,34 +8,15 @@
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/chrome_generated_schemas.h"
|
||||
#include "libcef/common/extensions/extensions_api_provider.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
//#include "cef/libcef/common/extensions/api/generated_schemas.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_api_features.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
||||
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
||||
#include "chrome/common/extensions/chrome_aliases.h"
|
||||
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
||||
#include "chrome/grit/common_resources.h"
|
||||
#include "extensions/common/api/api_features.h"
|
||||
#include "extensions/common/api/behavior_features.h"
|
||||
#include "extensions/common/api/generated_schemas.h"
|
||||
#include "extensions/common/api/manifest_features.h"
|
||||
#include "extensions/common/api/permission_features.h"
|
||||
#include "extensions/common/common_manifest_handlers.h"
|
||||
#include "extensions/common/core_extensions_api_provider.h"
|
||||
#include "extensions/common/extension_urls.h"
|
||||
#include "extensions/common/extensions_aliases.h"
|
||||
#include "extensions/common/features/feature_provider.h"
|
||||
#include "extensions/common/features/json_feature_provider_source.h"
|
||||
#include "extensions/common/features/simple_feature.h"
|
||||
#include "extensions/common/manifest_handler.h"
|
||||
#include "extensions/common/permissions/permission_message_provider.h"
|
||||
#include "extensions/common/permissions/permissions_info.h"
|
||||
#include "extensions/common/permissions/permissions_provider.h"
|
||||
#include "extensions/common/url_pattern_set.h"
|
||||
#include "extensions/grit/extensions_resources.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -50,22 +31,14 @@ SimpleFeature* CreateFeature() {
|
||||
|
||||
CefExtensionsClient::CefExtensionsClient()
|
||||
: webstore_base_url_(extension_urls::kChromeWebstoreBaseURL),
|
||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {}
|
||||
webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) {
|
||||
AddAPIProvider(std::make_unique<CoreExtensionsAPIProvider>());
|
||||
AddAPIProvider(std::make_unique<CefExtensionsAPIProvider>());
|
||||
}
|
||||
|
||||
CefExtensionsClient::~CefExtensionsClient() {}
|
||||
|
||||
void CefExtensionsClient::Initialize() {
|
||||
RegisterCommonManifestHandlers();
|
||||
RegisterChromeManifestHandlers();
|
||||
ManifestHandler::FinalizeRegistration();
|
||||
// TODO(jamescook): Do we need to whitelist any extensions?
|
||||
|
||||
// Set up permissions.
|
||||
PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_,
|
||||
GetChromePermissionAliases());
|
||||
PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_,
|
||||
GetExtensionsPermissionAliases());
|
||||
}
|
||||
void CefExtensionsClient::Initialize() {}
|
||||
|
||||
void CefExtensionsClient::InitializeWebStoreUrls(
|
||||
base::CommandLine* command_line) {}
|
||||
@@ -79,40 +52,6 @@ const std::string CefExtensionsClient::GetProductName() {
|
||||
return "cef";
|
||||
}
|
||||
|
||||
std::unique_ptr<FeatureProvider> CefExtensionsClient::CreateFeatureProvider(
|
||||
const std::string& name) const {
|
||||
auto provider = std::make_unique<FeatureProvider>();
|
||||
if (name == "api") {
|
||||
AddCoreAPIFeatures(provider.get());
|
||||
AddCEFAPIFeatures(provider.get());
|
||||
} else if (name == "manifest") {
|
||||
AddCoreManifestFeatures(provider.get());
|
||||
AddCEFManifestFeatures(provider.get());
|
||||
} else if (name == "permission") {
|
||||
AddCorePermissionFeatures(provider.get());
|
||||
AddCEFPermissionFeatures(provider.get());
|
||||
} else if (name == "behavior") {
|
||||
// Note: There are no CEF-specific behavior features.
|
||||
AddCoreBehaviorFeatures(provider.get());
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
|
||||
std::unique_ptr<JSONFeatureProviderSource>
|
||||
CefExtensionsClient::CreateAPIFeatureSource() const {
|
||||
std::unique_ptr<JSONFeatureProviderSource> source(
|
||||
new JSONFeatureProviderSource("api"));
|
||||
source->LoadJSON(IDR_EXTENSION_API_FEATURES);
|
||||
|
||||
// Extension API features specific to CEF. See
|
||||
// libcef/common/extensions/api/README.txt for additional details.
|
||||
source->LoadJSON(IDR_CEF_EXTENSION_API_FEATURES);
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
void CefExtensionsClient::FilterHostPermissions(
|
||||
const URLPatternSet& hosts,
|
||||
URLPatternSet* new_hosts,
|
||||
@@ -142,40 +81,6 @@ bool CefExtensionsClient::IsScriptableURL(const GURL& url,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefExtensionsClient::IsAPISchemaGenerated(const std::string& name) const {
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return true;
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
return true;
|
||||
|
||||
// Core extensions APIs.
|
||||
if (api::GeneratedSchemas::IsGenerated(name))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
base::StringPiece CefExtensionsClient::GetAPISchema(
|
||||
const std::string& name) const {
|
||||
// Schema for CEF-only APIs.
|
||||
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
// libcef/common/extensions/api/README.txt for details.
|
||||
// if (api::cef::CefGeneratedSchemas::IsGenerated(name))
|
||||
// return api::cef::CefGeneratedSchemas::Get(name);
|
||||
|
||||
// Chrome APIs whitelisted by CEF.
|
||||
if (api::cef::ChromeGeneratedSchemas::IsGenerated(name))
|
||||
return api::cef::ChromeGeneratedSchemas::Get(name);
|
||||
|
||||
// Core extensions APIs.
|
||||
return api::GeneratedSchemas::Get(name);
|
||||
}
|
||||
|
||||
bool CefExtensionsClient::ShouldSuppressFatalErrors() const {
|
||||
return true;
|
||||
}
|
||||
|
@@ -8,10 +8,8 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
|
||||
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
|
||||
#include "extensions/common/extensions_client.h"
|
||||
#include "extensions/common/permissions/extensions_api_permissions.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace extensions {
|
||||
@@ -28,10 +26,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
||||
const PermissionMessageProvider& GetPermissionMessageProvider()
|
||||
const override;
|
||||
const std::string GetProductName() override;
|
||||
std::unique_ptr<FeatureProvider> CreateFeatureProvider(
|
||||
const std::string& name) const override;
|
||||
std::unique_ptr<JSONFeatureProviderSource> CreateAPIFeatureSource()
|
||||
const override;
|
||||
void FilterHostPermissions(const URLPatternSet& hosts,
|
||||
URLPatternSet* new_hosts,
|
||||
PermissionIDSet* permissions) const override;
|
||||
@@ -41,8 +35,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
||||
const Extension* extension,
|
||||
const APIPermissionSet& api_permissions) const override;
|
||||
bool IsScriptableURL(const GURL& url, std::string* error) const override;
|
||||
bool IsAPISchemaGenerated(const std::string& name) const override;
|
||||
base::StringPiece GetAPISchema(const std::string& name) const override;
|
||||
bool ShouldSuppressFatalErrors() const override;
|
||||
void RecordDidSuppressFatalError() override;
|
||||
const GURL& GetWebstoreBaseURL() const override;
|
||||
@@ -50,8 +42,6 @@ class CefExtensionsClient : public ExtensionsClient {
|
||||
bool IsBlacklistUpdateURL(const GURL& url) const override;
|
||||
|
||||
private:
|
||||
const ChromeAPIPermissions chrome_api_permissions_;
|
||||
const ExtensionsAPIPermissions extensions_api_permissions_;
|
||||
const ChromePermissionMessageProvider permission_message_provider_;
|
||||
|
||||
ScriptingWhitelist scripting_whitelist_;
|
||||
|
@@ -272,7 +272,7 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
const Cef_CrossOriginWhiteListEntry_Params& entry =
|
||||
cross_origin_whitelist_entries_[i];
|
||||
GURL gurl = GURL(entry.source_origin);
|
||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
||||
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
|
||||
gurl, blink::WebString::FromUTF8(entry.target_protocol),
|
||||
blink::WebString::FromUTF8(entry.target_domain),
|
||||
entry.allow_target_subdomains);
|
||||
@@ -492,8 +492,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
const std::string& http_method,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer) {
|
||||
bool is_server_redirect) {
|
||||
DCHECK(!frame->Parent());
|
||||
|
||||
// For now, we skip the rest for POST submissions. This is because
|
||||
@@ -505,7 +504,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
return extensions::CefExtensionsRendererClient::ShouldFork(
|
||||
frame, url, is_initial_navigation, is_server_redirect, send_referrer);
|
||||
frame, url, is_initial_navigation, is_server_redirect);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -112,8 +112,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
const GURL& url,
|
||||
const std::string& http_method,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer) override;
|
||||
bool is_server_redirect) override;
|
||||
void WillSendRequest(blink::WebLocalFrame* frame,
|
||||
ui::PageTransition transition_type,
|
||||
const blink::WebURL& url,
|
||||
|
@@ -226,8 +226,7 @@ bool CefExtensionsRendererClient::IsStandaloneExtensionProcess() {
|
||||
bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer) {
|
||||
bool is_server_redirect) {
|
||||
const extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
|
||||
@@ -246,10 +245,6 @@ bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
if (!is_server_redirect &&
|
||||
CrossesExtensionExtents(frame, url, is_extension_url,
|
||||
is_initial_navigation)) {
|
||||
// Include the referrer in this case since we're going from a hosted web
|
||||
// page. (the packaged case is handled previously by the extension
|
||||
// navigation test)
|
||||
*send_referrer = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -72,8 +72,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
static bool ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer);
|
||||
bool is_server_redirect);
|
||||
static content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
|
||||
content::RenderFrame* render_frame,
|
||||
const content::WebPluginInfo& info,
|
||||
|
@@ -51,9 +51,8 @@ bool CefPrintRenderFrameHelperDelegate::OverridePrint(
|
||||
if (!frame->GetDocument().IsPluginDocument())
|
||||
return false;
|
||||
|
||||
std::vector<extensions::MimeHandlerViewContainer*> mime_handlers =
|
||||
extensions::MimeHandlerViewContainer::FromRenderFrame(
|
||||
content::RenderFrame::FromWebFrame(frame));
|
||||
auto mime_handlers = extensions::MimeHandlerViewContainer::FromRenderFrame(
|
||||
content::RenderFrame::FromWebFrame(frame));
|
||||
if (!mime_handlers.empty()) {
|
||||
// This message is handled in chrome/browser/resources/pdf/pdf.js and
|
||||
// instructs the PDF plugin to print. This is to make window.print() on a
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/net/net_resource_provider.h"
|
||||
#include "libcef/renderer/blink_glue.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include "components/visitedlink/renderer/visitedlink_slave.h"
|
||||
@@ -64,18 +65,15 @@ void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry(
|
||||
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
||||
GURL gurl = GURL(params.source_origin);
|
||||
if (add) {
|
||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
||||
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
|
||||
gurl, blink::WebString::FromUTF8(params.target_protocol),
|
||||
blink::WebString::FromUTF8(params.target_domain),
|
||||
params.allow_target_subdomains);
|
||||
} else {
|
||||
blink::WebSecurityPolicy::RemoveOriginAccessWhitelistEntry(
|
||||
gurl, blink::WebString::FromUTF8(params.target_protocol),
|
||||
blink::WebString::FromUTF8(params.target_domain),
|
||||
params.allow_target_subdomains);
|
||||
blink::WebSecurityPolicy::ClearOriginAccessAllowListForOrigin(gurl);
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderThreadObserver::OnClearCrossOriginWhitelist() {
|
||||
blink::WebSecurityPolicy::ResetOriginAccessWhitelists();
|
||||
blink::WebSecurityPolicy::ClearOriginAccessAllowList();
|
||||
}
|
||||
|
@@ -476,7 +476,9 @@ void v8impl_string_dtor(char* str) {
|
||||
#endif
|
||||
|
||||
// Convert a v8::String to CefString.
|
||||
void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
||||
void GetCefString(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> str,
|
||||
CefString& out) {
|
||||
if (str.IsEmpty())
|
||||
return;
|
||||
|
||||
@@ -486,7 +488,7 @@ void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
||||
if (len == 0)
|
||||
return;
|
||||
char* buf = new char[len + 1];
|
||||
str->WriteUtf8(buf, len + 1);
|
||||
str->WriteUtf8(isolate, buf, len + 1);
|
||||
|
||||
// Perform conversion to the wide type.
|
||||
cef_string_t* retws = out.GetWritableStruct();
|
||||
@@ -499,14 +501,14 @@ void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
||||
if (len == 0)
|
||||
return;
|
||||
char16* buf = new char16[len + 1];
|
||||
str->Write(reinterpret_cast<uint16_t*>(buf), 0, len + 1);
|
||||
str->Write(isolate, reinterpret_cast<uint16_t*>(buf), 0, len + 1);
|
||||
#else
|
||||
// Allocate enough space for a worst-case conversion.
|
||||
int len = str->Utf8Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
char* buf = new char[len + 1];
|
||||
str->WriteUtf8(buf, len + 1);
|
||||
str->WriteUtf8(isolate, buf, len + 1);
|
||||
#endif
|
||||
|
||||
// Don't perform an extra string copy.
|
||||
@@ -575,7 +577,7 @@ void AccessorNameGetterCallbackImpl(
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||
CefString name, exception;
|
||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
||||
GetCefString(isolate, v8::Local<v8::String>::Cast(property), name);
|
||||
if (accessorPtr->Get(name, object, retval, exception)) {
|
||||
if (!exception.empty()) {
|
||||
info.GetReturnValue().Set(isolate->ThrowException(
|
||||
@@ -614,7 +616,7 @@ void AccessorNameSetterCallbackImpl(
|
||||
CefRefPtr<CefV8Value> cefValue =
|
||||
new CefV8ValueImpl(isolate, context, value);
|
||||
CefString name, exception;
|
||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
||||
GetCefString(isolate, v8::Local<v8::String>::Cast(property), name);
|
||||
accessorPtr->Set(name, object, cefValue, exception);
|
||||
if (!exception.empty()) {
|
||||
isolate->ThrowException(
|
||||
@@ -625,13 +627,13 @@ void AccessorNameSetterCallbackImpl(
|
||||
}
|
||||
|
||||
// Two helper functions for V8 Interceptor callbacks.
|
||||
CefString PropertyToIndex(v8::Local<v8::Name> property) {
|
||||
CefString PropertyToIndex(v8::Isolate* isolate, v8::Local<v8::Name> property) {
|
||||
CefString name;
|
||||
GetCefString(property.As<v8::String>(), name);
|
||||
GetCefString(isolate, property.As<v8::String>(), name);
|
||||
return name;
|
||||
}
|
||||
|
||||
int PropertyToIndex(uint32_t index) {
|
||||
int PropertyToIndex(v8::Isolate* isolate, uint32_t index) {
|
||||
return static_cast<int>(index);
|
||||
}
|
||||
|
||||
@@ -657,7 +659,8 @@ void InterceptorGetterCallbackImpl(
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
CefString exception;
|
||||
interceptorPtr->Get(PropertyToIndex(property), object, retval, exception);
|
||||
interceptorPtr->Get(PropertyToIndex(isolate, property), object, retval,
|
||||
exception);
|
||||
if (!exception.empty()) {
|
||||
info.GetReturnValue().Set(isolate->ThrowException(
|
||||
v8::Exception::Error(GetV8String(isolate, exception))));
|
||||
@@ -688,7 +691,8 @@ void InterceptorSetterCallbackImpl(
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, context, value);
|
||||
CefString exception;
|
||||
interceptorPtr->Set(PropertyToIndex(property), object, cefValue, exception);
|
||||
interceptorPtr->Set(PropertyToIndex(isolate, property), object, cefValue,
|
||||
exception);
|
||||
if (!exception.empty()) {
|
||||
isolate->ThrowException(
|
||||
v8::Exception::Error(GetV8String(isolate, exception)));
|
||||
@@ -711,7 +715,7 @@ class ExtensionWrapper : public v8::Extension {
|
||||
return v8::Local<v8::FunctionTemplate>();
|
||||
|
||||
CefString func_name;
|
||||
GetCefString(name, func_name);
|
||||
GetCefString(isolate, name, func_name);
|
||||
|
||||
v8::Local<v8::External> function_data =
|
||||
V8FunctionData::Create(isolate, func_name, handler_);
|
||||
@@ -736,13 +740,18 @@ class CefV8ExceptionImpl : public CefV8Exception {
|
||||
if (message.IsEmpty())
|
||||
return;
|
||||
|
||||
GetCefString(message->Get(), message_);
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
GetCefString(isolate, message->Get(), message_);
|
||||
v8::MaybeLocal<v8::String> source_line = message->GetSourceLine(context);
|
||||
if (!source_line.IsEmpty())
|
||||
GetCefString(source_line.ToLocalChecked(), source_line_);
|
||||
GetCefString(isolate, source_line.ToLocalChecked(), source_line_);
|
||||
|
||||
if (!message->GetScriptResourceName().IsEmpty())
|
||||
GetCefString(message->GetScriptResourceName()->ToString(), script_);
|
||||
if (!message->GetScriptResourceName().IsEmpty()) {
|
||||
GetCefString(
|
||||
isolate,
|
||||
message->GetScriptResourceName()->ToString(context).ToLocalChecked(),
|
||||
script_);
|
||||
}
|
||||
|
||||
v8::Maybe<int> line_number = message->GetLineNumber(context);
|
||||
if (!line_number.IsNothing())
|
||||
@@ -1506,7 +1515,8 @@ void CefV8ValueImpl::InitFromV8Value(v8::Local<v8::Context> context,
|
||||
CefTime(value->ToNumber(context).ToLocalChecked()->Value() / 1000));
|
||||
} else if (value->IsString()) {
|
||||
CefString rv;
|
||||
GetCefString(value->ToString(), rv);
|
||||
GetCefString(context->GetIsolate(),
|
||||
value->ToString(context).ToLocalChecked(), rv);
|
||||
InitString(rv);
|
||||
} else if (value->IsObject()) {
|
||||
InitObject(value, NULL);
|
||||
@@ -1785,7 +1795,7 @@ bool CefV8ValueImpl::IsUserCreated() {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
return (tracker != NULL);
|
||||
@@ -1836,7 +1846,7 @@ bool CefV8ValueImpl::HasValue(const CefString& key) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
return obj->Has(context, GetV8String(isolate, key)).FromJust();
|
||||
}
|
||||
|
||||
@@ -1858,7 +1868,7 @@ bool CefV8ValueImpl::HasValue(int index) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
return obj->Has(context, index).FromJust();
|
||||
}
|
||||
|
||||
@@ -1875,7 +1885,7 @@ bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -1901,7 +1911,7 @@ bool CefV8ValueImpl::DeleteValue(int index) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -1922,7 +1932,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -1950,7 +1960,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -1977,7 +1987,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -2021,7 +2031,7 @@ bool CefV8ValueImpl::SetValue(int index, CefRefPtr<CefV8Value> value) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@@ -2048,7 +2058,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
CefRefPtr<CefV8Accessor> accessorPtr;
|
||||
|
||||
@@ -2080,15 +2090,22 @@ bool CefV8ValueImpl::GetKeys(std::vector<CefString>& keys) {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
v8::Local<v8::Array> arr_keys = obj->GetPropertyNames();
|
||||
uint32_t len = arr_keys->Length();
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
v8::Local<v8::Value> value = arr_keys->Get(v8::Integer::New(isolate, i));
|
||||
CefString str;
|
||||
GetCefString(value->ToString(), str);
|
||||
GetCefString(isolate, value->ToString(context).ToLocalChecked(), str);
|
||||
keys.push_back(str);
|
||||
}
|
||||
return true;
|
||||
@@ -2107,7 +2124,7 @@ bool CefV8ValueImpl::SetUserData(CefRefPtr<CefBaseRefCounted> user_data) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker) {
|
||||
@@ -2131,7 +2148,7 @@ CefRefPtr<CefBaseRefCounted> CefV8ValueImpl::GetUserData() {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
@@ -2153,7 +2170,7 @@ int CefV8ValueImpl::GetExternallyAllocatedMemory() {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
@@ -2175,7 +2192,7 @@ int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
@@ -2187,14 +2204,22 @@ int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) {
|
||||
int CefV8ValueImpl::GetArrayLength() {
|
||||
CEF_V8_REQUIRE_OBJECT_RETURN(0);
|
||||
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return 0;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
if (!value->IsArray()) {
|
||||
NOTREACHED() << "V8 value is not an array";
|
||||
return 0;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(obj);
|
||||
return arr->Length();
|
||||
}
|
||||
@@ -2205,18 +2230,20 @@ CefV8ValueImpl::GetArrayBufferReleaseCallback() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
if (!value->IsArrayBuffer()) {
|
||||
NOTREACHED() << "V8 value is not an array buffer";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
|
||||
V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
@@ -2230,6 +2257,7 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
|
||||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
@@ -2241,7 +2269,7 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
|
||||
NOTREACHED() << "V8 value is not an array buffer";
|
||||
return false;
|
||||
}
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
v8::Local<v8::ArrayBuffer> arr = v8::Local<v8::ArrayBuffer>::Cast(obj);
|
||||
if (!arr->IsNeuterable()) {
|
||||
return false;
|
||||
@@ -2257,16 +2285,25 @@ CefString CefV8ValueImpl::GetFunctionName() {
|
||||
CefString rv;
|
||||
CEF_V8_REQUIRE_OBJECT_RETURN(rv);
|
||||
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return rv;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
if (!value->IsFunction()) {
|
||||
NOTREACHED() << "V8 value is not a function";
|
||||
return rv;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
||||
GetCefString(v8::Handle<v8::String>::Cast(func->GetName()), rv);
|
||||
GetCefString(handle_->isolate(),
|
||||
v8::Handle<v8::String>::Cast(func->GetName()), rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -2288,7 +2325,7 @@ CefRefPtr<CefV8Handler> CefV8ValueImpl::GetFunctionHandler() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context).ToLocalChecked();
|
||||
V8TrackObject* tracker = V8TrackObject::Unwrap(context, obj);
|
||||
if (tracker)
|
||||
return tracker->GetHandler();
|
||||
@@ -2348,7 +2385,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
||||
|
||||
v8::Context::Scope context_scope(context_local);
|
||||
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
v8::Local<v8::Object> obj = value->ToObject(context_local).ToLocalChecked();
|
||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(obj);
|
||||
v8::Local<v8::Object> recv;
|
||||
|
||||
@@ -2429,7 +2466,7 @@ CefV8StackTraceImpl::CefV8StackTraceImpl(v8::Isolate* isolate,
|
||||
frames_.reserve(frame_count);
|
||||
for (int i = 0; i < frame_count; ++i)
|
||||
frames_.push_back(
|
||||
new CefV8StackFrameImpl(isolate, handle->GetFrame(i)));
|
||||
new CefV8StackFrameImpl(isolate, handle->GetFrame(isolate, i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2457,9 +2494,10 @@ CefV8StackFrameImpl::CefV8StackFrameImpl(v8::Isolate* isolate,
|
||||
: line_number_(0), column_(0), is_eval_(false), is_constructor_(false) {
|
||||
if (handle.IsEmpty())
|
||||
return;
|
||||
GetCefString(handle->GetScriptName(), script_name_);
|
||||
GetCefString(handle->GetScriptNameOrSourceURL(), script_name_or_source_url_);
|
||||
GetCefString(handle->GetFunctionName(), function_name_);
|
||||
GetCefString(isolate, handle->GetScriptName(), script_name_);
|
||||
GetCefString(isolate, handle->GetScriptNameOrSourceURL(),
|
||||
script_name_or_source_url_);
|
||||
GetCefString(isolate, handle->GetFunctionName(), function_name_);
|
||||
line_number_ = handle->GetLineNumber();
|
||||
column_ = handle->GetColumn();
|
||||
is_eval_ = handle->IsEval();
|
||||
|
Reference in New Issue
Block a user