mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-16 03:50:11 +01:00
Update to Chromium revision a106f0ab (#464641)
- Remove CefWindowInfo.transparent_painting_enabled. Set CefBrowserSettings.background_color to an opaque or transparent value instead.
This commit is contained in:
parent
2f6475c0d8
commit
3f71138d64
8
BUILD.gn
8
BUILD.gn
@ -140,9 +140,6 @@ assert(!enable_print_preview)
|
||||
# Enable support for Widevine CDM.
|
||||
assert(enable_widevine)
|
||||
|
||||
# Disable support for plugin installation.
|
||||
assert(!enable_plugin_installation)
|
||||
|
||||
if (is_clang) {
|
||||
# Don't use the chrome style plugin.
|
||||
assert(!clang_use_chrome_plugins)
|
||||
@ -595,6 +592,9 @@ static_library("libcef_static") {
|
||||
# we include Blink headers.
|
||||
"//third_party/WebKit/public/platform",
|
||||
"//third_party/WebKit/public/web",
|
||||
|
||||
# Crashpad code uses paths relative to this directory.
|
||||
"//third_party/crashpad/crashpad",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
@ -753,8 +753,8 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//build/config/freetype",
|
||||
"//build/linux:fontconfig",
|
||||
"//build/linux:freetype2",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': '939b32ee5ba05c396eef3fd992822fcca9a2e262',
|
||||
'chromium_checkout': 'a106f0abbf69dad349d4aaf4bcc4f5d376dd2377',
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ struct CefWindowInfoTraits {
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
@ -114,15 +113,14 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
// monitor info and to act as the parent window for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent window may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_window = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,6 @@ struct CefWindowInfoTraits {
|
||||
target->hidden = src->hidden;
|
||||
target->parent_view = src->parent_view;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->view = src->view;
|
||||
}
|
||||
};
|
||||
@ -121,15 +120,14 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
// monitor info and to act as the parent view for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent view may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_view = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -401,10 +401,14 @@ typedef struct _cef_settings_t {
|
||||
int enable_net_security_expiration;
|
||||
|
||||
///
|
||||
// Opaque background color used for accelerated content. By default the
|
||||
// background color will be white. Only the RGB compontents of the specified
|
||||
// value will be used. The alpha component must greater than 0 to enable use
|
||||
// of the background color but will be otherwise ignored.
|
||||
// Background color used for the browser before a document is loaded and when
|
||||
// no document color is specified. The alpha component must be either fully
|
||||
// opaque (0xFF) or fully transparent (0x00). If the alpha component is fully
|
||||
// opaque then the RGB components will be used as the background color. If the
|
||||
// alpha component is fully transparent for a windowed browser then the
|
||||
// default value of opaque white be used. If the alpha component is fully
|
||||
// transparent for a windowless (off-screen) browser then transparent painting
|
||||
// will be enabled.
|
||||
///
|
||||
cef_color_t background_color;
|
||||
|
||||
@ -652,11 +656,14 @@ typedef struct _cef_browser_settings_t {
|
||||
cef_state_t webgl;
|
||||
|
||||
///
|
||||
// Opaque background color used for the browser before a document is loaded
|
||||
// and when no document color is specified. By default the background color
|
||||
// will be the same as CefSettings.background_color. Only the RGB compontents
|
||||
// of the specified value will be used. The alpha component must greater than
|
||||
// 0 to enable use of the background color but will be otherwise ignored.
|
||||
// Background color used for the browser before a document is loaded and when
|
||||
// no document color is specified. The alpha component must be either fully
|
||||
// opaque (0xFF) or fully transparent (0x00). If the alpha component is fully
|
||||
// opaque then the RGB components will be used as the background color. If the
|
||||
// alpha component is fully transparent for a windowed browser then the
|
||||
// CefSettings.background_color value will be used. If the alpha component is
|
||||
// fully transparent for a windowless (off-screen) browser then transparent
|
||||
// painting will be enabled.
|
||||
///
|
||||
cef_color_t background_color;
|
||||
|
||||
|
@ -92,17 +92,11 @@ typedef struct _cef_window_info_t {
|
||||
// monitor will be used and some functionality that requires a parent window
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// Pointer for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@ -102,17 +102,11 @@ typedef struct _cef_window_info_t {
|
||||
// monitor will be used and some functionality that requires a parent view
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// NSView pointer for the new browser view. Only used with windowed rendering.
|
||||
///
|
||||
|
@ -82,17 +82,11 @@ typedef struct _cef_window_info_t {
|
||||
// monitor will be used and some functionality that requires a parent window
|
||||
// may not function correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable transparent painting in combination with
|
||||
// windowless rendering. When this value is true a transparent background
|
||||
// color will be used (RGBA=0x00000000). When this value is false the
|
||||
// background will be white and opaque.
|
||||
///
|
||||
int transparent_painting_enabled;
|
||||
|
||||
///
|
||||
// Handle for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@ -88,7 +88,6 @@ struct CefWindowInfoTraits {
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->menu = src->menu;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
@ -140,15 +139,14 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
// monitor info and to act as the parent window for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent window may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// correctly. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
// Transparent painting is enabled by default but can be disabled by setting
|
||||
// CefBrowserSettings.background_color to an opaque value.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = TRUE;
|
||||
parent_window = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,6 +28,15 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
void CefBrowserContext::Initialize() {
|
||||
content::BrowserContext::Initialize(this, GetPath());
|
||||
|
||||
resource_context_.reset(
|
||||
new CefResourceContext(IsOffTheRecord(), GetHandler()));
|
||||
|
||||
// This must be called before creating any services to avoid hitting
|
||||
// DependencyManager::AssertContextWasntDestroyed when creating/destroying
|
||||
// multiple browser contexts (due to pointer address reuse).
|
||||
BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
||||
this);
|
||||
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled) {
|
||||
// Create the custom ExtensionSystem first because other KeyedServices
|
||||
@ -41,22 +50,18 @@ void CefBrowserContext::Initialize() {
|
||||
} else {
|
||||
extension_system_->InitForRegularProfile(true);
|
||||
}
|
||||
resource_context_->set_extensions_info_map(extension_system_->info_map());
|
||||
}
|
||||
}
|
||||
|
||||
resource_context_.reset(new CefResourceContext(
|
||||
IsOffTheRecord(),
|
||||
extensions_enabled ? extension_system_->info_map() : NULL,
|
||||
GetHandler()));
|
||||
|
||||
BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
||||
this);
|
||||
|
||||
void CefBrowserContext::PostInitialize() {
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
PrefService* pref_service = GetPrefs();
|
||||
DCHECK(pref_service);
|
||||
user_prefs::UserPrefs::Set(this, pref_service);
|
||||
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled && !is_proxy_)
|
||||
extension_system_->Init();
|
||||
}
|
||||
|
@ -187,6 +187,9 @@ class CefBrowserContext : public ChromeProfileStub {
|
||||
protected:
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Must be called after all services have been initialized.
|
||||
void PostInitialize();
|
||||
|
||||
// Must be called before the child object destructor has completed.
|
||||
void Shutdown();
|
||||
|
||||
|
@ -85,6 +85,8 @@ class ImplManager {
|
||||
CefBrowserContextImpl* GetImplForContext(
|
||||
const content::BrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
const CefBrowserContext* cef_context =
|
||||
static_cast<const CefBrowserContext*>(context);
|
||||
@ -141,7 +143,14 @@ class ImplManager {
|
||||
DISALLOW_COPY_AND_ASSIGN(ImplManager);
|
||||
};
|
||||
|
||||
base::LazyInstance<ImplManager> g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
#if DCHECK_IS_ON()
|
||||
// Because of DCHECK()s in the object destructor.
|
||||
base::LazyInstance<ImplManager>::DestructorAtExit g_manager =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
#else
|
||||
base::LazyInstance<ImplManager>::Leaky g_manager =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -259,9 +268,16 @@ void CefBrowserContextImpl::Initialize() {
|
||||
CefString(&CefContext::Get()->settings().accept_language_list);
|
||||
}
|
||||
|
||||
// Initialize preferences.
|
||||
// Initialize a temporary PrefService object that may be referenced during
|
||||
// BrowserContextServices initialization.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences);
|
||||
this, base::FilePath(), false, true);
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
// Initialize the real PrefService object.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences, false);
|
||||
|
||||
// Initialize visited links management.
|
||||
base::FilePath visited_link_path;
|
||||
@ -275,13 +291,13 @@ void CefBrowserContextImpl::Initialize() {
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
visitedlink_master_->Init();
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(
|
||||
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
|
||||
GetPrefs()));
|
||||
|
||||
CefBrowserContext::PostInitialize();
|
||||
|
||||
// Create the CefURLRequestContextGetterImpl via an indirect call to
|
||||
// CreateRequestContext. Triggers a call to CefURLRequestContextGetterImpl::
|
||||
// GetURLRequestContext() on the IO thread which creates the
|
||||
|
@ -82,6 +82,8 @@ void CefBrowserContextProxy::Initialize() {
|
||||
// This object's CefResourceContext needs to proxy some UserData requests to
|
||||
// the parent object's CefResourceContext.
|
||||
resource_context()->set_parent(parent_->resource_context());
|
||||
|
||||
CefBrowserContext::PostInitialize();
|
||||
}
|
||||
|
||||
base::SupportsUserData::Data*
|
||||
@ -182,6 +184,11 @@ net::URLRequestContextGetter*
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserContextProxy::RegisterInProcessServices(
|
||||
StaticServiceMap* services) {
|
||||
parent_->RegisterInProcessServices(services);
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
override;
|
||||
void RegisterInProcessServices(StaticServiceMap* services) override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/download_url_parameters.h"
|
||||
#include "content/public/browser/host_zoom_map.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/navigation_controller.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
@ -70,6 +71,8 @@
|
||||
#include "components/spellcheck/browser/spellcheck_platform.h"
|
||||
#endif
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
|
||||
namespace {
|
||||
|
||||
// Associates a CefBrowserHostImpl instance with a WebContents. This object will
|
||||
@ -782,8 +785,8 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
|
||||
|
||||
blink::WebFindOptions options;
|
||||
options.forward = forward;
|
||||
options.matchCase = matchCase;
|
||||
options.findNext = findNext;
|
||||
options.match_case = matchCase;
|
||||
options.find_next = findNext;
|
||||
web_contents()->Find(identifier, searchText, options);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
@ -1038,8 +1041,8 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
|
||||
return;
|
||||
|
||||
content::NativeWebKeyboardEvent web_event(
|
||||
blink::WebInputEvent::Undefined,
|
||||
blink::WebInputEvent::NoModifiers,
|
||||
blink::WebInputEvent::kUndefined,
|
||||
blink::WebInputEvent::kNoModifiers,
|
||||
ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
|
||||
platform_delegate_->TranslateKeyEvent(web_event, event);
|
||||
platform_delegate_->SendKeyEvent(web_event);
|
||||
@ -1724,6 +1727,12 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
|
||||
}
|
||||
}
|
||||
|
||||
SkColor CefBrowserHostImpl::GetBackgroundColor() const {
|
||||
// Don't use |platform_delegate_| because it's not thread-safe.
|
||||
return CefContext::Get()->GetBackgroundColor(&settings_,
|
||||
is_windowless_ ? STATE_ENABLED : STATE_DISABLED);
|
||||
}
|
||||
|
||||
int CefBrowserHostImpl::browser_id() const {
|
||||
return browser_info_->browser_id();
|
||||
}
|
||||
@ -1785,8 +1794,8 @@ bool CefBrowserHostImpl::IsFullscreenForTabOrPending(
|
||||
|
||||
blink::WebDisplayMode CefBrowserHostImpl::GetDisplayMode(
|
||||
const content::WebContents* web_contents) const {
|
||||
return is_fullscreen_ ? blink::WebDisplayModeFullscreen :
|
||||
blink::WebDisplayModeBrowser;
|
||||
return is_fullscreen_ ? blink::kWebDisplayModeFullscreen :
|
||||
blink::kWebDisplayModeBrowser;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::FindReply(
|
||||
@ -2170,29 +2179,29 @@ content::WebContents* CefBrowserHostImpl::GetActionableWebContents() {
|
||||
return web_contents();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::PreHandleKeyboardEvent(
|
||||
KeyboardEventProcessingResult CefBrowserHostImpl::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
bool* is_keyboard_shortcut) {
|
||||
if (!platform_delegate_)
|
||||
return false;
|
||||
|
||||
if (client_.get()) {
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
if (platform_delegate_ && client_.get()) {
|
||||
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
|
||||
if (handler.get()) {
|
||||
CefKeyEvent cef_event;
|
||||
if (!browser_util::GetCefKeyEvent(event, cef_event))
|
||||
return false;
|
||||
if (browser_util::GetCefKeyEvent(event, cef_event)) {
|
||||
cef_event.focus_on_editable_field = focus_on_editable_field_;
|
||||
|
||||
cef_event.focus_on_editable_field = focus_on_editable_field_;
|
||||
|
||||
CefEventHandle event_handle = platform_delegate_->GetEventHandle(event);
|
||||
return handler->OnPreKeyEvent(this, cef_event, event_handle,
|
||||
is_keyboard_shortcut);
|
||||
CefEventHandle event_handle = platform_delegate_->GetEventHandle(event);
|
||||
bool is_keyboard_shortcut = false;
|
||||
bool result = handler->OnPreKeyEvent(this, cef_event, event_handle,
|
||||
&is_keyboard_shortcut);
|
||||
if (result)
|
||||
return KeyboardEventProcessingResult::HANDLED;
|
||||
else if (is_keyboard_shortcut)
|
||||
return KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return KeyboardEventProcessingResult::NOT_HANDLED;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::HandleKeyboardEvent(
|
||||
@ -2527,7 +2536,7 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
||||
|
||||
// Don't call OnLoadStart for same page navigations (fragments,
|
||||
// history state).
|
||||
if (!navigation_handle->IsSamePage())
|
||||
if (!navigation_handle->IsSameDocument())
|
||||
OnLoadStart(frame, navigation_handle->GetPageTransition());
|
||||
|
||||
if (is_main_frame)
|
||||
|
@ -339,6 +339,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// Thread safe accessors.
|
||||
const CefBrowserSettings& settings() const { return settings_; }
|
||||
SkColor GetBackgroundColor() const;
|
||||
CefRefPtr<CefClient> client() const { return client_; }
|
||||
scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; }
|
||||
int browser_id() const;
|
||||
@ -391,10 +392,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool reverse) override;
|
||||
bool HandleContextMenu(
|
||||
const content::ContextMenuParams& params) override;
|
||||
bool PreHandleKeyboardEvent(
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
bool* is_keyboard_shortcut) override;
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
@ -207,28 +207,28 @@ int CefBrowserPlatformDelegate::TranslateModifiers(uint32 cef_modifiers) {
|
||||
int webkit_modifiers = 0;
|
||||
// Set modifiers based on key state.
|
||||
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::ShiftKey;
|
||||
webkit_modifiers |= blink::WebInputEvent::kShiftKey;
|
||||
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::ControlKey;
|
||||
webkit_modifiers |= blink::WebInputEvent::kControlKey;
|
||||
if (cef_modifiers & EVENTFLAG_ALT_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::AltKey;
|
||||
webkit_modifiers |= blink::WebInputEvent::kAltKey;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::MetaKey;
|
||||
webkit_modifiers |= blink::WebInputEvent::kMetaKey;
|
||||
if (cef_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::LeftButtonDown;
|
||||
webkit_modifiers |= blink::WebInputEvent::kLeftButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::MiddleButtonDown;
|
||||
webkit_modifiers |= blink::WebInputEvent::kMiddleButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::RightButtonDown;
|
||||
webkit_modifiers |= blink::WebInputEvent::kRightButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
webkit_modifiers |= blink::WebInputEvent::CapsLockOn;
|
||||
webkit_modifiers |= blink::WebInputEvent::kCapsLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
|
||||
webkit_modifiers |= blink::WebInputEvent::NumLockOn;
|
||||
webkit_modifiers |= blink::WebInputEvent::kNumLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_IS_LEFT)
|
||||
webkit_modifiers |= blink::WebInputEvent::IsLeft;
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsLeft;
|
||||
if (cef_modifiers & EVENTFLAG_IS_RIGHT)
|
||||
webkit_modifiers |= blink::WebInputEvent::IsRight;
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsRight;
|
||||
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)
|
||||
webkit_modifiers |= blink::WebInputEvent::IsKeyPad;
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsKeyPad;
|
||||
return webkit_modifiers;
|
||||
}
|
||||
|
@ -134,6 +134,13 @@ class CefBrowserPlatformDelegate {
|
||||
CefBrowserHostImpl* new_browser,
|
||||
bool is_devtools);
|
||||
|
||||
// Returns the background color for the browser. The alpha component will be
|
||||
// either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE (e.g. fully transparent or
|
||||
// fully opaque). SK_AlphaOPAQUE will always be returned for windowed
|
||||
// browsers. SK_ColorTRANSPARENT may be returned for windowless browsers to
|
||||
// enable transparency.
|
||||
virtual SkColor GetBackgroundColor() const = 0;
|
||||
|
||||
// Notify the window that it was resized.
|
||||
virtual void WasResized() = 0;
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
@ -29,28 +31,31 @@
|
||||
namespace {
|
||||
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
|
||||
const CefWindowInfo& window_info) {
|
||||
const CefWindowInfo& window_info,
|
||||
SkColor background_color) {
|
||||
#if defined(OS_WIN)
|
||||
return base::WrapUnique(new CefBrowserPlatformDelegateNativeWin(window_info));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateNativeWin>(
|
||||
window_info, background_color);
|
||||
#elif defined(OS_MACOSX)
|
||||
return base::WrapUnique(new CefBrowserPlatformDelegateNativeMac(window_info));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateNativeMac>(
|
||||
window_info, background_color);
|
||||
#elif defined(OS_LINUX)
|
||||
return base::WrapUnique(
|
||||
new CefBrowserPlatformDelegateNativeLinux(window_info));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateNativeLinux>(
|
||||
window_info, background_color);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate) {
|
||||
#if defined(OS_WIN)
|
||||
return base::WrapUnique(
|
||||
new CefBrowserPlatformDelegateOsrWin(std::move(native_delegate)));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateOsrWin>(
|
||||
std::move(native_delegate));
|
||||
#elif defined(OS_MACOSX)
|
||||
return base::WrapUnique(
|
||||
new CefBrowserPlatformDelegateOsrMac(std::move(native_delegate)));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateOsrMac>(
|
||||
std::move(native_delegate));
|
||||
#elif defined(OS_LINUX)
|
||||
return base::WrapUnique(
|
||||
new CefBrowserPlatformDelegateOsrLinux(std::move(native_delegate)));
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateOsrLinux>(
|
||||
std::move(native_delegate));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -59,24 +64,30 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
|
||||
// static
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||
CefBrowserHostImpl::CreateParams& create_params) {
|
||||
const bool is_windowless =
|
||||
create_params.window_info &&
|
||||
create_params.window_info->windowless_rendering_enabled &&
|
||||
create_params.client &&
|
||||
create_params.client->GetRenderHandler().get();
|
||||
const SkColor background_color = CefContext::Get()->GetBackgroundColor(
|
||||
&create_params.settings, is_windowless ? STATE_ENABLED : STATE_DISABLED);
|
||||
|
||||
if (create_params.window_info) {
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||
CreateNativeDelegate(*create_params.window_info.get());
|
||||
if (create_params.window_info->windowless_rendering_enabled &&
|
||||
create_params.client &&
|
||||
create_params.client->GetRenderHandler().get()) {
|
||||
CreateNativeDelegate(*create_params.window_info.get(),
|
||||
background_color);
|
||||
if (is_windowless)
|
||||
return CreateOSRDelegate(std::move(native_delegate));
|
||||
}
|
||||
return std::move(native_delegate);
|
||||
}
|
||||
#if defined(USE_AURA)
|
||||
else {
|
||||
// CefWindowInfo is not used in this case.
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||
CreateNativeDelegate(CefWindowInfo());
|
||||
return base::WrapUnique(new CefBrowserPlatformDelegateViews(
|
||||
CreateNativeDelegate(CefWindowInfo(), background_color);
|
||||
return base::MakeUnique<CefBrowserPlatformDelegateViews>(
|
||||
std::move(native_delegate),
|
||||
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())));
|
||||
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
|
@ -10,17 +10,17 @@ namespace browser_util {
|
||||
|
||||
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||
CefKeyEvent& cef_event) {
|
||||
switch (event.type()) {
|
||||
case blink::WebKeyboardEvent::RawKeyDown:
|
||||
switch (event.GetType()) {
|
||||
case blink::WebKeyboardEvent::kRawKeyDown:
|
||||
cef_event.type = KEYEVENT_RAWKEYDOWN;
|
||||
break;
|
||||
case blink::WebKeyboardEvent::KeyDown:
|
||||
case blink::WebKeyboardEvent::kKeyDown:
|
||||
cef_event.type = KEYEVENT_KEYDOWN;
|
||||
break;
|
||||
case blink::WebKeyboardEvent::KeyUp:
|
||||
case blink::WebKeyboardEvent::kKeyUp:
|
||||
cef_event.type = KEYEVENT_KEYUP;
|
||||
break;
|
||||
case blink::WebKeyboardEvent::Char:
|
||||
case blink::WebKeyboardEvent::kChar:
|
||||
cef_event.type = KEYEVENT_CHAR;
|
||||
break;
|
||||
default:
|
||||
@ -28,22 +28,22 @@ bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||
}
|
||||
|
||||
cef_event.modifiers = 0;
|
||||
if (event.modifiers() & blink::WebKeyboardEvent::ShiftKey)
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kShiftKey)
|
||||
cef_event.modifiers |= EVENTFLAG_SHIFT_DOWN;
|
||||
if (event.modifiers() & blink::WebKeyboardEvent::ControlKey)
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kControlKey)
|
||||
cef_event.modifiers |= EVENTFLAG_CONTROL_DOWN;
|
||||
if (event.modifiers() & blink::WebKeyboardEvent::AltKey)
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kAltKey)
|
||||
cef_event.modifiers |= EVENTFLAG_ALT_DOWN;
|
||||
if (event.modifiers() & blink::WebKeyboardEvent::MetaKey)
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kMetaKey)
|
||||
cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN;
|
||||
if (event.modifiers() & blink::WebKeyboardEvent::IsKeyPad)
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kIsKeyPad)
|
||||
cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD;
|
||||
|
||||
cef_event.windows_key_code = event.windowsKeyCode;
|
||||
cef_event.native_key_code = event.nativeKeyCode;
|
||||
cef_event.is_system_key = event.isSystemKey;
|
||||
cef_event.windows_key_code = event.windows_key_code;
|
||||
cef_event.native_key_code = event.native_key_code;
|
||||
cef_event.is_system_key = event.is_system_key;
|
||||
cef_event.character = event.text[0];
|
||||
cef_event.unmodified_character = event.unmodifiedText[0];
|
||||
cef_event.unmodified_character = event.unmodified_text[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -277,8 +277,8 @@ safe_browsing::ClientSideDetectionService*
|
||||
return NULL;
|
||||
}
|
||||
|
||||
subresource_filter::RulesetService*
|
||||
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||
subresource_filter::ContentRulesetService*
|
||||
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::ClientSideDetectionService*
|
||||
safe_browsing_detection_service() override;
|
||||
subresource_filter::RulesetService*
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter_ruleset_service() override;
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
|
@ -22,12 +22,12 @@
|
||||
#include "base/debug/debugger.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "content/public/app/content_main_runner.h"
|
||||
#include "content/app/content_service_manager_main_delegate.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "services/service_manager/embedder/main.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@ -116,11 +116,28 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
argv_as_utf8[argv.size()] = nullptr;
|
||||
argv.clear();
|
||||
return crashpad::HandlerMain(static_cast<int>(storage.size()),
|
||||
argv_as_utf8.get());
|
||||
argv_as_utf8.get(), nullptr);
|
||||
}
|
||||
|
||||
#endif // defined(OS_MACOSX) || defined(OS_WIN)
|
||||
|
||||
bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
|
||||
// Windowed browser colors must be fully opaque.
|
||||
if (!is_windowless && CefColorGetA(cef_in) != SK_AlphaOPAQUE)
|
||||
return false;
|
||||
|
||||
// Windowless browser colors may be fully transparent.
|
||||
if (is_windowless && CefColorGetA(cef_in) == SK_AlphaTRANSPARENT) {
|
||||
*sk_out = SK_ColorTRANSPARENT;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ignore the alpha component.
|
||||
*sk_out = SkColorSetRGB(CefColorGetR(cef_in), CefColorGetG(cef_in),
|
||||
CefColorGetB(cef_in));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
@ -326,12 +343,12 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
#endif
|
||||
|
||||
main_delegate_.reset(new CefMainDelegate(application));
|
||||
main_runner_.reset(content::ContentMainRunner::Create());
|
||||
browser_info_manager_.reset(new CefBrowserInfoManager);
|
||||
|
||||
int exit_code;
|
||||
|
||||
// Initialize the content runner.
|
||||
content::ContentMainParams params(main_delegate_.get());
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
if (windows_sandbox_info == NULL) {
|
||||
@ -340,20 +357,20 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
settings_.no_sandbox = true;
|
||||
}
|
||||
|
||||
content::ContentMainParams params(main_delegate_.get());
|
||||
params.instance = args.instance;
|
||||
params.sandbox_info =
|
||||
static_cast<sandbox::SandboxInterfaceInfo*>(windows_sandbox_info);
|
||||
|
||||
exit_code = main_runner_->Initialize(params);
|
||||
#else
|
||||
content::ContentMainParams params(main_delegate_.get());
|
||||
params.argc = args.argc;
|
||||
params.argv = const_cast<const char**>(args.argv);
|
||||
|
||||
exit_code = main_runner_->Initialize(params);
|
||||
#endif
|
||||
|
||||
sm_main_delegate_.reset(
|
||||
new content::ContentServiceManagerMainDelegate(params));
|
||||
sm_main_params_.reset(
|
||||
new service_manager::MainParams(sm_main_delegate_.get()));
|
||||
|
||||
exit_code = service_manager::MainInitialize(*sm_main_params_);
|
||||
DCHECK_LT(exit_code, 0);
|
||||
if (exit_code >= 0)
|
||||
return false;
|
||||
@ -363,7 +380,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
|
||||
// Run the process. Results in a call to CefMainDelegate::RunProcess() which
|
||||
// will create the browser runner and message loop without blocking.
|
||||
exit_code = main_runner_->Run();
|
||||
exit_code = service_manager::MainRun(*sm_main_params_);
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
@ -413,6 +430,23 @@ bool CefContext::OnInitThread() {
|
||||
return (base::PlatformThread::CurrentId() == init_thread_id_);
|
||||
}
|
||||
|
||||
SkColor CefContext::GetBackgroundColor(
|
||||
const CefBrowserSettings* browser_settings,
|
||||
cef_state_t windowless_state) const {
|
||||
bool is_windowless = windowless_state == STATE_ENABLED ? true :
|
||||
(windowless_state == STATE_DISABLED ? false :
|
||||
!!settings_.windowless_rendering_enabled);
|
||||
|
||||
// Default to opaque white if no acceptable color values are found.
|
||||
SkColor sk_color = SK_ColorWHITE;
|
||||
|
||||
if (!browser_settings ||
|
||||
!GetColor(browser_settings->background_color, is_windowless, &sk_color)) {
|
||||
GetColor(settings_.background_color, is_windowless, &sk_color);
|
||||
}
|
||||
return sk_color;
|
||||
}
|
||||
|
||||
CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (shutting_down_)
|
||||
@ -488,9 +522,10 @@ void CefContext::FinalizeShutdown() {
|
||||
main_delegate_->ShutdownBrowser();
|
||||
|
||||
// Shut down the content runner.
|
||||
main_runner_->Shutdown();
|
||||
service_manager::MainShutdown(*sm_main_params_);
|
||||
|
||||
browser_info_manager_.reset(NULL);
|
||||
main_runner_.reset(NULL);
|
||||
sm_main_params_.reset(NULL);
|
||||
sm_main_delegate_.reset(NULL);
|
||||
main_delegate_.reset(NULL);
|
||||
}
|
||||
|
@ -13,13 +13,18 @@
|
||||
#include "include/cef_app.h"
|
||||
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
namespace base {
|
||||
class WaitableEvent;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class ContentMainRunner;
|
||||
class ContentServiceManagerMainDelegate;
|
||||
}
|
||||
|
||||
namespace service_manager {
|
||||
struct MainParams;
|
||||
}
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
@ -55,6 +60,17 @@ class CefContext {
|
||||
|
||||
const CefSettings& settings() const { return settings_; }
|
||||
|
||||
// Returns the background color for the browser. If |browser_settings| is
|
||||
// nullptr or does not specify a color then the global settings will be used.
|
||||
// The alpha component will be either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE
|
||||
// (e.g. fully transparent or fully opaque). If |is_windowless| is
|
||||
// STATE_DISABLED then SK_AlphaTRANSPARENT will always be returned. If
|
||||
// |is_windowless| is STATE_ENABLED then SK_ColorTRANSPARENT may be returned
|
||||
// to enable transparency for windowless browsers. See additional comments on
|
||||
// CefSettings.background_color and CefBrowserSettings.background_color.
|
||||
SkColor GetBackgroundColor(const CefBrowserSettings* browser_settings,
|
||||
cef_state_t windowless_state) const;
|
||||
|
||||
CefTraceSubscriber* GetTraceSubscriber();
|
||||
|
||||
// Populate the request context settings based on CefSettings and command-
|
||||
@ -81,7 +97,8 @@ class CefContext {
|
||||
CefSettings settings_;
|
||||
|
||||
std::unique_ptr<CefMainDelegate> main_delegate_;
|
||||
std::unique_ptr<content::ContentMainRunner> main_runner_;
|
||||
std::unique_ptr<content::ContentServiceManagerMainDelegate> sm_main_delegate_;
|
||||
std::unique_ptr<service_manager::MainParams> sm_main_params_;
|
||||
std::unique_ptr<CefTraceSubscriber> trace_subscriber_;
|
||||
std::unique_ptr<CefBrowserInfoManager> browser_info_manager_;
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ CefContextMenuParamsImpl::TypeFlags CefContextMenuParamsImpl::GetTypeFlags() {
|
||||
type_flags |= CM_TYPEFLAG_FRAME;
|
||||
if (!params.link_url.is_empty())
|
||||
type_flags |= CM_TYPEFLAG_LINK;
|
||||
if (params.media_type != blink::WebContextMenuData::MediaTypeNone)
|
||||
if (params.media_type != blink::WebContextMenuData::kMediaTypeNone)
|
||||
type_flags |= CM_TYPEFLAG_MEDIA;
|
||||
if (!params.selection_text.empty())
|
||||
type_flags |= CM_TYPEFLAG_SELECTION;
|
||||
|
@ -82,7 +82,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
|
||||
return num_bytes;
|
||||
|
||||
base::Value* id = new base::Value(stream_id_);
|
||||
base::StringValue* chunkValue = new base::StringValue(chunk);
|
||||
base::Value* chunkValue = new base::Value(chunk);
|
||||
|
||||
content::BrowserThread::PostTask(
|
||||
content::BrowserThread::UI, FROM_HERE,
|
||||
@ -116,9 +116,10 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
CefBrowserSettings new_settings = settings;
|
||||
if (CefColorGetA(new_settings.background_color) == 0) {
|
||||
// Use white as the default background color for DevTools instead of the
|
||||
// CefSettings.background_color value.
|
||||
if (!windowInfo.windowless_rendering_enabled &&
|
||||
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
||||
// Use white as the default background color for windowed DevTools instead
|
||||
// of the CefSettings.background_color value.
|
||||
new_settings.background_color = SK_ColorWHITE;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
callback.Run(suggested_path,
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
suggested_path);
|
||||
suggested_path,
|
||||
content::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +169,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
callback.Run(path,
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
path);
|
||||
path, content::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
@ -360,7 +361,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
callback.Run(item->GetForcedFilePath(),
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
item->GetForcedFilePath());
|
||||
item->GetForcedFilePath(),
|
||||
content::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/null_app_sorting.h"
|
||||
#include "extensions/browser/quota_service.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "extensions/browser/service_worker_manager.h"
|
||||
#include "extensions/browser/value_store/value_store_factory.h"
|
||||
@ -82,6 +83,9 @@ CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
initialized_(false),
|
||||
registry_(ExtensionRegistry::Get(browser_context)),
|
||||
renderer_helper_(
|
||||
extensions::RendererStartupHelperFactory::GetForBrowserContext(
|
||||
browser_context)),
|
||||
weak_ptr_factory_(this) {
|
||||
}
|
||||
|
||||
@ -391,24 +395,8 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
make_scoped_refptr(extension)));
|
||||
|
||||
// Tell renderers about the new extension, unless it's a theme (renderers
|
||||
// don't need to know about themes).
|
||||
if (!extension->is_theme()) {
|
||||
for (content::RenderProcessHost::iterator i(
|
||||
content::RenderProcessHost::AllHostsIterator());
|
||||
!i.IsAtEnd(); i.Advance()) {
|
||||
content::RenderProcessHost* host = i.GetCurrentValue();
|
||||
if (host->GetBrowserContext() == browser_context_) {
|
||||
// We don't need to include tab permisisons here, since the extension
|
||||
// was just loaded.
|
||||
std::vector<ExtensionMsg_Loaded_Params> loaded_extensions(
|
||||
1, ExtensionMsg_Loaded_Params(extension,
|
||||
false /* no tab permissions */));
|
||||
host->Send(
|
||||
new ExtensionMsg_Loaded(loaded_extensions));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Tell renderers about the loaded extension.
|
||||
renderer_helper_->OnExtensionLoaded(*extension);
|
||||
|
||||
// Tell subsystems that use the EXTENSION_LOADED notification about the new
|
||||
// extension.
|
||||
@ -485,13 +473,8 @@ void CefExtensionSystem::NotifyExtensionUnloaded(
|
||||
content::Source<content::BrowserContext>(browser_context_),
|
||||
content::Details<UnloadedExtensionInfo>(&details));
|
||||
|
||||
for (content::RenderProcessHost::iterator i(
|
||||
content::RenderProcessHost::AllHostsIterator());
|
||||
!i.IsAtEnd(); i.Advance()) {
|
||||
content::RenderProcessHost* host = i.GetCurrentValue();
|
||||
if (host->GetBrowserContext() == browser_context_)
|
||||
host->Send(new ExtensionMsg_Unloaded(extension->id()));
|
||||
}
|
||||
// Tell renderers about the unloaded extension.
|
||||
renderer_helper_->OnExtensionUnloaded(*extension);
|
||||
|
||||
UnregisterExtensionWithRequestContexts(extension->id(), reason);
|
||||
}
|
||||
|
@ -138,6 +138,10 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
// Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
|
||||
ExtensionRegistry* registry_;
|
||||
|
||||
// The associated RendererStartupHelper. Guaranteed to outlive the
|
||||
// ExtensionSystem, and thus us.
|
||||
extensions::RendererStartupHelper* renderer_helper_;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<CefExtensionSystem> weak_ptr_factory_;
|
||||
|
||||
|
@ -44,7 +44,8 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser = GetOwnerBrowser(guest_);
|
||||
if (owner_browser->IsWindowless()) {
|
||||
CefWebContentsViewOSR* view_osr = new CefWebContentsViewOSR(false);
|
||||
CefWebContentsViewOSR* view_osr =
|
||||
new CefWebContentsViewOSR(owner_browser->GetBackgroundColor());
|
||||
params->view = view_osr;
|
||||
params->delegate_view = view_osr;
|
||||
}
|
||||
|
@ -10,11 +10,17 @@
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
|
||||
CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
|
||||
const CefWindowInfo& window_info)
|
||||
const CefWindowInfo& window_info,
|
||||
SkColor background_color)
|
||||
: window_info_(window_info),
|
||||
background_color_(background_color),
|
||||
windowless_handler_(nullptr) {
|
||||
}
|
||||
|
||||
SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::WasResized() {
|
||||
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
|
@ -25,6 +25,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
|
||||
};
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
@ -39,9 +40,11 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit CefBrowserPlatformDelegateNative(const CefWindowInfo& window_info);
|
||||
CefBrowserPlatformDelegateNative(const CefWindowInfo& window_info,
|
||||
SkColor background_color);
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
const SkColor background_color_;
|
||||
|
||||
WindowlessHandler* windowless_handler_; // Not owned by this object.
|
||||
};
|
||||
|
@ -43,8 +43,9 @@ long GetSystemUptime() {
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux(
|
||||
const CefWindowInfo& window_info)
|
||||
: CefBrowserPlatformDelegateNative(window_info),
|
||||
const CefWindowInfo& window_info,
|
||||
SkColor background_color)
|
||||
: CefBrowserPlatformDelegateNative(window_info, background_color),
|
||||
host_window_created_(false),
|
||||
window_widget_(nullptr),
|
||||
window_x11_(nullptr) {
|
||||
@ -82,17 +83,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
|
||||
// Add a reference that will be released in BrowserDestroyed().
|
||||
browser_->AddRef();
|
||||
|
||||
SkColor background_color = SK_ColorWHITE;
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
background_color = SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
CefWindowDelegateView* delegate_view =
|
||||
new CefWindowDelegateView(background_color);
|
||||
new CefWindowDelegateView(GetBackgroundColor());
|
||||
delegate_view->Init(window_info_.window,
|
||||
browser_->web_contents(),
|
||||
gfx::Rect(gfx::Point(), rect.size()));
|
||||
@ -253,19 +245,19 @@ void CefBrowserPlatformDelegateNativeLinux::HandleExternalProtocol(
|
||||
void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent(
|
||||
content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const {
|
||||
result.windowsKeyCode = key_event.windows_key_code;
|
||||
result.nativeKeyCode = key_event.native_key_code;
|
||||
result.isSystemKey = key_event.is_system_key ? 1 : 0;
|
||||
result.windows_key_code = key_event.windows_key_code;
|
||||
result.native_key_code = key_event.native_key_code;
|
||||
result.is_system_key = key_event.is_system_key ? 1 : 0;
|
||||
switch (key_event.type) {
|
||||
case KEYEVENT_RAWKEYDOWN:
|
||||
case KEYEVENT_KEYDOWN:
|
||||
result.setType(blink::WebInputEvent::RawKeyDown);
|
||||
result.SetType(blink::WebInputEvent::kRawKeyDown);
|
||||
break;
|
||||
case KEYEVENT_KEYUP:
|
||||
result.setType(blink::WebInputEvent::KeyUp);
|
||||
result.SetType(blink::WebInputEvent::kKeyUp);
|
||||
break;
|
||||
case KEYEVENT_CHAR:
|
||||
result.setType(blink::WebInputEvent::Char);
|
||||
result.SetType(blink::WebInputEvent::kChar);
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
@ -273,20 +265,20 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent(
|
||||
|
||||
// Populate DOM values that will be passed to JavaScript handlers via
|
||||
// KeyboardEvent.
|
||||
result.domCode =
|
||||
result.dom_code =
|
||||
static_cast<int>(ui::KeycodeConverter::NativeKeycodeToDomCode(
|
||||
key_event.native_key_code));
|
||||
int keysym = ui::XKeysymForWindowsKeyCode(
|
||||
static_cast<ui::KeyboardCode>(key_event.windows_key_code),
|
||||
!!(key_event.modifiers & EVENTFLAG_SHIFT_DOWN));
|
||||
base::char16 ch = ui::GetUnicodeCharacterFromXKeySym(keysym);
|
||||
result.domKey = static_cast<int>(ui::XKeySymToDomKey(keysym, ch));
|
||||
result.dom_key = static_cast<int>(ui::XKeySymToDomKey(keysym, ch));
|
||||
|
||||
result.text[0] = key_event.character;
|
||||
result.unmodifiedText[0] = key_event.unmodified_character;
|
||||
result.unmodified_text[0] = key_event.unmodified_character;
|
||||
|
||||
result.setModifiers(
|
||||
result.modifiers() | TranslateModifiers(key_event.modifiers));
|
||||
result.SetModifiers(
|
||||
result.GetModifiers() | TranslateModifiers(key_event.modifiers));
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent(
|
||||
@ -298,25 +290,25 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent(
|
||||
|
||||
switch (type) {
|
||||
case MBT_LEFT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
break;
|
||||
case MBT_MIDDLE:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
break;
|
||||
case MBT_RIGHT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
result.clickCount = clickCount;
|
||||
result.click_count = clickCount;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent(
|
||||
@ -326,21 +318,21 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent(
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
if (!mouseLeave) {
|
||||
result.setType(blink::WebInputEvent::MouseMove);
|
||||
result.SetType(blink::WebInputEvent::kMouseMove);
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
else
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
} else {
|
||||
result.setType(blink::WebInputEvent::MouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.SetType(blink::WebInputEvent::kMouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
}
|
||||
|
||||
result.clickCount = 0;
|
||||
result.click_count = 0;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent(
|
||||
@ -350,28 +342,28 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent(
|
||||
result = blink::WebMouseWheelEvent();
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
result.setType(blink::WebInputEvent::MouseWheel);
|
||||
result.SetType(blink::WebInputEvent::kMouseWheel);
|
||||
|
||||
static const double scrollbarPixelsPerGtkTick = 40.0;
|
||||
result.deltaX = deltaX;
|
||||
result.deltaY = deltaY;
|
||||
result.wheelTicksX = result.deltaX / scrollbarPixelsPerGtkTick;
|
||||
result.wheelTicksY = result.deltaY / scrollbarPixelsPerGtkTick;
|
||||
result.hasPreciseScrollingDeltas = true;
|
||||
result.delta_x = deltaX;
|
||||
result.delta_y = deltaY;
|
||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerGtkTick;
|
||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerGtkTick;
|
||||
result.has_precise_scrolling_deltas = true;
|
||||
|
||||
// Unless the phase and momentumPhase are passed in as parameters to this
|
||||
// function, there is no way to know them
|
||||
result.phase = blink::WebMouseWheelEvent::PhaseNone;
|
||||
result.momentumPhase = blink::WebMouseWheelEvent::PhaseNone;
|
||||
result.phase = blink::WebMouseWheelEvent::kPhaseNone;
|
||||
result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone;
|
||||
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
else
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||
@ -390,20 +382,17 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
|
||||
blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event) const {
|
||||
// position
|
||||
result.x = mouse_event.x;
|
||||
result.y = mouse_event.y;
|
||||
result.windowX = result.x;
|
||||
result.windowY = result.y;
|
||||
result.SetPositionInWidget(mouse_event.x, mouse_event.y);
|
||||
|
||||
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y));
|
||||
result.globalX = screen_pt.x();
|
||||
result.globalY = screen_pt.y();
|
||||
const gfx::Point& screen_pt =
|
||||
GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y));
|
||||
result.SetPositionInScreen(screen_pt.x(), screen_pt.y());
|
||||
|
||||
// modifiers
|
||||
result.setModifiers(
|
||||
result.modifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
result.SetModifiers(
|
||||
result.GetModifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp
|
||||
result.setTimeStampSeconds(GetSystemUptime());
|
||||
result.SetTimeStampSeconds(GetSystemUptime());
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ class CefWindowX11;
|
||||
class CefBrowserPlatformDelegateNativeLinux :
|
||||
public CefBrowserPlatformDelegateNative {
|
||||
public:
|
||||
explicit CefBrowserPlatformDelegateNativeLinux(
|
||||
const CefWindowInfo& window_info);
|
||||
CefBrowserPlatformDelegateNativeLinux(const CefWindowInfo& window_info,
|
||||
SkColor background_color);
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
|
@ -11,8 +11,8 @@
|
||||
class CefBrowserPlatformDelegateNativeMac :
|
||||
public CefBrowserPlatformDelegateNative {
|
||||
public:
|
||||
explicit CefBrowserPlatformDelegateNativeMac(
|
||||
const CefWindowInfo& window_info);
|
||||
CefBrowserPlatformDelegateNativeMac(const CefWindowInfo& window_info,
|
||||
SkColor background_color);
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
@ -40,7 +40,8 @@ class CefBrowserPlatformDelegateNativeMac :
|
||||
CefEventHandle GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefFileDialogRunner> CreateFileDialogRunner() override;
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner() override;
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner()
|
||||
override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
|
||||
private:
|
||||
|
@ -141,8 +141,9 @@ NSUInteger NativeModifiers(int cef_modifiers) {
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateNativeMac::CefBrowserPlatformDelegateNativeMac(
|
||||
const CefWindowInfo& window_info)
|
||||
: CefBrowserPlatformDelegateNative(window_info),
|
||||
const CefWindowInfo& window_info,
|
||||
SkColor background_color)
|
||||
: CefBrowserPlatformDelegateNative(window_info, background_color),
|
||||
host_window_created_(false) {
|
||||
}
|
||||
|
||||
@ -347,9 +348,9 @@ void CefBrowserPlatformDelegateNativeMac::TranslateKeyEvent(
|
||||
|
||||
result = content::NativeWebKeyboardEvent(synthetic_event);
|
||||
if (key_event.type == KEYEVENT_CHAR)
|
||||
result.setType(blink::WebInputEvent::Char);
|
||||
result.SetType(blink::WebInputEvent::kChar);
|
||||
|
||||
result.isSystemKey = key_event.is_system_key;
|
||||
result.is_system_key = key_event.is_system_key;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeMac::TranslateClickEvent(
|
||||
@ -361,25 +362,25 @@ void CefBrowserPlatformDelegateNativeMac::TranslateClickEvent(
|
||||
|
||||
switch (type) {
|
||||
case MBT_LEFT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
break;
|
||||
case MBT_MIDDLE:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
break;
|
||||
case MBT_RIGHT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
result.clickCount = clickCount;
|
||||
result.click_count = clickCount;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeMac::TranslateMoveEvent(
|
||||
@ -389,21 +390,21 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMoveEvent(
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
if (!mouseLeave) {
|
||||
result.setType(blink::WebInputEvent::MouseMove);
|
||||
result.SetType(blink::WebInputEvent::kMouseMove);
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
else
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
} else {
|
||||
result.setType(blink::WebInputEvent::MouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.SetType(blink::WebInputEvent::kMouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
}
|
||||
|
||||
result.clickCount = 0;
|
||||
result.click_count = 0;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent(
|
||||
@ -413,28 +414,28 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent(
|
||||
result = blink::WebMouseWheelEvent();
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
result.setType(blink::WebInputEvent::MouseWheel);
|
||||
result.SetType(blink::WebInputEvent::kMouseWheel);
|
||||
|
||||
static const double scrollbarPixelsPerCocoaTick = 40.0;
|
||||
result.deltaX = deltaX;
|
||||
result.deltaY = deltaY;
|
||||
result.wheelTicksX = result.deltaX / scrollbarPixelsPerCocoaTick;
|
||||
result.wheelTicksY = result.deltaY / scrollbarPixelsPerCocoaTick;
|
||||
result.hasPreciseScrollingDeltas = true;
|
||||
result.delta_y = deltaX;
|
||||
result.delta_y = deltaY;
|
||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
||||
result.has_precise_scrolling_deltas = true;
|
||||
|
||||
// Unless the phase and momentumPhase are passed in as parameters to this
|
||||
// function, there is no way to know them
|
||||
result.phase = blink::WebMouseWheelEvent::PhaseNone;
|
||||
result.momentumPhase = blink::WebMouseWheelEvent::PhaseNone;
|
||||
result.phase = blink::WebMouseWheelEvent::kPhaseNone;
|
||||
result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone;
|
||||
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
else
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeMac::GetEventHandle(
|
||||
@ -461,20 +462,17 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
|
||||
blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event) const {
|
||||
// position
|
||||
result.x = mouse_event.x;
|
||||
result.y = mouse_event.y;
|
||||
result.windowX = result.x;
|
||||
result.windowY = result.y;
|
||||
result.SetPositionInWidget(mouse_event.x, mouse_event.y);
|
||||
|
||||
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y));
|
||||
result.globalX = screen_pt.x();
|
||||
result.globalY = screen_pt.y();
|
||||
const gfx::Point& screen_pt =
|
||||
GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y));
|
||||
result.SetPositionInScreen(screen_pt.x(), screen_pt.y());
|
||||
|
||||
// modifiers
|
||||
result.setModifiers(
|
||||
result.modifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
result.SetModifiers(
|
||||
result.GetModifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp - Mac OSX specific
|
||||
result.setTimeStampSeconds(currentEventTimestamp());
|
||||
result.SetTimeStampSeconds(currentEventTimestamp());
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,9 @@ WORD KeyStatesToWord() {
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin(
|
||||
const CefWindowInfo& window_info)
|
||||
: CefBrowserPlatformDelegateNative(window_info),
|
||||
const CefWindowInfo& window_info,
|
||||
SkColor background_color)
|
||||
: CefBrowserPlatformDelegateNative(window_info, background_color),
|
||||
host_window_created_(false),
|
||||
window_widget_(nullptr) {
|
||||
}
|
||||
@ -163,15 +164,6 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
|
||||
DCHECK(!window_widget_);
|
||||
|
||||
SkColor background_color = SK_ColorWHITE;
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
background_color = SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
// Adjust for potential display scaling.
|
||||
gfx::Point point = gfx::Point(cr.right, cr.bottom);
|
||||
float scale = display::Screen::GetScreen()->
|
||||
@ -180,7 +172,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||
|
||||
CefWindowDelegateView* delegate_view =
|
||||
new CefWindowDelegateView(background_color);
|
||||
new CefWindowDelegateView(GetBackgroundColor());
|
||||
delegate_view->Init(window_info_.window,
|
||||
browser_->web_contents(),
|
||||
gfx::Rect(0, 0, point.x(), point.y()));
|
||||
@ -331,27 +323,27 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
if (!msg.hwnd)
|
||||
return;
|
||||
|
||||
switch (event.type()) {
|
||||
case blink::WebInputEvent::RawKeyDown:
|
||||
msg.message = event.isSystemKey ? WM_SYSKEYDOWN : WM_KEYDOWN;
|
||||
switch (event.GetType()) {
|
||||
case blink::WebInputEvent::kRawKeyDown:
|
||||
msg.message = event.is_system_key ? WM_SYSKEYDOWN : WM_KEYDOWN;
|
||||
break;
|
||||
case blink::WebInputEvent::KeyUp:
|
||||
msg.message = event.isSystemKey ? WM_SYSKEYUP : WM_KEYUP;
|
||||
case blink::WebInputEvent::kKeyUp:
|
||||
msg.message = event.is_system_key ? WM_SYSKEYUP : WM_KEYUP;
|
||||
break;
|
||||
case blink::WebInputEvent::Char:
|
||||
msg.message = event.isSystemKey ? WM_SYSCHAR: WM_CHAR;
|
||||
case blink::WebInputEvent::kChar:
|
||||
msg.message = event.is_system_key ? WM_SYSCHAR: WM_CHAR;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return;
|
||||
}
|
||||
|
||||
msg.wParam = event.windowsKeyCode;
|
||||
msg.wParam = event.windows_key_code;
|
||||
|
||||
UINT scan_code = ::MapVirtualKeyW(event.windowsKeyCode, MAPVK_VK_TO_VSC);
|
||||
UINT scan_code = ::MapVirtualKeyW(event.windows_key_code, MAPVK_VK_TO_VSC);
|
||||
msg.lParam = (scan_code << 16) | // key scan code
|
||||
1; // key repeat count
|
||||
if (event.modifiers() & content::NativeWebKeyboardEvent::AltKey)
|
||||
if (event.GetModifiers() & content::NativeWebKeyboardEvent::kAltKey)
|
||||
msg.lParam |= (1 << 29);
|
||||
|
||||
DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
@ -368,19 +360,19 @@ void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol(
|
||||
void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
|
||||
content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const {
|
||||
result.windowsKeyCode = key_event.windows_key_code;
|
||||
result.nativeKeyCode = key_event.native_key_code;
|
||||
result.isSystemKey = key_event.is_system_key ? 1 : 0;
|
||||
result.windows_key_code = key_event.windows_key_code;
|
||||
result.native_key_code = key_event.native_key_code;
|
||||
result.is_system_key = key_event.is_system_key ? 1 : 0;
|
||||
switch (key_event.type) {
|
||||
case KEYEVENT_RAWKEYDOWN:
|
||||
case KEYEVENT_KEYDOWN:
|
||||
result.setType(blink::WebInputEvent::RawKeyDown);
|
||||
result.SetType(blink::WebInputEvent::kRawKeyDown);
|
||||
break;
|
||||
case KEYEVENT_KEYUP:
|
||||
result.setType(blink::WebInputEvent::KeyUp);
|
||||
result.SetType(blink::WebInputEvent::kKeyUp);
|
||||
break;
|
||||
case KEYEVENT_CHAR:
|
||||
result.setType(blink::WebInputEvent::Char);
|
||||
result.SetType(blink::WebInputEvent::kChar);
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
@ -388,27 +380,27 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
|
||||
|
||||
// Populate DOM values that will be passed to JavaScript handlers via
|
||||
// KeyboardEvent.
|
||||
result.domCode =
|
||||
result.dom_code =
|
||||
static_cast<int>(ui::KeycodeConverter::NativeKeycodeToDomCode(
|
||||
key_event.native_key_code));
|
||||
if (result.type() == blink::WebInputEvent::Char) {
|
||||
result.domKey = ui::DomKey::FromCharacter(key_event.windows_key_code);
|
||||
if (result.GetType() == blink::WebInputEvent::kChar) {
|
||||
result.dom_key = ui::DomKey::FromCharacter(key_event.windows_key_code);
|
||||
} else {
|
||||
// TODO(cef): CefKeyEvent does not currently pass extended key status (see
|
||||
// WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as
|
||||
// the |flags| parameter to DomKeyFromKeyboardCode().
|
||||
result.domKey = ui::PlatformKeyMap::DomKeyFromKeyboardCode(
|
||||
result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode(
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0);
|
||||
}
|
||||
|
||||
if (result.type() == blink::WebInputEvent::Char ||
|
||||
result.type() == blink::WebInputEvent::RawKeyDown) {
|
||||
result.text[0] = result.windowsKeyCode;
|
||||
result.unmodifiedText[0] = result.windowsKeyCode;
|
||||
if (result.GetType() == blink::WebInputEvent::kChar ||
|
||||
result.GetType() == blink::WebInputEvent::kRawKeyDown) {
|
||||
result.text[0] = result.windows_key_code;
|
||||
result.unmodified_text[0] = result.windows_key_code;
|
||||
}
|
||||
|
||||
result.setModifiers(
|
||||
result.modifiers() | TranslateModifiers(key_event.modifiers));
|
||||
result.SetModifiers(
|
||||
result.GetModifiers() | TranslateModifiers(key_event.modifiers));
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent(
|
||||
@ -420,25 +412,25 @@ void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent(
|
||||
|
||||
switch (type) {
|
||||
case MBT_LEFT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
break;
|
||||
case MBT_MIDDLE:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
break;
|
||||
case MBT_RIGHT:
|
||||
result.setType(mouseUp ? blink::WebInputEvent::MouseUp :
|
||||
blink::WebInputEvent::MouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp :
|
||||
blink::WebInputEvent::kMouseDown);
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
result.clickCount = clickCount;
|
||||
result.click_count = clickCount;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent(
|
||||
@ -448,21 +440,21 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent(
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
if (!mouseLeave) {
|
||||
result.setType(blink::WebInputEvent::MouseMove);
|
||||
result.SetType(blink::WebInputEvent::kMouseMove);
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Left;
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Middle;
|
||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||
else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::Right;
|
||||
result.button = blink::WebMouseEvent::Button::kRight;
|
||||
else
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
} else {
|
||||
result.setType(blink::WebInputEvent::MouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.SetType(blink::WebInputEvent::kMouseLeave);
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
}
|
||||
|
||||
result.clickCount = 0;
|
||||
result.click_count = 0;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent(
|
||||
@ -471,8 +463,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent(
|
||||
int deltaX, int deltaY) const {
|
||||
TranslateMouseEvent(result, mouse_event);
|
||||
|
||||
result.setType(blink::WebInputEvent::MouseWheel);
|
||||
result.button = blink::WebMouseEvent::Button::NoButton;
|
||||
result.SetType(blink::WebInputEvent::kMouseWheel);
|
||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||
|
||||
float wheelDelta;
|
||||
bool horizontalScroll = false;
|
||||
@ -494,19 +486,19 @@ void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent(
|
||||
ULONG scrollLines = defaultScrollLinesPerWheelDelta;
|
||||
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0);
|
||||
if (scrollLines == WHEEL_PAGESCROLL)
|
||||
result.scrollByPage = true;
|
||||
if (!result.scrollByPage)
|
||||
result.scroll_by_page = true;
|
||||
if (!result.scroll_by_page)
|
||||
scrollDelta *= static_cast<FLOAT>(scrollLines) * scrollbarPixelsPerLine;
|
||||
}
|
||||
|
||||
// Set scroll amount based on above calculations. WebKit expects positive
|
||||
// deltaY to mean "scroll up" and positive deltaX to mean "scroll left".
|
||||
if (horizontalScroll) {
|
||||
result.deltaX = scrollDelta;
|
||||
result.wheelTicksX = wheelDelta;
|
||||
result.delta_x = scrollDelta;
|
||||
result.wheel_ticks_x = wheelDelta;
|
||||
} else {
|
||||
result.deltaY = scrollDelta;
|
||||
result.wheelTicksY = wheelDelta;
|
||||
result.delta_y = scrollDelta;
|
||||
result.wheel_ticks_y = wheelDelta;
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,21 +528,18 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
|
||||
blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event) const {
|
||||
// position
|
||||
result.x = mouse_event.x;
|
||||
result.y = mouse_event.y;
|
||||
result.windowX = result.x;
|
||||
result.windowY = result.y;
|
||||
result.SetPositionInWidget(mouse_event.x, mouse_event.y);
|
||||
|
||||
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y));
|
||||
result.globalX = screen_pt.x();
|
||||
result.globalY = screen_pt.y();
|
||||
const gfx::Point& screen_pt =
|
||||
GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y));
|
||||
result.SetPositionInScreen(screen_pt.x(), screen_pt.y());
|
||||
|
||||
// modifiers
|
||||
result.setModifiers(
|
||||
result.modifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
result.SetModifiers(
|
||||
result.GetModifiers() | TranslateModifiers(mouse_event.modifiers));
|
||||
|
||||
// timestamp
|
||||
result.setTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -13,8 +13,8 @@
|
||||
class CefBrowserPlatformDelegateNativeWin :
|
||||
public CefBrowserPlatformDelegateNative {
|
||||
public:
|
||||
explicit CefBrowserPlatformDelegateNativeWin(
|
||||
const CefWindowInfo& window_info);
|
||||
CefBrowserPlatformDelegateNativeWin(const CefWindowInfo& window_info,
|
||||
SkColor background_color);
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
|
@ -289,10 +289,11 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
// We currently don't support items with both icons and checkboxes.
|
||||
const gfx::ImageSkia skia_icon = icon.AsImageSkia();
|
||||
DCHECK(type != ui::MenuModel::TYPE_CHECK);
|
||||
gfx::Canvas canvas(skia_icon.size(), 1.0f, false);
|
||||
canvas.DrawImageInt(skia_icon, 0, 0);
|
||||
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(
|
||||
skia_icon.width(), skia_icon.height(), false);
|
||||
canvas->drawBitmap(*skia_icon.bitmap(), 0, 0);
|
||||
DrawToNativeContext(
|
||||
canvas.sk_canvas(), dc,
|
||||
canvas.get(), dc,
|
||||
draw_item_struct->rcItem.left + kItemLeftMargin,
|
||||
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
|
||||
draw_item_struct->rcItem.top - skia_icon.height()) / 2, NULL);
|
||||
@ -308,9 +309,11 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
state = draw_item_struct->itemState & ODS_SELECTED ?
|
||||
NativeTheme::kHovered : NativeTheme::kNormal;
|
||||
}
|
||||
gfx::Canvas canvas(gfx::Size(config.check_width, config.check_height),
|
||||
1.0f,
|
||||
false);
|
||||
|
||||
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(
|
||||
config.check_width, config.check_height, false);
|
||||
cc::SkiaPaintCanvas paint_canvas(canvas.get());
|
||||
|
||||
NativeTheme::ExtraParams extra;
|
||||
extra.menu_check.is_radio = false;
|
||||
gfx::Rect bounds(0, 0, config.check_width, config.check_height);
|
||||
@ -319,13 +322,13 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
ui::NativeTheme* native_theme =
|
||||
ui::NativeTheme::GetInstanceForNativeUi();
|
||||
native_theme->Paint(
|
||||
canvas.sk_canvas(), NativeTheme::kMenuCheckBackground,
|
||||
&paint_canvas, NativeTheme::kMenuCheckBackground,
|
||||
state, bounds, extra);
|
||||
native_theme->Paint(
|
||||
canvas.sk_canvas(), NativeTheme::kMenuCheck, state, bounds, extra);
|
||||
&paint_canvas, NativeTheme::kMenuCheck, state, bounds, extra);
|
||||
|
||||
// Draw checkbox to menu.
|
||||
DrawToNativeContext(canvas.sk_canvas(), dc,
|
||||
DrawToNativeContext(canvas.get(), dc,
|
||||
draw_item_struct->rcItem.left + kItemLeftMargin,
|
||||
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
|
||||
draw_item_struct->rcItem.top - config.check_height) / 2, NULL);
|
||||
|
@ -295,7 +295,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
~CefWebUIControllerFactory() override {}
|
||||
|
||||
private:
|
||||
friend struct base::DefaultLazyInstanceTraits<CefWebUIControllerFactory>;
|
||||
friend struct base::LazyInstanceTraitsBase<CefWebUIControllerFactory>;
|
||||
|
||||
// From chrome/browser/chrome_content_browser_client.cc
|
||||
|
||||
|
@ -116,16 +116,18 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
: settings_(settings),
|
||||
net_log_(g_browser_process->net_log()),
|
||||
io_task_runner_(std::move(io_task_runner)),
|
||||
file_task_runner_(std::move(file_task_runner)),
|
||||
proxy_config_service_(std::move(proxy_config_service)),
|
||||
request_interceptors_(std::move(request_interceptors)) {
|
||||
io_state_(base::MakeUnique<IOState>()) {
|
||||
// Must first be created on the UI thread.
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(net_log_);
|
||||
|
||||
std::swap(protocol_handlers_, *protocol_handlers);
|
||||
io_state_->net_log_ = g_browser_process->net_log(),
|
||||
DCHECK(io_state_->net_log_);
|
||||
io_state_->io_task_runner_ = std::move(io_task_runner);
|
||||
io_state_->file_task_runner_ = std::move(file_task_runner);
|
||||
io_state_->proxy_config_service_ = std::move(proxy_config_service);
|
||||
io_state_->request_interceptors_ = std::move(request_interceptors);
|
||||
|
||||
std::swap(io_state_->protocol_handlers_, *protocol_handlers);
|
||||
|
||||
auto io_thread_proxy =
|
||||
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
|
||||
@ -141,7 +143,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
force_google_safesearch_.MoveToThread(io_thread_proxy);
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
|
||||
io_state_->gsapi_library_name_ =
|
||||
pref_service->GetString(prefs::kGSSAPILibraryName);
|
||||
#endif
|
||||
|
||||
auth_server_whitelist_.Init(
|
||||
@ -159,11 +162,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
|
||||
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
// Delete the ProxyService object here so that any pending requests will be
|
||||
// canceled before the associated URLRequestContext is destroyed in this
|
||||
// object's destructor.
|
||||
storage_->set_proxy_service(NULL);
|
||||
// This destructor may not be called during shutdown. Perform any required
|
||||
// shutdown in ShutdownOnIOThread() instead.
|
||||
}
|
||||
|
||||
// static
|
||||
@ -187,12 +187,32 @@ void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
|
||||
force_google_safesearch_.Destroy();
|
||||
auth_server_whitelist_.Destroy();
|
||||
auth_negotiate_delegate_whitelist_.Destroy();
|
||||
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefURLRequestContextGetterImpl::ShutdownOnIOThread, this));
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::ShutdownOnIOThread() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
shutting_down_ = true;
|
||||
|
||||
// Delete the ProxyService object here so that any pending requests will be
|
||||
// canceled before the URLRequestContext is destroyed.
|
||||
io_state_->storage_->set_proxy_service(NULL);
|
||||
|
||||
io_state_.reset();
|
||||
|
||||
NotifyContextShuttingDown();
|
||||
}
|
||||
|
||||
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (!url_request_context_.get()) {
|
||||
if (shutting_down_)
|
||||
return nullptr;
|
||||
|
||||
if (!io_state_->url_request_context_.get()) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
@ -200,11 +220,11 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
if (settings_.cache_path.length > 0)
|
||||
cache_path = base::FilePath(CefString(&settings_.cache_path));
|
||||
|
||||
url_request_context_.reset(new CefURLRequestContextImpl());
|
||||
url_request_context_->set_net_log(net_log_);
|
||||
io_state_->url_request_context_.reset(new CefURLRequestContextImpl());
|
||||
io_state_->url_request_context_->set_net_log(io_state_->net_log_);
|
||||
|
||||
storage_.reset(
|
||||
new net::URLRequestContextStorage(url_request_context_.get()));
|
||||
io_state_->storage_.reset(new net::URLRequestContextStorage(
|
||||
io_state_->url_request_context_.get()));
|
||||
|
||||
SetCookieStoragePath(cache_path,
|
||||
settings_.persist_session_cookies ? true : false);
|
||||
@ -212,49 +232,51 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
std::unique_ptr<CefNetworkDelegate> network_delegate(
|
||||
new CefNetworkDelegate());
|
||||
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
|
||||
storage_->set_network_delegate(std::move(network_delegate));
|
||||
io_state_->storage_->set_network_delegate(std::move(network_delegate));
|
||||
|
||||
const std::string& accept_language =
|
||||
settings_.accept_language_list.length > 0 ?
|
||||
CefString(&settings_.accept_language_list): "en-US,en";
|
||||
storage_->set_http_user_agent_settings(base::WrapUnique(
|
||||
io_state_->storage_->set_http_user_agent_settings(base::WrapUnique(
|
||||
new CefHttpUserAgentSettings(accept_language)));
|
||||
|
||||
storage_->set_host_resolver(
|
||||
net::HostResolver::CreateDefaultResolver(net_log_));
|
||||
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||
io_state_->storage_->set_host_resolver(
|
||||
net::HostResolver::CreateDefaultResolver(io_state_->net_log_));
|
||||
io_state_->storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||
|
||||
std::unique_ptr<net::TransportSecurityState> transport_security_state(
|
||||
new net::TransportSecurityState);
|
||||
transport_security_state->set_enforce_net_security_expiration(
|
||||
settings_.enable_net_security_expiration ? true : false);
|
||||
storage_->set_transport_security_state(std::move(transport_security_state));
|
||||
io_state_->storage_->set_transport_security_state(
|
||||
std::move(transport_security_state));
|
||||
|
||||
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
|
||||
net::ct::CreateLogVerifiersForKnownLogs());
|
||||
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
|
||||
new net::MultiLogCTVerifier());
|
||||
ct_verifier->AddLogs(ct_logs);
|
||||
storage_->set_cert_transparency_verifier(std::move(ct_verifier));
|
||||
io_state_->storage_->set_cert_transparency_verifier(std::move(ct_verifier));
|
||||
|
||||
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
|
||||
new net::CTPolicyEnforcer);
|
||||
ct_policy_enforcer->set_enforce_net_security_expiration(
|
||||
settings_.enable_net_security_expiration ? true : false);
|
||||
storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
|
||||
io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
|
||||
|
||||
std::unique_ptr<net::ProxyService> system_proxy_service =
|
||||
ProxyServiceFactory::CreateProxyService(
|
||||
net_log_,
|
||||
url_request_context_.get(),
|
||||
url_request_context_->network_delegate(),
|
||||
std::move(proxy_config_service_),
|
||||
io_state_->net_log_,
|
||||
io_state_->url_request_context_.get(),
|
||||
io_state_->url_request_context_->network_delegate(),
|
||||
std::move(io_state_->proxy_config_service_),
|
||||
*command_line,
|
||||
quick_check_enabled_.GetValue(),
|
||||
pac_https_url_stripping_enabled_.GetValue());
|
||||
storage_->set_proxy_service(std::move(system_proxy_service));
|
||||
io_state_->storage_->set_proxy_service(std::move(system_proxy_service));
|
||||
|
||||
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
||||
io_state_->storage_->set_ssl_config_service(
|
||||
new net::SSLConfigServiceDefaults);
|
||||
|
||||
std::vector<std::string> supported_schemes;
|
||||
supported_schemes.push_back("basic");
|
||||
@ -262,18 +284,18 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
supported_schemes.push_back("ntlm");
|
||||
supported_schemes.push_back("negotiate");
|
||||
|
||||
http_auth_preferences_.reset(
|
||||
io_state_->http_auth_preferences_.reset(
|
||||
new net::HttpAuthPreferences(supported_schemes
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
, gsapi_library_name_
|
||||
, io_state_->gsapi_library_name_
|
||||
#endif
|
||||
));
|
||||
|
||||
storage_->set_http_auth_handler_factory(
|
||||
io_state_->storage_->set_http_auth_handler_factory(
|
||||
net::HttpAuthHandlerRegistryFactory::Create(
|
||||
http_auth_preferences_.get(),
|
||||
url_request_context_->host_resolver()));
|
||||
storage_->set_http_server_properties(base::WrapUnique(
|
||||
io_state_->http_auth_preferences_.get(),
|
||||
io_state_->url_request_context_->host_resolver()));
|
||||
io_state_->storage_->set_http_server_properties(base::WrapUnique(
|
||||
new net::HttpServerPropertiesImpl));
|
||||
|
||||
base::FilePath http_cache_path;
|
||||
@ -294,74 +316,77 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
|
||||
net::HttpNetworkSession::Params network_session_params;
|
||||
network_session_params.host_resolver =
|
||||
url_request_context_->host_resolver();
|
||||
io_state_->url_request_context_->host_resolver();
|
||||
network_session_params.cert_verifier =
|
||||
url_request_context_->cert_verifier();
|
||||
io_state_->url_request_context_->cert_verifier();
|
||||
network_session_params.transport_security_state =
|
||||
url_request_context_->transport_security_state();
|
||||
io_state_->url_request_context_->transport_security_state();
|
||||
network_session_params.cert_transparency_verifier =
|
||||
url_request_context_->cert_transparency_verifier();
|
||||
io_state_->url_request_context_->cert_transparency_verifier();
|
||||
network_session_params.ct_policy_enforcer =
|
||||
url_request_context_->ct_policy_enforcer();
|
||||
io_state_->url_request_context_->ct_policy_enforcer();
|
||||
network_session_params.proxy_service =
|
||||
url_request_context_->proxy_service();
|
||||
io_state_->url_request_context_->proxy_service();
|
||||
network_session_params.ssl_config_service =
|
||||
url_request_context_->ssl_config_service();
|
||||
io_state_->url_request_context_->ssl_config_service();
|
||||
network_session_params.http_auth_handler_factory =
|
||||
url_request_context_->http_auth_handler_factory();
|
||||
io_state_->url_request_context_->http_auth_handler_factory();
|
||||
network_session_params.http_server_properties =
|
||||
url_request_context_->http_server_properties();
|
||||
io_state_->url_request_context_->http_server_properties();
|
||||
network_session_params.ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ? true : false;
|
||||
network_session_params.net_log = net_log_;
|
||||
network_session_params.net_log = io_state_->net_log_;
|
||||
|
||||
storage_->set_http_network_session(
|
||||
io_state_->storage_->set_http_network_session(
|
||||
base::WrapUnique(new net::HttpNetworkSession(network_session_params)));
|
||||
storage_->set_http_transaction_factory(base::WrapUnique(
|
||||
new net::HttpCache(storage_->http_network_session(),
|
||||
io_state_->storage_->set_http_transaction_factory(base::WrapUnique(
|
||||
new net::HttpCache(io_state_->storage_->http_network_session(),
|
||||
std::move(main_backend),
|
||||
true /* set_up_quic_server_info */)));
|
||||
|
||||
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
||||
new net::URLRequestJobFactoryImpl());
|
||||
url_request_manager_.reset(new CefURLRequestManager(job_factory.get()));
|
||||
io_state_->url_request_manager_.reset(
|
||||
new CefURLRequestManager(job_factory.get()));
|
||||
|
||||
// Install internal scheme handlers that cannot be overridden.
|
||||
scheme::InstallInternalProtectedHandlers(
|
||||
job_factory.get(),
|
||||
url_request_manager_.get(),
|
||||
&protocol_handlers_,
|
||||
io_state_->url_request_manager_.get(),
|
||||
&io_state_->protocol_handlers_,
|
||||
network_session_params.host_resolver);
|
||||
protocol_handlers_.clear();
|
||||
io_state_->protocol_handlers_.clear();
|
||||
|
||||
// Register internal scheme handlers that can be overridden.
|
||||
scheme::RegisterInternalHandlers(url_request_manager_.get());
|
||||
scheme::RegisterInternalHandlers(io_state_->url_request_manager_.get());
|
||||
|
||||
request_interceptors_.push_back(base::MakeUnique<CefRequestInterceptor>());
|
||||
io_state_->request_interceptors_.push_back(
|
||||
base::MakeUnique<CefRequestInterceptor>());
|
||||
|
||||
// Set up interceptors in the reverse order.
|
||||
std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||
std::move(job_factory);
|
||||
for (auto i = request_interceptors_.rbegin();
|
||||
i != request_interceptors_.rend(); ++i) {
|
||||
for (auto i = io_state_->request_interceptors_.rbegin();
|
||||
i != io_state_->request_interceptors_.rend(); ++i) {
|
||||
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
|
||||
std::move(top_job_factory), std::move(*i)));
|
||||
}
|
||||
request_interceptors_.clear();
|
||||
io_state_->request_interceptors_.clear();
|
||||
|
||||
storage_->set_job_factory(std::move(top_job_factory));
|
||||
io_state_->storage_->set_job_factory(std::move(top_job_factory));
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
// Only do this for the first (global) request context.
|
||||
static bool request_context_for_nss_set = false;
|
||||
if (!request_context_for_nss_set) {
|
||||
net::SetURLRequestContextForNSSHttpIO(url_request_context_.get());
|
||||
net::SetURLRequestContextForNSSHttpIO(
|
||||
io_state_->url_request_context_.get());
|
||||
request_context_for_nss_set = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return url_request_context_.get();
|
||||
return io_state_->url_request_context_.get();
|
||||
}
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner>
|
||||
@ -370,7 +395,7 @@ scoped_refptr<base::SingleThreadTaskRunner>
|
||||
}
|
||||
|
||||
net::HostResolver* CefURLRequestContextGetterImpl::GetHostResolver() const {
|
||||
return url_request_context_->host_resolver();
|
||||
return io_state_->url_request_context_->host_resolver();
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||
@ -378,9 +403,9 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||
bool persist_session_cookies) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (url_request_context_->cookie_store() &&
|
||||
((cookie_store_path_.empty() && path.empty()) ||
|
||||
cookie_store_path_ == path)) {
|
||||
if (io_state_->url_request_context_->cookie_store() &&
|
||||
((io_state_->cookie_store_path_.empty() && path.empty()) ||
|
||||
io_state_->cookie_store_path_ == path)) {
|
||||
// The path has not changed so don't do anything.
|
||||
return;
|
||||
}
|
||||
@ -412,23 +437,23 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||
new net::CookieMonster(persistent_store.get(), NULL));
|
||||
if (persistent_store.get() && persist_session_cookies)
|
||||
cookie_monster->SetPersistSessionCookies(true);
|
||||
cookie_store_path_ = path;
|
||||
io_state_->cookie_store_path_ = path;
|
||||
|
||||
// Restore the previously supported schemes.
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
|
||||
cookie_supported_schemes_);
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
cookie_monster.get(), io_state_->cookie_supported_schemes_);
|
||||
|
||||
storage_->set_cookie_store(std::move(cookie_monster));
|
||||
io_state_->storage_->set_cookie_store(std::move(cookie_monster));
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
||||
const std::vector<std::string>& schemes) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
cookie_supported_schemes_ = schemes;
|
||||
io_state_->cookie_supported_schemes_ = schemes;
|
||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
|
||||
cookie_supported_schemes_);
|
||||
io_state_->cookie_supported_schemes_);
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::AddHandler(
|
||||
@ -438,34 +463,36 @@ void CefURLRequestContextGetterImpl::AddHandler(
|
||||
base::Bind(&CefURLRequestContextGetterImpl::AddHandler, this, handler));
|
||||
return;
|
||||
}
|
||||
handler_list_.push_back(handler);
|
||||
io_state_->handler_list_.push_back(handler);
|
||||
}
|
||||
|
||||
net::CookieStore*
|
||||
CefURLRequestContextGetterImpl::GetExistingCookieStore() const {
|
||||
CEF_REQUIRE_IOT();
|
||||
if (url_request_context_ && url_request_context_->cookie_store())
|
||||
return url_request_context_->cookie_store();
|
||||
if (io_state_->url_request_context_ &&
|
||||
io_state_->url_request_context_->cookie_store()) {
|
||||
return io_state_->url_request_context_->cookie_store();
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
|
||||
if (proxy_config_service_.get())
|
||||
if (io_state_->proxy_config_service_.get())
|
||||
return;
|
||||
|
||||
proxy_config_service_ =
|
||||
io_state_->proxy_config_service_ =
|
||||
net::ProxyService::CreateSystemProxyConfigService(
|
||||
io_task_runner_, file_task_runner_);
|
||||
io_state_->io_task_runner_, io_state_->file_task_runner_);
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
|
||||
http_auth_preferences_->set_server_whitelist(
|
||||
io_state_->http_auth_preferences_->set_server_whitelist(
|
||||
auth_server_whitelist_.GetValue());
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
||||
http_auth_preferences_->set_delegate_whitelist(
|
||||
io_state_->http_auth_preferences_->set_delegate_whitelist(
|
||||
auth_negotiate_delegate_whitelist_.GetValue());
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
net::CookieStore* GetExistingCookieStore() const;
|
||||
|
||||
CefURLRequestManager* request_manager() const {
|
||||
return url_request_manager_.get();
|
||||
return io_state_->url_request_manager_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -89,29 +89,38 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
void UpdateServerWhitelist();
|
||||
void UpdateDelegateWhitelist();
|
||||
|
||||
void ShutdownOnIOThread();
|
||||
|
||||
const CefRequestContextSettings settings_;
|
||||
|
||||
net::NetLog* net_log_; // Guaranteed to outlive this object.
|
||||
bool shutting_down_ = false;
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
|
||||
// State that is only accessed on the IO thread and will be reset in
|
||||
// ShutdownOnIOThread().
|
||||
struct IOState {
|
||||
net::NetLog* net_log_ = nullptr; // Guaranteed to outlive this object.
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
std::string gsapi_library_name_;
|
||||
std::string gsapi_library_name_;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
|
||||
std::unique_ptr<net::URLRequestContextStorage> storage_;
|
||||
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
||||
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
|
||||
std::unique_ptr<CefURLRequestManager> url_request_manager_;
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
|
||||
std::unique_ptr<net::URLRequestContextStorage> storage_;
|
||||
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
||||
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
|
||||
std::unique_ptr<CefURLRequestManager> url_request_manager_;
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||
|
||||
base::FilePath cookie_store_path_;
|
||||
std::vector<std::string> cookie_supported_schemes_;
|
||||
base::FilePath cookie_store_path_;
|
||||
std::vector<std::string> cookie_supported_schemes_;
|
||||
|
||||
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
|
||||
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
|
||||
};
|
||||
std::unique_ptr<IOState> io_state_;
|
||||
|
||||
BooleanPrefMember quick_check_enabled_;
|
||||
BooleanPrefMember pac_https_url_stripping_enabled_;
|
||||
|
@ -21,9 +21,26 @@ CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
|
||||
CEF_REQUIRE_IOT();
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterProxy::ShutdownOnUIThread() {
|
||||
CEF_REQUIRE_UIT();
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefURLRequestContextGetterProxy::ShutdownOnIOThread, this));
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterProxy::ShutdownOnIOThread() {
|
||||
CEF_REQUIRE_IOT();
|
||||
shutting_down_ = true;
|
||||
context_proxy_.reset();
|
||||
NotifyContextShuttingDown();
|
||||
}
|
||||
|
||||
net::URLRequestContext*
|
||||
CefURLRequestContextGetterProxy::GetURLRequestContext() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (shutting_down_)
|
||||
return nullptr;
|
||||
|
||||
if (!context_proxy_) {
|
||||
context_proxy_.reset(
|
||||
new CefURLRequestContextProxy(static_cast<CefURLRequestContextImpl*>(
|
||||
|
@ -24,6 +24,9 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> parent);
|
||||
~CefURLRequestContextGetterProxy() override;
|
||||
|
||||
// Called when the StoragePartitionProxy is destroyed.
|
||||
void ShutdownOnUIThread();
|
||||
|
||||
// net::URLRequestContextGetter implementation.
|
||||
net::URLRequestContext* GetURLRequestContext() override;
|
||||
scoped_refptr<base::SingleThreadTaskRunner>
|
||||
@ -35,6 +38,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
||||
CefRefPtr<CefRequestContextHandler> handler() const { return handler_; }
|
||||
|
||||
private:
|
||||
void ShutdownOnIOThread();
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler_;
|
||||
|
||||
// The CefURLRequestContextImpl owned by |parent_| is passed as a raw pointer
|
||||
@ -44,6 +49,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
||||
|
||||
std::unique_ptr<CefURLRequestContextProxy> context_proxy_;
|
||||
|
||||
bool shutting_down_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy);
|
||||
};
|
||||
|
||||
|
@ -150,7 +150,7 @@ class CefOriginWhitelistManager {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefOriginWhitelistManager);
|
||||
};
|
||||
|
||||
base::LazyInstance<CefOriginWhitelistManager> g_manager =
|
||||
base::LazyInstance<CefOriginWhitelistManager>::Leaky g_manager =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
CefOriginWhitelistManager* CefOriginWhitelistManager::GetInstance() {
|
||||
|
@ -28,8 +28,7 @@ void CefBrowserPlatformDelegateOsr::CreateViewForWebContents(
|
||||
DCHECK(!view_osr_);
|
||||
|
||||
// Use the OSR view instead of the default platform view.
|
||||
view_osr_ = new CefWebContentsViewOSR(
|
||||
!!native_delegate_->window_info().transparent_painting_enabled);
|
||||
view_osr_ = new CefWebContentsViewOSR(GetBackgroundColor());
|
||||
*view = view_osr_;
|
||||
*delegate_view = view_osr_;
|
||||
}
|
||||
@ -68,6 +67,10 @@ void CefBrowserPlatformDelegateOsr::BrowserDestroyed(
|
||||
view_osr_ = nullptr;
|
||||
}
|
||||
|
||||
SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::WasResized() {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
|
||||
if (view)
|
||||
|
@ -27,6 +27,7 @@ class CefBrowserPlatformDelegateOsr :
|
||||
void WebContentsCreated(content::WebContents* web_contents) override;
|
||||
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/browser/renderer_host/resize_lock.h"
|
||||
#include "content/common/input_messages.h"
|
||||
#include "content/common/view_messages.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@ -63,73 +62,6 @@ static content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
|
||||
return screenInfo;
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
|
||||
// When accelerated compositing is enabled and a widget resize is pending,
|
||||
// we delay further resizes of the UI. The following constant is the maximum
|
||||
// length of time that we should delay further UI resizes while waiting for a
|
||||
// resized frame from a renderer.
|
||||
const int kResizeLockTimeoutMs = 67;
|
||||
|
||||
// Used to prevent further resizes while a resize is pending.
|
||||
class CefResizeLock : public content::ResizeLock {
|
||||
public:
|
||||
CefResizeLock(CefRenderWidgetHostViewOSR* host,
|
||||
const gfx::Size new_size,
|
||||
bool defer_compositor_lock,
|
||||
double timeout)
|
||||
: ResizeLock(new_size, defer_compositor_lock),
|
||||
host_(host),
|
||||
cancelled_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(host_);
|
||||
host_->HoldResize();
|
||||
|
||||
CEF_POST_DELAYED_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefResizeLock::CancelLock,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
timeout);
|
||||
}
|
||||
|
||||
~CefResizeLock() override {
|
||||
CancelLock();
|
||||
}
|
||||
|
||||
bool GrabDeferredLock() override {
|
||||
return ResizeLock::GrabDeferredLock();
|
||||
}
|
||||
|
||||
void UnlockCompositor() override {
|
||||
ResizeLock::UnlockCompositor();
|
||||
compositor_lock_ = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
void LockCompositor() override {
|
||||
ResizeLock::LockCompositor();
|
||||
compositor_lock_ = host_->GetCompositor()->GetCompositorLock();
|
||||
}
|
||||
|
||||
void CancelLock() {
|
||||
if (cancelled_)
|
||||
return;
|
||||
cancelled_ = true;
|
||||
UnlockCompositor();
|
||||
host_->ReleaseResize();
|
||||
}
|
||||
|
||||
private:
|
||||
CefRenderWidgetHostViewOSR* host_;
|
||||
scoped_refptr<ui::CompositorLock> compositor_lock_;
|
||||
bool cancelled_;
|
||||
base::WeakPtrFactory<CefResizeLock> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefResizeLock);
|
||||
};
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
} // namespace
|
||||
|
||||
// Used for managing copy requests when GPU compositing is enabled. Based on
|
||||
@ -450,11 +382,11 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
|
||||
|
||||
|
||||
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
bool transparent,
|
||||
SkColor background_color,
|
||||
content::RenderWidgetHost* widget,
|
||||
CefRenderWidgetHostViewOSR* parent_host_view,
|
||||
bool is_guest_view_hack)
|
||||
: transparent_(transparent),
|
||||
: background_color_(background_color),
|
||||
scale_factor_(kDefaultScaleFactor),
|
||||
frame_rate_threshold_ms_(0),
|
||||
#if !defined(OS_MACOSX)
|
||||
@ -493,6 +425,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
|
||||
PlatformCreateCompositorWidget(is_guest_view_hack);
|
||||
|
||||
bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE;
|
||||
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
|
||||
GetRootLayer()->SetColor(background_color_);
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// On macOS the ui::Compositor is created/owned by the platform view.
|
||||
content::ImageTransportFactory* factory =
|
||||
@ -655,14 +591,20 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) {
|
||||
if (transparent_)
|
||||
color = SkColorSetARGB(SK_AlphaTRANSPARENT, 0, 0, 0);
|
||||
// The renderer will feed its color back to us with the first CompositorFrame.
|
||||
// We short-cut here to show a sensible color before that happens.
|
||||
UpdateBackgroundColorFromRenderer(color);
|
||||
|
||||
content::RenderWidgetHostViewBase::SetBackgroundColor(color);
|
||||
DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
|
||||
SkColorGetA(color) == SK_AlphaTRANSPARENT);
|
||||
if (render_widget_host_) {
|
||||
render_widget_host_->SetBackgroundOpaque(
|
||||
SkColorGetA(color) == SK_AlphaOPAQUE);
|
||||
}
|
||||
}
|
||||
|
||||
const bool opaque = !transparent_ && GetBackgroundOpaque();
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->SetBackgroundOpaque(opaque);
|
||||
SkColor CefRenderWidgetHostViewOSR::background_color() const {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::LockMouse() {
|
||||
@ -672,8 +614,18 @@ bool CefRenderWidgetHostViewOSR::LockMouse() {
|
||||
void CefRenderWidgetHostViewOSR::UnlockMouse() {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
uint32_t output_surface_id,
|
||||
void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
cc::mojom::MojoCompositorFrameSinkClient*
|
||||
renderer_compositor_frame_sink) {
|
||||
renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
|
||||
if (GetDelegatedFrameHost()) {
|
||||
GetDelegatedFrameHost()->DidCreateNewRendererCompositorFrameSink(
|
||||
renderer_compositor_frame_sink_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const cc::LocalSurfaceId& local_surface_id,
|
||||
cc::CompositorFrame frame) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
@ -699,11 +651,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
|
||||
// The compositor will draw directly to the SoftwareOutputDevice which
|
||||
// then calls OnPaint.
|
||||
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
|
||||
std::move(frame));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
@ -718,11 +670,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
|
||||
damage_rect.Intersect(gfx::Rect(frame_size));
|
||||
|
||||
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
|
||||
std::move(frame));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
@ -793,7 +745,7 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
if (!handler.get())
|
||||
return;
|
||||
|
||||
content::WebCursor::CursorInfo cursor_info;
|
||||
content::CursorInfo cursor_info;
|
||||
cursor.GetCursorInfo(&cursor_info);
|
||||
|
||||
const cef_cursor_type_t cursor_type =
|
||||
@ -1067,7 +1019,7 @@ CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
|
||||
DCHECK(!copy_frame_generator_);
|
||||
DCHECK(!software_output_device_);
|
||||
software_output_device_ = new CefSoftwareOutputDeviceOSR(
|
||||
compositor, transparent_,
|
||||
compositor, background_color() == SK_ColorTRANSPARENT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::OnPaint,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
return base::WrapUnique(software_output_device_);
|
||||
@ -1104,33 +1056,15 @@ bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const {
|
||||
return !render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
std::unique_ptr<content::ResizeLock>
|
||||
CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock(
|
||||
bool defer_compositor_lock) {
|
||||
std::unique_ptr<content::CompositorResizeLock>
|
||||
CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() {
|
||||
HoldResize();
|
||||
|
||||
const gfx::Size& desired_size = GetRootLayer()->bounds().size();
|
||||
return std::unique_ptr<content::ResizeLock>(new CefResizeLock(
|
||||
this,
|
||||
desired_size,
|
||||
defer_compositor_lock,
|
||||
kResizeLockTimeoutMs));
|
||||
return base::MakeUnique<content::CompositorResizeLock>(this, desired_size);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DelegatedFrameHostResizeLockWasReleased() {
|
||||
return render_widget_host_->WasResized();
|
||||
}
|
||||
|
||||
void
|
||||
CefRenderWidgetHostViewOSR::DelegatedFrameHostSendReclaimCompositorResources(
|
||||
int output_surface_id,
|
||||
bool is_swap_ack,
|
||||
const cc::ReturnedResourceArray& resources) {
|
||||
render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources(
|
||||
render_widget_host_->GetRoutingID(), output_surface_id, is_swap_ack,
|
||||
resources));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetBeginFrameSource(
|
||||
cc::BeginFrameSource* source) {
|
||||
void CefRenderWidgetHostViewOSR::OnBeginFrame(const cc::BeginFrameArgs& args) {
|
||||
// TODO(cef): Maybe we can use this method in combination with
|
||||
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
@ -1140,10 +1074,20 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
|
||||
return render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
std::unique_ptr<ui::CompositorLock>
|
||||
CefRenderWidgetHostViewOSR::GetCompositorLock(
|
||||
ui::CompositorLockClient* client) {
|
||||
return GetCompositor()->GetCompositorLock(client);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CompositorResizeLockEnded() {
|
||||
ReleaseResize();
|
||||
}
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||
if (transparent_) {
|
||||
if (background_color() == SK_ColorTRANSPARENT) {
|
||||
SetBackgroundColor(SkColor());
|
||||
#if defined(OS_MACOSX)
|
||||
browser_compositor_->SetHasTransparentBackground(true);
|
||||
@ -1244,16 +1188,20 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
|
||||
const blink::WebMouseEvent& event) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseEvent");
|
||||
if (!IsPopupWidget()) {
|
||||
if (browser_impl_.get() && event.type() == blink::WebMouseEvent::MouseDown)
|
||||
if (browser_impl_.get() &&
|
||||
event.GetType() == blink::WebMouseEvent::kMouseDown) {
|
||||
browser_impl_->CancelContextMenu();
|
||||
}
|
||||
|
||||
if (popup_host_view_ &&
|
||||
popup_host_view_->popup_position_.Contains(event.x, event.y)) {
|
||||
popup_host_view_->popup_position_.Contains(
|
||||
event.PositionInWidget().x, event.PositionInWidget().y)) {
|
||||
blink::WebMouseEvent popup_event(event);
|
||||
popup_event.x -= popup_host_view_->popup_position_.x();
|
||||
popup_event.y -= popup_host_view_->popup_position_.y();
|
||||
popup_event.windowX = popup_event.x;
|
||||
popup_event.windowY = popup_event.y;
|
||||
popup_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
|
||||
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x,
|
||||
popup_event.PositionInWidget().y);
|
||||
|
||||
popup_host_view_->SendMouseEvent(popup_event);
|
||||
return;
|
||||
@ -1272,12 +1220,15 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
browser_impl_->CancelContextMenu();
|
||||
|
||||
if (popup_host_view_) {
|
||||
if (popup_host_view_->popup_position_.Contains(event.x, event.y)) {
|
||||
if (popup_host_view_->popup_position_.Contains(
|
||||
event.PositionInWidget().x, event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent popup_event(event);
|
||||
popup_event.x -= popup_host_view_->popup_position_.x();
|
||||
popup_event.y -= popup_host_view_->popup_position_.y();
|
||||
popup_event.windowX = popup_event.x;
|
||||
popup_event.windowY = popup_event.y;
|
||||
popup_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
|
||||
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x,
|
||||
popup_event.PositionInWidget().y);
|
||||
|
||||
popup_host_view_->SendMouseWheelEvent(popup_event);
|
||||
return;
|
||||
} else {
|
||||
@ -1601,9 +1552,7 @@ void CefRenderWidgetHostViewOSR::RequestImeCompositionUpdate(
|
||||
bool start_monitoring) {
|
||||
if (!render_widget_host_)
|
||||
return;
|
||||
render_widget_host_->Send(
|
||||
new InputMsg_RequestCompositionUpdate(render_widget_host_->GetRoutingID(),
|
||||
false, start_monitoring));
|
||||
render_widget_host_->RequestCompositionUpdates(false, start_monitoring);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
||||
@ -1644,3 +1593,13 @@ cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
|
||||
render_widget_host_->GetRoutingID()));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer(
|
||||
SkColor color) {
|
||||
if (color == background_color())
|
||||
return;
|
||||
background_color_ = color;
|
||||
|
||||
bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
|
||||
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
|
||||
GetRootLayer()->SetColor(color);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "cc/scheduler/begin_frame_source.h"
|
||||
#include "content/browser/renderer_host/compositor_resize_lock.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
@ -85,11 +86,12 @@ class CefRenderWidgetHostViewOSR
|
||||
: public content::RenderWidgetHostViewBase,
|
||||
public ui::CompositorDelegate
|
||||
#if !defined(OS_MACOSX)
|
||||
, public content::DelegatedFrameHostClient
|
||||
, public content::DelegatedFrameHostClient,
|
||||
public content::CompositorResizeLockClient
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
CefRenderWidgetHostViewOSR(const bool transparent,
|
||||
CefRenderWidgetHostViewOSR(SkColor background_color,
|
||||
content::RenderWidgetHost* widget,
|
||||
CefRenderWidgetHostViewOSR* parent_host_view,
|
||||
bool is_guest_view_hack);
|
||||
@ -111,6 +113,7 @@ class CefRenderWidgetHostViewOSR
|
||||
bool IsShowing() override;
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
SkColor background_color() const override;
|
||||
bool LockMouse() override;
|
||||
void UnlockMouse() override;
|
||||
|
||||
@ -125,7 +128,10 @@ class CefRenderWidgetHostViewOSR
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void OnSwapCompositorFrame(uint32_t output_surface_id,
|
||||
void DidCreateNewRendererCompositorFrameSink(
|
||||
cc::mojom::MojoCompositorFrameSinkClient*
|
||||
renderer_compositor_frame_sink) override;
|
||||
void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id,
|
||||
cc::CompositorFrame frame) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
@ -192,16 +198,16 @@ class CefRenderWidgetHostViewOSR
|
||||
bool DelegatedFrameHostIsVisible() const override;
|
||||
SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override;
|
||||
gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
|
||||
bool DelegatedFrameCanCreateResizeLock() const override;
|
||||
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
|
||||
bool defer_compositor_lock) override;
|
||||
void DelegatedFrameHostResizeLockWasReleased() override;
|
||||
void DelegatedFrameHostSendReclaimCompositorResources(
|
||||
int output_surface_id,
|
||||
bool is_swap_ack,
|
||||
const cc::ReturnedResourceArray& resources) override;
|
||||
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
|
||||
bool DelegatedFrameCanCreateResizeLock() const override;
|
||||
std::unique_ptr<content::CompositorResizeLock>
|
||||
DelegatedFrameHostCreateResizeLock() override;
|
||||
void OnBeginFrame(const cc::BeginFrameArgs& args) override;
|
||||
bool IsAutoResizeEnabled() const override;
|
||||
|
||||
// CompositorResizeLockClient implementation.
|
||||
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
||||
ui::CompositorLockClient* client) override;
|
||||
void CompositorResizeLockEnded() override;
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool InstallTransparency();
|
||||
@ -225,7 +231,7 @@ class CefRenderWidgetHostViewOSR
|
||||
void* bitmap_pixels);
|
||||
|
||||
bool IsPopupWidget() const {
|
||||
return popup_type_ != blink::WebPopupTypeNone;
|
||||
return popup_type_ != blink::kWebPopupTypeNone;
|
||||
}
|
||||
|
||||
void ImeSetComposition(
|
||||
@ -289,6 +295,10 @@ class CefRenderWidgetHostViewOSR
|
||||
|
||||
cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
|
||||
|
||||
// Applies background color without notifying the RenderWidget about
|
||||
// opaqueness changes.
|
||||
void UpdateBackgroundColorFromRenderer(SkColor color);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
friend class MacHelper;
|
||||
#endif
|
||||
@ -300,7 +310,8 @@ class CefRenderWidgetHostViewOSR
|
||||
ui::PlatformCursor GetPlatformCursor(blink::WebCursorInfo::Type type);
|
||||
#endif
|
||||
|
||||
const bool transparent_;
|
||||
// The background color of the web content.
|
||||
SkColor background_color_;
|
||||
|
||||
float scale_factor_;
|
||||
int frame_rate_threshold_ms_;
|
||||
@ -363,6 +374,9 @@ class CefRenderWidgetHostViewOSR
|
||||
gfx::Vector2dF last_scroll_offset_;
|
||||
bool is_scroll_offset_changed_pending_;
|
||||
|
||||
cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ =
|
||||
nullptr;
|
||||
|
||||
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRenderWidgetHostViewOSR);
|
||||
|
@ -23,92 +23,92 @@ using blink::WebCursorInfo;
|
||||
|
||||
int ToCursorID(WebCursorInfo::Type type) {
|
||||
switch (type) {
|
||||
case WebCursorInfo::TypePointer:
|
||||
case WebCursorInfo::kTypePointer:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeCross:
|
||||
case WebCursorInfo::kTypeCross:
|
||||
return XC_crosshair;
|
||||
case WebCursorInfo::TypeHand:
|
||||
case WebCursorInfo::kTypeHand:
|
||||
return XC_hand2;
|
||||
case WebCursorInfo::TypeIBeam:
|
||||
case WebCursorInfo::kTypeIBeam:
|
||||
return XC_xterm;
|
||||
case WebCursorInfo::TypeWait:
|
||||
case WebCursorInfo::kTypeWait:
|
||||
return XC_watch;
|
||||
case WebCursorInfo::TypeHelp:
|
||||
case WebCursorInfo::kTypeHelp:
|
||||
return XC_question_arrow;
|
||||
case WebCursorInfo::TypeEastResize:
|
||||
case WebCursorInfo::kTypeEastResize:
|
||||
return XC_right_side;
|
||||
case WebCursorInfo::TypeNorthResize:
|
||||
case WebCursorInfo::kTypeNorthResize:
|
||||
return XC_top_side;
|
||||
case WebCursorInfo::TypeNorthEastResize:
|
||||
case WebCursorInfo::kTypeNorthEastResize:
|
||||
return XC_top_right_corner;
|
||||
case WebCursorInfo::TypeNorthWestResize:
|
||||
case WebCursorInfo::kTypeNorthWestResize:
|
||||
return XC_top_left_corner;
|
||||
case WebCursorInfo::TypeSouthResize:
|
||||
case WebCursorInfo::kTypeSouthResize:
|
||||
return XC_bottom_side;
|
||||
case WebCursorInfo::TypeSouthEastResize:
|
||||
case WebCursorInfo::kTypeSouthEastResize:
|
||||
return XC_bottom_right_corner;
|
||||
case WebCursorInfo::TypeSouthWestResize:
|
||||
case WebCursorInfo::kTypeSouthWestResize:
|
||||
return XC_bottom_left_corner;
|
||||
case WebCursorInfo::TypeWestResize:
|
||||
case WebCursorInfo::kTypeWestResize:
|
||||
return XC_left_side;
|
||||
case WebCursorInfo::TypeNorthSouthResize:
|
||||
case WebCursorInfo::kTypeNorthSouthResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case WebCursorInfo::TypeEastWestResize:
|
||||
case WebCursorInfo::kTypeEastWestResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case WebCursorInfo::TypeNorthEastSouthWestResize:
|
||||
case WebCursorInfo::kTypeNorthEastSouthWestResize:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeNorthWestSouthEastResize:
|
||||
case WebCursorInfo::kTypeNorthWestSouthEastResize:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeColumnResize:
|
||||
case WebCursorInfo::kTypeColumnResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case WebCursorInfo::TypeRowResize:
|
||||
case WebCursorInfo::kTypeRowResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case WebCursorInfo::TypeMiddlePanning:
|
||||
case WebCursorInfo::kTypeMiddlePanning:
|
||||
return XC_fleur;
|
||||
case WebCursorInfo::TypeEastPanning:
|
||||
case WebCursorInfo::kTypeEastPanning:
|
||||
return XC_sb_right_arrow;
|
||||
case WebCursorInfo::TypeNorthPanning:
|
||||
case WebCursorInfo::kTypeNorthPanning:
|
||||
return XC_sb_up_arrow;
|
||||
case WebCursorInfo::TypeNorthEastPanning:
|
||||
case WebCursorInfo::kTypeNorthEastPanning:
|
||||
return XC_top_right_corner;
|
||||
case WebCursorInfo::TypeNorthWestPanning:
|
||||
case WebCursorInfo::kTypeNorthWestPanning:
|
||||
return XC_top_left_corner;
|
||||
case WebCursorInfo::TypeSouthPanning:
|
||||
case WebCursorInfo::kTypeSouthPanning:
|
||||
return XC_sb_down_arrow;
|
||||
case WebCursorInfo::TypeSouthEastPanning:
|
||||
case WebCursorInfo::kTypeSouthEastPanning:
|
||||
return XC_bottom_right_corner;
|
||||
case WebCursorInfo::TypeSouthWestPanning:
|
||||
case WebCursorInfo::kTypeSouthWestPanning:
|
||||
return XC_bottom_left_corner;
|
||||
case WebCursorInfo::TypeWestPanning:
|
||||
case WebCursorInfo::kTypeWestPanning:
|
||||
return XC_sb_left_arrow;
|
||||
case WebCursorInfo::TypeMove:
|
||||
case WebCursorInfo::kTypeMove:
|
||||
return XC_fleur;
|
||||
case WebCursorInfo::TypeVerticalText:
|
||||
case WebCursorInfo::kTypeVerticalText:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeCell:
|
||||
case WebCursorInfo::kTypeCell:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeContextMenu:
|
||||
case WebCursorInfo::kTypeContextMenu:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeAlias:
|
||||
case WebCursorInfo::kTypeAlias:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeProgress:
|
||||
case WebCursorInfo::kTypeProgress:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeNoDrop:
|
||||
case WebCursorInfo::kTypeNoDrop:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeCopy:
|
||||
case WebCursorInfo::kTypeCopy:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeNotAllowed:
|
||||
case WebCursorInfo::kTypeNotAllowed:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeZoomIn:
|
||||
case WebCursorInfo::kTypeZoomIn:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeZoomOut:
|
||||
case WebCursorInfo::kTypeZoomOut:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeGrab:
|
||||
case WebCursorInfo::kTypeGrab:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeGrabbing:
|
||||
case WebCursorInfo::kTypeGrabbing:
|
||||
return XC_left_ptr;
|
||||
case WebCursorInfo::TypeCustom:
|
||||
case WebCursorInfo::TypeNone:
|
||||
case WebCursorInfo::kTypeCustom:
|
||||
case WebCursorInfo::kTypeNone:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
@ -185,7 +185,7 @@ void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
||||
|
||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
blink::WebCursorInfo::Type type) {
|
||||
if (type == WebCursorInfo::TypeNone) {
|
||||
if (type == WebCursorInfo::kTypeNone) {
|
||||
if (!invisible_cursor_) {
|
||||
invisible_cursor_.reset(
|
||||
new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/common/view_messages.h"
|
||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
||||
#include "ui/events/latency_info.h"
|
||||
|
||||
|
||||
class MacHelper :
|
||||
public content::BrowserCompositorMacClient,
|
||||
@ -49,15 +47,6 @@ class MacHelper :
|
||||
return color;
|
||||
}
|
||||
|
||||
void BrowserCompositorMacSendReclaimCompositorResources(
|
||||
int output_surface_id,
|
||||
bool is_swap_ack,
|
||||
const cc::ReturnedResourceArray& resources) override {
|
||||
view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources(
|
||||
view_->render_widget_host()->GetRoutingID(), output_surface_id,
|
||||
is_swap_ack, resources));
|
||||
}
|
||||
|
||||
void BrowserCompositorMacSendBeginFrame(
|
||||
const cc::BeginFrameArgs& args) override {
|
||||
view_->render_widget_host()->Send(
|
||||
|
@ -46,91 +46,91 @@ using blink::WebCursorInfo;
|
||||
|
||||
LPCWSTR ToCursorID(WebCursorInfo::Type type) {
|
||||
switch (type) {
|
||||
case WebCursorInfo::TypePointer:
|
||||
case WebCursorInfo::kTypePointer:
|
||||
return IDC_ARROW;
|
||||
case WebCursorInfo::TypeCross:
|
||||
case WebCursorInfo::kTypeCross:
|
||||
return IDC_CROSS;
|
||||
case WebCursorInfo::TypeHand:
|
||||
case WebCursorInfo::kTypeHand:
|
||||
return IDC_HAND;
|
||||
case WebCursorInfo::TypeIBeam:
|
||||
case WebCursorInfo::kTypeIBeam:
|
||||
return IDC_IBEAM;
|
||||
case WebCursorInfo::TypeWait:
|
||||
case WebCursorInfo::kTypeWait:
|
||||
return IDC_WAIT;
|
||||
case WebCursorInfo::TypeHelp:
|
||||
case WebCursorInfo::kTypeHelp:
|
||||
return IDC_HELP;
|
||||
case WebCursorInfo::TypeEastResize:
|
||||
case WebCursorInfo::kTypeEastResize:
|
||||
return IDC_SIZEWE;
|
||||
case WebCursorInfo::TypeNorthResize:
|
||||
case WebCursorInfo::kTypeNorthResize:
|
||||
return IDC_SIZENS;
|
||||
case WebCursorInfo::TypeNorthEastResize:
|
||||
case WebCursorInfo::kTypeNorthEastResize:
|
||||
return IDC_SIZENESW;
|
||||
case WebCursorInfo::TypeNorthWestResize:
|
||||
case WebCursorInfo::kTypeNorthWestResize:
|
||||
return IDC_SIZENWSE;
|
||||
case WebCursorInfo::TypeSouthResize:
|
||||
case WebCursorInfo::kTypeSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case WebCursorInfo::TypeSouthEastResize:
|
||||
case WebCursorInfo::kTypeSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case WebCursorInfo::TypeSouthWestResize:
|
||||
case WebCursorInfo::kTypeSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case WebCursorInfo::TypeWestResize:
|
||||
case WebCursorInfo::kTypeWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case WebCursorInfo::TypeNorthSouthResize:
|
||||
case WebCursorInfo::kTypeNorthSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case WebCursorInfo::TypeEastWestResize:
|
||||
case WebCursorInfo::kTypeEastWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case WebCursorInfo::TypeNorthEastSouthWestResize:
|
||||
case WebCursorInfo::kTypeNorthEastSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case WebCursorInfo::TypeNorthWestSouthEastResize:
|
||||
case WebCursorInfo::kTypeNorthWestSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case WebCursorInfo::TypeColumnResize:
|
||||
case WebCursorInfo::kTypeColumnResize:
|
||||
return MAKEINTRESOURCE(IDC_COLRESIZE);
|
||||
case WebCursorInfo::TypeRowResize:
|
||||
case WebCursorInfo::kTypeRowResize:
|
||||
return MAKEINTRESOURCE(IDC_ROWRESIZE);
|
||||
case WebCursorInfo::TypeMiddlePanning:
|
||||
case WebCursorInfo::kTypeMiddlePanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
|
||||
case WebCursorInfo::TypeEastPanning:
|
||||
case WebCursorInfo::kTypeEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_EAST);
|
||||
case WebCursorInfo::TypeNorthPanning:
|
||||
case WebCursorInfo::kTypeNorthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH);
|
||||
case WebCursorInfo::TypeNorthEastPanning:
|
||||
case WebCursorInfo::kTypeNorthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
|
||||
case WebCursorInfo::TypeNorthWestPanning:
|
||||
case WebCursorInfo::kTypeNorthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
|
||||
case WebCursorInfo::TypeSouthPanning:
|
||||
case WebCursorInfo::kTypeSouthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
|
||||
case WebCursorInfo::TypeSouthEastPanning:
|
||||
case WebCursorInfo::kTypeSouthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
|
||||
case WebCursorInfo::TypeSouthWestPanning:
|
||||
case WebCursorInfo::kTypeSouthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
|
||||
case WebCursorInfo::TypeWestPanning:
|
||||
case WebCursorInfo::kTypeWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_WEST);
|
||||
case WebCursorInfo::TypeMove:
|
||||
case WebCursorInfo::kTypeMove:
|
||||
return IDC_SIZEALL;
|
||||
case WebCursorInfo::TypeVerticalText:
|
||||
case WebCursorInfo::kTypeVerticalText:
|
||||
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
|
||||
case WebCursorInfo::TypeCell:
|
||||
case WebCursorInfo::kTypeCell:
|
||||
return MAKEINTRESOURCE(IDC_CELL);
|
||||
case WebCursorInfo::TypeContextMenu:
|
||||
case WebCursorInfo::kTypeContextMenu:
|
||||
return IDC_ARROW;
|
||||
case WebCursorInfo::TypeAlias:
|
||||
case WebCursorInfo::kTypeAlias:
|
||||
return MAKEINTRESOURCE(IDC_ALIAS);
|
||||
case WebCursorInfo::TypeProgress:
|
||||
case WebCursorInfo::kTypeProgress:
|
||||
return IDC_APPSTARTING;
|
||||
case WebCursorInfo::TypeNoDrop:
|
||||
case WebCursorInfo::kTypeNoDrop:
|
||||
return IDC_NO;
|
||||
case WebCursorInfo::TypeCopy:
|
||||
case WebCursorInfo::kTypeCopy:
|
||||
return MAKEINTRESOURCE(IDC_COPYCUR);
|
||||
case WebCursorInfo::TypeNone:
|
||||
case WebCursorInfo::kTypeNone:
|
||||
return MAKEINTRESOURCE(IDC_CURSOR_NONE);
|
||||
case WebCursorInfo::TypeNotAllowed:
|
||||
case WebCursorInfo::kTypeNotAllowed:
|
||||
return IDC_NO;
|
||||
case WebCursorInfo::TypeZoomIn:
|
||||
case WebCursorInfo::kTypeZoomIn:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMIN);
|
||||
case WebCursorInfo::TypeZoomOut:
|
||||
case WebCursorInfo::kTypeZoomOut:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMOUT);
|
||||
case WebCursorInfo::TypeGrab:
|
||||
case WebCursorInfo::kTypeGrab:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||
case WebCursorInfo::TypeGrabbing:
|
||||
case WebCursorInfo::kTypeGrabbing:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||
}
|
||||
NOTREACHED();
|
||||
|
@ -14,10 +14,9 @@
|
||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/user_metrics.h"
|
||||
|
||||
CefWebContentsViewOSR::CefWebContentsViewOSR(bool transparent)
|
||||
: transparent_(transparent),
|
||||
CefWebContentsViewOSR::CefWebContentsViewOSR(SkColor background_color)
|
||||
: background_color_(background_color),
|
||||
web_contents_(NULL) {
|
||||
}
|
||||
|
||||
@ -100,9 +99,8 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
|
||||
}
|
||||
|
||||
const bool is_guest_view_hack = !!embedder_render_widget_host;
|
||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||
embedder_host_view,
|
||||
is_guest_view_hack);
|
||||
return new CefRenderWidgetHostViewOSR(background_color_, render_widget_host,
|
||||
embedder_host_view, is_guest_view_hack);
|
||||
}
|
||||
|
||||
// Called for popup and fullscreen widgets.
|
||||
@ -112,8 +110,8 @@ content::RenderWidgetHostViewBase*
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
CHECK(view);
|
||||
|
||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view,
|
||||
false);
|
||||
return new CefRenderWidgetHostViewOSR(background_color_, render_widget_host,
|
||||
view, false);
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
|
||||
#include "content/browser/web_contents/web_contents_view.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserPluginGuest;
|
||||
@ -22,7 +23,7 @@ class CefRenderWidgetHostViewOSR;
|
||||
class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
public content::RenderViewHostDelegateView {
|
||||
public:
|
||||
explicit CefWebContentsViewOSR(bool transparent);
|
||||
explicit CefWebContentsViewOSR(SkColor background_color);
|
||||
~CefWebContentsViewOSR() override;
|
||||
|
||||
void WebContentsCreated(content::WebContents* web_contents);
|
||||
@ -74,7 +75,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
CefRenderWidgetHostViewOSR* GetView() const;
|
||||
CefBrowserHostImpl* GetBrowser() const;
|
||||
|
||||
const bool transparent_;
|
||||
const SkColor background_color_;
|
||||
|
||||
content::WebContents* web_contents_;
|
||||
|
||||
|
@ -63,7 +63,7 @@ class ShutdownNotifierFactory
|
||||
static ShutdownNotifierFactory* GetInstance();
|
||||
|
||||
private:
|
||||
friend struct base::DefaultLazyInstanceTraits<ShutdownNotifierFactory>;
|
||||
friend struct base::LazyInstanceTraitsBase<ShutdownNotifierFactory>;
|
||||
|
||||
ShutdownNotifierFactory()
|
||||
: BrowserContextKeyedServiceShutdownNotifierFactory(
|
||||
@ -370,19 +370,6 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION)
|
||||
// Check if the plugin is outdated.
|
||||
if (plugin_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE &&
|
||||
!allow_outdated_plugins_.GetValue()) {
|
||||
if (allow_outdated_plugins_.IsManaged()) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed;
|
||||
} else {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check if the plugin is crashing too much.
|
||||
if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) &&
|
||||
!always_authorize_plugins_.GetValue() &&
|
||||
|
@ -97,7 +97,8 @@ const char kUserPrefsFileName[] = "UserPrefs.json";
|
||||
std::unique_ptr<PrefService> CreatePrefService(
|
||||
Profile* profile,
|
||||
const base::FilePath& cache_path,
|
||||
bool persist_user_preferences) {
|
||||
bool persist_user_preferences,
|
||||
bool is_pre_initialization) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
@ -114,7 +115,8 @@ std::unique_ptr<PrefService> CreatePrefService(
|
||||
factory.set_command_line_prefs(command_line_pref_store);
|
||||
|
||||
// True if preferences will be stored on disk.
|
||||
const bool store_on_disk = !cache_path.empty() && persist_user_preferences;
|
||||
const bool store_on_disk = !cache_path.empty() && persist_user_preferences &&
|
||||
!is_pre_initialization;
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner;
|
||||
if (store_on_disk) {
|
||||
@ -141,23 +143,27 @@ std::unique_ptr<PrefService> CreatePrefService(
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||
// Used to store supervised user preferences.
|
||||
SupervisedUserSettingsService* supervised_user_settings =
|
||||
SupervisedUserSettingsServiceFactory::GetForProfile(profile);
|
||||
// Don't access factories during pre-initialization.
|
||||
if (!is_pre_initialization) {
|
||||
// Used to store supervised user preferences.
|
||||
SupervisedUserSettingsService* supervised_user_settings =
|
||||
SupervisedUserSettingsServiceFactory::GetForProfile(profile);
|
||||
|
||||
if (store_on_disk) {
|
||||
supervised_user_settings->Init(
|
||||
cache_path, sequenced_task_runner.get(), true);
|
||||
} else {
|
||||
scoped_refptr<TestingPrefStore> testing_pref_store = new TestingPrefStore();
|
||||
testing_pref_store->SetInitializationCompleted();
|
||||
supervised_user_settings->Init(testing_pref_store);
|
||||
if (store_on_disk) {
|
||||
supervised_user_settings->Init(
|
||||
cache_path, sequenced_task_runner.get(), true);
|
||||
} else {
|
||||
scoped_refptr<TestingPrefStore> testing_pref_store =
|
||||
new TestingPrefStore();
|
||||
testing_pref_store->SetInitializationCompleted();
|
||||
supervised_user_settings->Init(testing_pref_store);
|
||||
}
|
||||
|
||||
scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr(
|
||||
new SupervisedUserPrefStore(supervised_user_settings));
|
||||
DCHECK(supervised_user_prefs->IsInitializationComplete());
|
||||
factory.set_supervised_user_prefs(supervised_user_prefs);
|
||||
}
|
||||
|
||||
scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr(
|
||||
new SupervisedUserPrefStore(supervised_user_settings));
|
||||
DCHECK(supervised_user_prefs->IsInitializationComplete());
|
||||
factory.set_supervised_user_prefs(supervised_user_prefs);
|
||||
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||
|
||||
// Registry that will be populated with all known preferences. Preferences
|
||||
@ -182,7 +188,7 @@ std::unique_ptr<PrefService> CreatePrefService(
|
||||
// Spell checking preferences.
|
||||
// Based on SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries,
|
||||
new base::ListValue);
|
||||
base::MakeUnique<base::ListValue>());
|
||||
std::string spellcheck_lang =
|
||||
command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang);
|
||||
if (!spellcheck_lang.empty()) {
|
||||
|
@ -19,11 +19,14 @@ namespace browser_prefs {
|
||||
// Name for the user prefs JSON file.
|
||||
extern const char kUserPrefsFileName[];
|
||||
|
||||
// Create the PrefService used to manage pref registration and storage.
|
||||
// Create the PrefService used to manage pref registration and storage. If
|
||||
// |is_pre_initialization| is true a non-persistent PrefService will be created
|
||||
// for temporary usage during BrowserContextServices initialization.
|
||||
std::unique_ptr<PrefService> CreatePrefService(
|
||||
Profile* profile,
|
||||
const base::FilePath& cache_path,
|
||||
bool persist_user_preferences);
|
||||
bool persist_user_preferences,
|
||||
bool is_pre_initialization);
|
||||
|
||||
} // namespace browser_prefs
|
||||
|
||||
|
@ -272,7 +272,7 @@ void SetString(CommandLinePrefStore* prefs,
|
||||
const std::string& value) {
|
||||
prefs->SetValue(
|
||||
key,
|
||||
base::WrapUnique(new base::StringValue(value)),
|
||||
base::WrapUnique(new base::Value(value)),
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
|
||||
@ -284,28 +284,6 @@ void SetBool(CommandLinePrefStore* prefs,
|
||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||
}
|
||||
|
||||
SkColor GetBaseBackgroundColor(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
if (browser.get()) {
|
||||
const CefBrowserSettings& browser_settings = browser->settings();
|
||||
if (CefColorGetA(browser_settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(browser_settings.background_color),
|
||||
CefColorGetG(browser_settings.background_color),
|
||||
CefColorGetB(browser_settings.background_color));
|
||||
}
|
||||
}
|
||||
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
return SK_ColorWHITE;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) {
|
||||
@ -368,7 +346,7 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
|
||||
SetDefaultPrefs(web);
|
||||
|
||||
// Set preferences based on the context's PrefService.
|
||||
if (browser.get()) {
|
||||
if (browser) {
|
||||
CefBrowserContext* profile =
|
||||
static_cast<CefBrowserContext*>(
|
||||
browser->web_contents()->GetBrowserContext());
|
||||
@ -379,11 +357,18 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
|
||||
SetExtensionPrefs(rvh, web);
|
||||
|
||||
// Set preferences based on CefBrowserSettings.
|
||||
if (browser.get())
|
||||
if (browser)
|
||||
SetCefPrefs(browser->settings(), web);
|
||||
|
||||
// Set the background color for the WebView.
|
||||
web.base_background_color = GetBaseBackgroundColor(browser);
|
||||
if (browser) {
|
||||
web.base_background_color = browser->GetBackgroundColor();
|
||||
} else {
|
||||
// We don't know for sure that the browser will be windowless but assume
|
||||
// that the global windowless state is likely to be accurate.
|
||||
web.base_background_color =
|
||||
CefContext::Get()->GetBackgroundColor(nullptr, STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace renderer_prefs
|
||||
|
@ -50,6 +50,8 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
print_settings.SetBoolean(kSettingRasterizePdf, false);
|
||||
print_settings.SetBoolean(kSettingGenerateDraftData, false);
|
||||
print_settings.SetBoolean(kSettingPreviewModifiable, false);
|
||||
print_settings.SetInteger(kSettingDpiHorizontal, 0);
|
||||
print_settings.SetInteger(kSettingDpiVertical, 0);
|
||||
|
||||
// User defined settings.
|
||||
print_settings.SetBoolean(kSettingLandscape, !!pdf_settings.landscape);
|
||||
|
@ -48,7 +48,7 @@ class ShutdownNotifierFactory
|
||||
static ShutdownNotifierFactory* GetInstance();
|
||||
|
||||
private:
|
||||
friend struct base::DefaultLazyInstanceTraits<ShutdownNotifierFactory>;
|
||||
friend struct base::LazyInstanceTraitsBase<ShutdownNotifierFactory>;
|
||||
|
||||
ShutdownNotifierFactory()
|
||||
: BrowserContextKeyedServiceShutdownNotifierFactory(
|
||||
|
@ -37,26 +37,13 @@ bool ShouldProxyUserData(const void* key) {
|
||||
|
||||
CefResourceContext::CefResourceContext(
|
||||
bool is_off_the_record,
|
||||
extensions::InfoMap* extension_info_map,
|
||||
CefRefPtr<CefRequestContextHandler> handler)
|
||||
: parent_(nullptr),
|
||||
is_off_the_record_(is_off_the_record),
|
||||
extension_info_map_(extension_info_map),
|
||||
handler_(handler) {
|
||||
}
|
||||
|
||||
CefResourceContext::~CefResourceContext() {
|
||||
if (getter_.get()) {
|
||||
// When the parent object (ResourceContext) destructor executes all
|
||||
// associated URLRequests should be destroyed. If there are no other
|
||||
// references it should then be safe to destroy the URLRequestContextGetter
|
||||
// which owns the URLRequestContext.
|
||||
getter_->AddRef();
|
||||
CefURLRequestContextGetter* raw_getter = getter_.get();
|
||||
getter_ = NULL;
|
||||
content::BrowserThread::ReleaseSoon(
|
||||
content::BrowserThread::IO, FROM_HERE, raw_getter);
|
||||
}
|
||||
}
|
||||
|
||||
base::SupportsUserData::Data* CefResourceContext::GetUserData(const void* key)
|
||||
@ -117,6 +104,12 @@ std::unique_ptr<net::ClientCertStore>
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefResourceContext::set_extensions_info_map(
|
||||
extensions::InfoMap* extensions_info_map) {
|
||||
DCHECK(!extension_info_map_);
|
||||
extension_info_map_ = extensions_info_map;
|
||||
}
|
||||
|
||||
void CefResourceContext::set_url_request_context_getter(
|
||||
CefURLRequestContextGetter* getter) {
|
||||
DCHECK(!getter_.get());
|
||||
|
@ -28,7 +28,6 @@ enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
class CefResourceContext : public content::ResourceContext {
|
||||
public:
|
||||
CefResourceContext(bool is_off_the_record,
|
||||
extensions::InfoMap* extension_info_map,
|
||||
CefRefPtr<CefRequestContextHandler> handler);
|
||||
~CefResourceContext() override;
|
||||
|
||||
@ -44,6 +43,7 @@ class CefResourceContext : public content::ResourceContext {
|
||||
|
||||
std::unique_ptr<net::ClientCertStore> CreateClientCertStore();
|
||||
|
||||
void set_extensions_info_map(extensions::InfoMap* extensions_info_map);
|
||||
void set_url_request_context_getter(CefURLRequestContextGetter* getter);
|
||||
void set_parent(CefResourceContext* parent);
|
||||
|
||||
|
@ -11,6 +11,10 @@ CefStoragePartitionProxy::CefStoragePartitionProxy(
|
||||
url_request_context_(url_request_context) {
|
||||
}
|
||||
|
||||
CefStoragePartitionProxy::~CefStoragePartitionProxy() {
|
||||
url_request_context_->ShutdownOnUIThread();
|
||||
}
|
||||
|
||||
base::FilePath CefStoragePartitionProxy::GetPath() {
|
||||
return parent_->GetPath();
|
||||
}
|
||||
@ -76,6 +80,11 @@ CefStoragePartitionProxy::GetPlatformNotificationContext() {
|
||||
return parent_->GetPlatformNotificationContext();
|
||||
}
|
||||
|
||||
content::BackgroundFetchContext*
|
||||
CefStoragePartitionProxy::GetBackgroundFetchContext() {
|
||||
return parent_->GetBackgroundFetchContext();
|
||||
}
|
||||
|
||||
content::BackgroundSyncContext*
|
||||
CefStoragePartitionProxy::GetBackgroundSyncContext() {
|
||||
return parent_->GetBackgroundSyncContext();
|
||||
@ -130,6 +139,14 @@ void CefStoragePartitionProxy::ClearData(
|
||||
cookie_matcher, begin, end, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
const base::Closure& callback) {
|
||||
parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, callback);
|
||||
}
|
||||
|
||||
void CefStoragePartitionProxy::Flush() {
|
||||
parent_->Flush();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
CefStoragePartitionProxy(
|
||||
content::StoragePartition* parent,
|
||||
CefURLRequestContextGetterProxy* url_request_context);
|
||||
~CefStoragePartitionProxy() override;
|
||||
|
||||
// StoragePartition methods:
|
||||
base::FilePath GetPath() override;
|
||||
@ -36,6 +37,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
content::ZoomLevelDelegate* GetZoomLevelDelegate() override;
|
||||
content::PlatformNotificationContext* GetPlatformNotificationContext()
|
||||
override;
|
||||
content::BackgroundFetchContext* GetBackgroundFetchContext() override;
|
||||
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
|
||||
content::PaymentAppContextImpl* GetPaymentAppContext() override;
|
||||
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
||||
@ -59,6 +61,11 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Closure& callback) override;
|
||||
void ClearHttpAndMediaCaches(
|
||||
const base::Time begin,
|
||||
const base::Time end,
|
||||
const base::Callback<bool(const GURL&)>& url_matcher,
|
||||
const base::Closure& callback) override;
|
||||
void Flush() override;
|
||||
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
||||
void Bind(
|
||||
|
@ -166,6 +166,10 @@ void CefBrowserPlatformDelegateViews::PopupBrowserCreated(
|
||||
}
|
||||
}
|
||||
|
||||
SkColor CefBrowserPlatformDelegateViews::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateViews::WasResized() {
|
||||
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
|
@ -42,6 +42,7 @@ class CefBrowserPlatformDelegateViews :
|
||||
void PopupBrowserCreated(
|
||||
CefBrowserHostImpl* new_browser,
|
||||
bool is_devtools) override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
|
@ -181,22 +181,8 @@ void CefBrowserViewImpl::SetPendingBrowserCreateParams(
|
||||
}
|
||||
|
||||
void CefBrowserViewImpl::SetDefaults(const CefBrowserSettings& settings) {
|
||||
SkColor background_color = SK_ColorWHITE;
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
background_color = SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
} else {
|
||||
const CefSettings& global_settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(global_settings.background_color) > 0) {
|
||||
background_color = SkColorSetRGB(
|
||||
CefColorGetR(global_settings.background_color),
|
||||
CefColorGetG(global_settings.background_color),
|
||||
CefColorGetB(global_settings.background_color));
|
||||
}
|
||||
}
|
||||
SetBackgroundColor(background_color);
|
||||
SetBackgroundColor(
|
||||
CefContext::Get()->GetBackgroundColor(&settings, STATE_DISABLED));
|
||||
}
|
||||
|
||||
CefBrowserViewView* CefBrowserViewImpl::CreateRootView() {
|
||||
@ -213,7 +199,8 @@ bool CefBrowserViewImpl::HandleAccelerator(
|
||||
// Previous calls to TranslateMessage can generate Char events as well as
|
||||
// RawKeyDown events, even if the latter triggered an accelerator. In these
|
||||
// cases, we discard the Char events.
|
||||
if (event.type() == blink::WebInputEvent::Char && ignore_next_char_event_) {
|
||||
if (event.GetType() == blink::WebInputEvent::kChar &&
|
||||
ignore_next_char_event_) {
|
||||
ignore_next_char_event_ = false;
|
||||
return true;
|
||||
}
|
||||
@ -222,7 +209,7 @@ bool CefBrowserViewImpl::HandleAccelerator(
|
||||
// always generate a Char event.
|
||||
ignore_next_char_event_ = false;
|
||||
|
||||
if (event.type() == blink::WebInputEvent::RawKeyDown) {
|
||||
if (event.GetType() == blink::WebInputEvent::kRawKeyDown) {
|
||||
ui::Accelerator accelerator =
|
||||
ui::GetAcceleratorFromNativeWebKeyboardEvent(event);
|
||||
|
||||
|
@ -111,7 +111,7 @@ CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetEnabledTextColors(
|
||||
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetFontList(
|
||||
const CefString& font_list) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
ParentClass::root_view()->SetFontListDeprecated(gfx::FontList(font_list));
|
||||
ParentClass::root_view()->SetFontList(gfx::FontList(font_list));
|
||||
}
|
||||
|
||||
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetHorizontalAlignment(
|
||||
|
@ -91,7 +91,7 @@ bool ParamTraits<scoped_refptr<net::UploadData> >::Read(
|
||||
return false;
|
||||
if (!has_object)
|
||||
return true;
|
||||
ScopedVector<net::UploadElement> elements;
|
||||
net::UploadData::ElementsVector elements;
|
||||
if (!ReadParam(m, iter, &elements))
|
||||
return false;
|
||||
int64_t identifier;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "cef/libcef/common/net/upload_data.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
|
||||
namespace net {
|
||||
|
||||
@ -17,7 +18,7 @@ UploadData::UploadData()
|
||||
void UploadData::AppendBytes(const char* bytes, int bytes_len) {
|
||||
DCHECK(!is_chunked_);
|
||||
if (bytes_len > 0) {
|
||||
elements_.push_back(new UploadElement());
|
||||
elements_.push_back(base::MakeUnique<UploadElement>());
|
||||
elements_.back()->SetToBytes(bytes, bytes_len);
|
||||
}
|
||||
}
|
||||
@ -26,7 +27,7 @@ void UploadData::AppendFileRange(const base::FilePath& file_path,
|
||||
uint64_t offset, uint64_t length,
|
||||
const base::Time& expected_modification_time) {
|
||||
DCHECK(!is_chunked_);
|
||||
elements_.push_back(new UploadElement());
|
||||
elements_.push_back(base::MakeUnique<UploadElement>());
|
||||
elements_.back()->SetToFilePathRange(file_path, offset, length,
|
||||
expected_modification_time);
|
||||
}
|
||||
|
@ -7,10 +7,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/common/net/upload_element.h"
|
||||
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_vector.h"
|
||||
#include "base/supports_user_data.h"
|
||||
#include "net/base/net_export.h"
|
||||
|
||||
@ -49,15 +51,17 @@ class UploadData
|
||||
void set_last_chunk_appended(bool set) { last_chunk_appended_ = set; }
|
||||
bool last_chunk_appended() const { return last_chunk_appended_; }
|
||||
|
||||
const ScopedVector<UploadElement>& elements() const {
|
||||
using ElementsVector = std::vector<std::unique_ptr<UploadElement>>;
|
||||
|
||||
const ElementsVector& elements() const {
|
||||
return elements_;
|
||||
}
|
||||
|
||||
ScopedVector<UploadElement>* elements_mutable() {
|
||||
ElementsVector* elements_mutable() {
|
||||
return &elements_;
|
||||
}
|
||||
|
||||
void swap_elements(ScopedVector<UploadElement>* elements) {
|
||||
void swap_elements(ElementsVector* elements) {
|
||||
elements_.swap(*elements);
|
||||
}
|
||||
|
||||
@ -72,7 +76,7 @@ class UploadData
|
||||
|
||||
~UploadData() override;
|
||||
|
||||
ScopedVector<UploadElement> elements_;
|
||||
ElementsVector elements_;
|
||||
int64_t identifier_;
|
||||
bool is_chunked_;
|
||||
bool last_chunk_appended_;
|
||||
|
@ -99,20 +99,20 @@ net::URLRequest::ReferrerPolicy GetURLRequestReferrerPolicy(
|
||||
net::URLRequest::ReferrerPolicy net_referrer_policy =
|
||||
net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
|
||||
switch (static_cast<blink::WebReferrerPolicy>(policy)) {
|
||||
case blink::WebReferrerPolicyAlways:
|
||||
case blink::WebReferrerPolicyNever:
|
||||
case blink::WebReferrerPolicyOrigin:
|
||||
case blink::kWebReferrerPolicyAlways:
|
||||
case blink::kWebReferrerPolicyNever:
|
||||
case blink::kWebReferrerPolicyOrigin:
|
||||
net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
|
||||
break;
|
||||
case blink::WebReferrerPolicyNoReferrerWhenDowngrade:
|
||||
case blink::kWebReferrerPolicyNoReferrerWhenDowngrade:
|
||||
net_referrer_policy =
|
||||
net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
|
||||
break;
|
||||
case blink::WebReferrerPolicyOriginWhenCrossOrigin:
|
||||
case blink::kWebReferrerPolicyOriginWhenCrossOrigin:
|
||||
net_referrer_policy =
|
||||
net::URLRequest::ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN;
|
||||
break;
|
||||
case blink::WebReferrerPolicyDefault:
|
||||
case blink::kWebReferrerPolicyDefault:
|
||||
default:
|
||||
net_referrer_policy =
|
||||
command_line->HasSwitch(switches::kReducedReferrerGranularity)
|
||||
@ -138,9 +138,9 @@ std::string GetURLRequestReferrer(const GURL& referrer_url) {
|
||||
blink::WebString FilePathStringToWebString(
|
||||
const base::FilePath::StringType& str) {
|
||||
#if defined(OS_POSIX)
|
||||
return blink::WebString::fromUTF8(str);
|
||||
return blink::WebString::FromUTF8(str);
|
||||
#elif defined(OS_WIN)
|
||||
return blink::WebString::fromUTF16(str);
|
||||
return blink::WebString::FromUTF16(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -176,10 +176,10 @@ void GetHeaderMap(const blink::WebURLRequest& request,
|
||||
referrer_(referrer) {
|
||||
}
|
||||
|
||||
void visitHeader(const blink::WebString& name,
|
||||
void VisitHeader(const blink::WebString& name,
|
||||
const blink::WebString& value) override {
|
||||
const base::string16& nameStr = name.utf16();
|
||||
const base::string16& valueStr = value.utf16();
|
||||
const base::string16& nameStr = name.Utf16();
|
||||
const base::string16& valueStr = value.Utf16();
|
||||
if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase))
|
||||
*referrer_ = GURL(valueStr);
|
||||
else
|
||||
@ -192,7 +192,7 @@ void GetHeaderMap(const blink::WebURLRequest& request,
|
||||
};
|
||||
|
||||
HeaderVisitor visitor(&map, &referrer);
|
||||
request.visitHTTPHeaderFields(&visitor);
|
||||
request.VisitHTTPHeaderFields(&visitor);
|
||||
}
|
||||
|
||||
// Read |source| into |map|.
|
||||
@ -215,8 +215,8 @@ void SetHeaderMap(const CefRequest::HeaderMap& map,
|
||||
blink::WebURLRequest& request) {
|
||||
CefRequest::HeaderMap::const_iterator it = map.begin();
|
||||
for (; it != map.end(); ++it) {
|
||||
request.setHTTPHeaderField(blink::WebString::fromUTF16(it->first),
|
||||
blink::WebString::fromUTF16(it->second));
|
||||
request.SetHTTPHeaderField(blink::WebString::FromUTF16(it->first),
|
||||
blink::WebString::FromUTF16(it->second));
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,8 +494,8 @@ void CefRequestImpl::Get(net::URLRequest* request, bool changed_only) const {
|
||||
|
||||
if (ShouldSet(kChangedPostData, changed_only)) {
|
||||
if (postdata_.get()) {
|
||||
request->set_upload(base::WrapUnique(
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Get()));
|
||||
request->set_upload(
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Get());
|
||||
} else if (request->get_upload()) {
|
||||
request->set_upload(std::unique_ptr<net::UploadDataStream>());
|
||||
}
|
||||
@ -530,33 +530,33 @@ void CefRequestImpl::Set(
|
||||
}
|
||||
|
||||
void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
||||
DCHECK(!request.isNull());
|
||||
DCHECK(!request.IsNull());
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
Reset();
|
||||
|
||||
url_ = request.url();
|
||||
method_ = request.httpMethod().utf8();
|
||||
url_ = request.Url();
|
||||
method_ = request.HttpMethod().Utf8();
|
||||
|
||||
::GetHeaderMap(request, headermap_, referrer_url_);
|
||||
referrer_policy_ =
|
||||
static_cast<cef_referrer_policy_t>(request.getReferrerPolicy());
|
||||
static_cast<cef_referrer_policy_t>(request.GetReferrerPolicy());
|
||||
|
||||
const blink::WebHTTPBody& body = request.httpBody();
|
||||
if (!body.isNull()) {
|
||||
const blink::WebHTTPBody& body = request.HttpBody();
|
||||
if (!body.IsNull()) {
|
||||
postdata_ = new CefPostDataImpl();
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
|
||||
}
|
||||
|
||||
first_party_for_cookies_ = request.firstPartyForCookies();
|
||||
first_party_for_cookies_ = request.FirstPartyForCookies();
|
||||
|
||||
if (request.getCachePolicy() == blink::WebCachePolicy::BypassingCache)
|
||||
if (request.GetCachePolicy() == blink::WebCachePolicy::kBypassingCache)
|
||||
flags_ |= UR_FLAG_SKIP_CACHE;
|
||||
if (request.allowStoredCredentials())
|
||||
if (request.AllowStoredCredentials())
|
||||
flags_ |= UR_FLAG_ALLOW_CACHED_CREDENTIALS;
|
||||
if (request.reportUploadProgress())
|
||||
if (request.ReportUploadProgress())
|
||||
flags_ |= UR_FLAG_REPORT_UPLOAD_PROGRESS;
|
||||
}
|
||||
|
||||
@ -564,18 +564,18 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
int64& upload_data_size) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
request.setRequestContext(blink::WebURLRequest::RequestContextInternal);
|
||||
request.setURL(url_);
|
||||
request.setHTTPMethod(blink::WebString::fromUTF8(method_));
|
||||
request.SetRequestContext(blink::WebURLRequest::kRequestContextInternal);
|
||||
request.SetURL(url_);
|
||||
request.SetHTTPMethod(blink::WebString::FromUTF8(method_));
|
||||
|
||||
if (!referrer_url_.is_empty()) {
|
||||
const blink::WebString& referrer =
|
||||
blink::WebSecurityPolicy::generateReferrerHeader(
|
||||
blink::WebSecurityPolicy::GenerateReferrerHeader(
|
||||
static_cast<blink::WebReferrerPolicy>(referrer_policy_),
|
||||
url_,
|
||||
blink::WebString::fromUTF8(referrer_url_.spec()));
|
||||
if (!referrer.isEmpty()) {
|
||||
request.setHTTPReferrer(
|
||||
blink::WebString::FromUTF8(referrer_url_.spec()));
|
||||
if (!referrer.IsEmpty()) {
|
||||
request.SetHTTPReferrer(
|
||||
referrer,
|
||||
static_cast<blink::WebReferrerPolicy>(referrer_policy_));
|
||||
}
|
||||
@ -583,9 +583,9 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
|
||||
if (postdata_.get()) {
|
||||
blink::WebHTTPBody body;
|
||||
body.initialize();
|
||||
body.Initialize();
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Get(body);
|
||||
request.setHTTPBody(body);
|
||||
request.SetHTTPBody(body);
|
||||
|
||||
if (flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) {
|
||||
// Attempt to determine the upload data size.
|
||||
@ -602,33 +602,33 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
::SetHeaderMap(headermap_, request);
|
||||
|
||||
if (!first_party_for_cookies_.is_empty())
|
||||
request.setFirstPartyForCookies(first_party_for_cookies_);
|
||||
request.SetFirstPartyForCookies(first_party_for_cookies_);
|
||||
|
||||
request.setCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::BypassingCache :
|
||||
blink::WebCachePolicy::UseProtocolCachePolicy);
|
||||
request.SetCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::kBypassingCache :
|
||||
blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
|
||||
SETBOOLFLAG(request, flags_, setAllowStoredCredentials,
|
||||
SETBOOLFLAG(request, flags_, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_CACHED_CREDENTIALS);
|
||||
SETBOOLFLAG(request, flags_, setReportUploadProgress,
|
||||
SETBOOLFLAG(request, flags_, SetReportUploadProgress,
|
||||
UR_FLAG_REPORT_UPLOAD_PROGRESS);
|
||||
}
|
||||
|
||||
// static
|
||||
void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
blink::WebURLRequest& request) {
|
||||
request.setURL(params.url);
|
||||
request.SetURL(params.url);
|
||||
if (!params.method.empty())
|
||||
request.setHTTPMethod(blink::WebString::fromASCII(params.method));
|
||||
request.SetHTTPMethod(blink::WebString::FromASCII(params.method));
|
||||
|
||||
if (params.referrer.is_valid()) {
|
||||
const blink::WebString& referrer =
|
||||
blink::WebSecurityPolicy::generateReferrerHeader(
|
||||
blink::WebSecurityPolicy::GenerateReferrerHeader(
|
||||
static_cast<blink::WebReferrerPolicy>(params.referrer_policy),
|
||||
params.url,
|
||||
blink::WebString::fromUTF8(params.referrer.spec()));
|
||||
if (!referrer.isEmpty()) {
|
||||
request.setHTTPReferrer(
|
||||
blink::WebString::FromUTF8(params.referrer.spec()));
|
||||
if (!referrer.IsEmpty()) {
|
||||
request.SetHTTPReferrer(
|
||||
referrer,
|
||||
static_cast<blink::WebReferrerPolicy>(params.referrer_policy));
|
||||
}
|
||||
@ -638,59 +638,54 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
for (net::HttpUtil::HeadersIterator i(params.headers.begin(),
|
||||
params.headers.end(), "\n");
|
||||
i.GetNext(); ) {
|
||||
request.addHTTPHeaderField(blink::WebString::fromUTF8(i.name()),
|
||||
blink::WebString::fromUTF8(i.values()));
|
||||
request.AddHTTPHeaderField(blink::WebString::FromUTF8(i.name()),
|
||||
blink::WebString::FromUTF8(i.values()));
|
||||
}
|
||||
}
|
||||
|
||||
if (params.upload_data.get()) {
|
||||
const base::string16& method = request.httpMethod().utf16();
|
||||
const base::string16& method = request.HttpMethod().Utf16();
|
||||
if (method == base::ASCIIToUTF16("GET") ||
|
||||
method == base::ASCIIToUTF16("HEAD")) {
|
||||
request.setHTTPMethod(blink::WebString::fromASCII("POST"));
|
||||
request.SetHTTPMethod(blink::WebString::FromASCII("POST"));
|
||||
}
|
||||
|
||||
// The comparison performed by httpHeaderField() is case insensitive.
|
||||
if (request.httpHeaderField(blink::WebString::fromASCII(
|
||||
if (request.HttpHeaderField(blink::WebString::FromASCII(
|
||||
net::HttpRequestHeaders::kContentType)).length()== 0) {
|
||||
request.setHTTPHeaderField(
|
||||
blink::WebString::fromASCII(net::HttpRequestHeaders::kContentType),
|
||||
blink::WebString::fromASCII(kApplicationFormURLEncoded));
|
||||
request.SetHTTPHeaderField(
|
||||
blink::WebString::FromASCII(net::HttpRequestHeaders::kContentType),
|
||||
blink::WebString::FromASCII(kApplicationFormURLEncoded));
|
||||
}
|
||||
|
||||
blink::WebHTTPBody body;
|
||||
body.initialize();
|
||||
body.Initialize();
|
||||
|
||||
const ScopedVector<net::UploadElement>& elements =
|
||||
params.upload_data->elements();
|
||||
ScopedVector<net::UploadElement>::const_iterator it =
|
||||
elements.begin();
|
||||
for (; it != elements.end(); ++it) {
|
||||
const net::UploadElement& element = **it;
|
||||
if (element.type() == net::UploadElement::TYPE_BYTES) {
|
||||
for (const auto& element : params.upload_data->elements()) {
|
||||
if (element->type() == net::UploadElement::TYPE_BYTES) {
|
||||
blink::WebData data;
|
||||
data.assign(element.bytes(), element.bytes_length());
|
||||
body.appendData(data);
|
||||
} else if (element.type() == net::UploadElement::TYPE_FILE) {
|
||||
body.appendFile(FilePathStringToWebString(element.file_path().value()));
|
||||
data.Assign(element->bytes(), element->bytes_length());
|
||||
body.AppendData(data);
|
||||
} else if (element->type() == net::UploadElement::TYPE_FILE) {
|
||||
body.AppendFile(FilePathStringToWebString(element->file_path().value()));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
request.setHTTPBody(body);
|
||||
request.SetHTTPBody(body);
|
||||
}
|
||||
|
||||
if (params.first_party_for_cookies.is_valid())
|
||||
request.setFirstPartyForCookies(params.first_party_for_cookies);
|
||||
request.SetFirstPartyForCookies(params.first_party_for_cookies);
|
||||
|
||||
request.setCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::BypassingCache :
|
||||
blink::WebCachePolicy::UseProtocolCachePolicy);
|
||||
request.SetCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE) ?
|
||||
blink::WebCachePolicy::kBypassingCache :
|
||||
blink::WebCachePolicy::kUseProtocolCachePolicy);
|
||||
|
||||
SETBOOLFLAG(request, params.load_flags, setAllowStoredCredentials,
|
||||
SETBOOLFLAG(request, params.load_flags, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_CACHED_CREDENTIALS);
|
||||
SETBOOLFLAG(request, params.load_flags, setReportUploadProgress,
|
||||
SETBOOLFLAG(request, params.load_flags, SetReportUploadProgress,
|
||||
UR_FLAG_REPORT_UPLOAD_PROGRESS);
|
||||
}
|
||||
|
||||
@ -984,11 +979,9 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
|
||||
const ScopedVector<net::UploadElement>& elements = data.elements();
|
||||
ScopedVector<net::UploadElement>::const_iterator it = elements.begin();
|
||||
for (; it != elements.end(); ++it) {
|
||||
for (const auto& element : data.elements()) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(**it);
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(*element);
|
||||
AddElement(postelem);
|
||||
}
|
||||
}
|
||||
@ -1018,27 +1011,28 @@ void CefPostDataImpl::Set(const net::UploadDataStream& data_stream) {
|
||||
void CefPostDataImpl::Get(net::UploadData& data) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
ScopedVector<net::UploadElement> data_elements;
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
net::UploadElement* element = new net::UploadElement();
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get(*element);
|
||||
data_elements.push_back(element);
|
||||
net::UploadData::ElementsVector data_elements;
|
||||
for (const auto& element : elements_) {
|
||||
std::unique_ptr<net::UploadElement> data_element =
|
||||
base::MakeUnique<net::UploadElement>();
|
||||
static_cast<CefPostDataElementImpl*>(element.get())->Get(
|
||||
*data_element.get());
|
||||
data_elements.push_back(std::move(data_element));
|
||||
}
|
||||
data.swap_elements(&data_elements);
|
||||
}
|
||||
|
||||
net::UploadDataStream* CefPostDataImpl::Get() const {
|
||||
std::unique_ptr<net::UploadDataStream> CefPostDataImpl::Get() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
UploadElementReaders element_readers;
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
element_readers.push_back(base::WrapUnique(
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get()));
|
||||
for (const auto& element : elements_) {
|
||||
element_readers.push_back(
|
||||
static_cast<CefPostDataElementImpl*>(element.get())->Get());
|
||||
}
|
||||
|
||||
return new net::ElementsUploadDataStream(std::move(element_readers), 0);
|
||||
return base::MakeUnique<net::ElementsUploadDataStream>(
|
||||
std::move(element_readers), 0);
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const blink::WebHTTPBody& data) {
|
||||
@ -1049,9 +1043,9 @@ void CefPostDataImpl::Set(const blink::WebHTTPBody& data) {
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
blink::WebHTTPBody::Element element;
|
||||
size_t size = data.elementCount();
|
||||
size_t size = data.ElementCount();
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (data.elementAt(i, element)) {
|
||||
if (data.ElementAt(i, element)) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(element);
|
||||
AddElement(postelem);
|
||||
@ -1066,10 +1060,10 @@ void CefPostDataImpl::Get(blink::WebHTTPBody& data) const {
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
|
||||
if (element.type == blink::WebHTTPBody::Element::TypeData) {
|
||||
data.appendData(element.data);
|
||||
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
|
||||
data.appendFile(element.filePath);
|
||||
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
|
||||
data.AppendData(element.data);
|
||||
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
|
||||
data.AppendFile(element.file_path);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
@ -1284,22 +1278,22 @@ void CefPostDataElementImpl::Get(net::UploadElement& element) const {
|
||||
}
|
||||
}
|
||||
|
||||
net::UploadElementReader* CefPostDataElementImpl::Get() const {
|
||||
std::unique_ptr<net::UploadElementReader> CefPostDataElementImpl::Get() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (type_ == PDE_TYPE_BYTES) {
|
||||
net::UploadElement* element = new net::UploadElement();
|
||||
element->SetToBytes(static_cast<char*>(data_.bytes.bytes),
|
||||
data_.bytes.size);
|
||||
return new BytesElementReader(base::WrapUnique(element));
|
||||
return base::MakeUnique<BytesElementReader>(base::WrapUnique(element));
|
||||
} else if (type_ == PDE_TYPE_FILE) {
|
||||
net::UploadElement* element = new net::UploadElement();
|
||||
base::FilePath path = base::FilePath(CefString(&data_.filename));
|
||||
element->SetToFilePath(path);
|
||||
return new FileElementReader(base::WrapUnique(element));
|
||||
return base::MakeUnique<FileElementReader>(base::WrapUnique(element));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1309,11 +1303,11 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
}
|
||||
|
||||
if (element.type == blink::WebHTTPBody::Element::TypeData) {
|
||||
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
|
||||
SetToBytes(element.data.size(),
|
||||
static_cast<const void*>(element.data.data()));
|
||||
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
|
||||
SetToFile(element.filePath.utf16());
|
||||
static_cast<const void*>(element.data.Data()));
|
||||
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
|
||||
SetToFile(element.file_path.Utf16());
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
@ -1323,13 +1317,13 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (type_ == PDE_TYPE_BYTES) {
|
||||
element.type = blink::WebHTTPBody::Element::TypeData;
|
||||
element.data.assign(
|
||||
element.type = blink::WebHTTPBody::Element::kTypeData;
|
||||
element.data.Assign(
|
||||
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||
} else if (type_ == PDE_TYPE_FILE) {
|
||||
element.type = blink::WebHTTPBody::Element::TypeFile;
|
||||
element.filePath.assign(
|
||||
blink::WebString::fromUTF16(CefString(&data_.filename)));
|
||||
element.type = blink::WebHTTPBody::Element::kTypeFile;
|
||||
element.file_path.Assign(
|
||||
blink::WebString::FromUTF16(CefString(&data_.filename)));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "include/cef_request.h"
|
||||
|
||||
#include "base/synchronization/lock.h"
|
||||
@ -166,7 +168,7 @@ class CefPostDataImpl : public CefPostData {
|
||||
void Set(const net::UploadData& data);
|
||||
void Set(const net::UploadDataStream& data_stream);
|
||||
void Get(net::UploadData& data) const;
|
||||
net::UploadDataStream* Get() const;
|
||||
std::unique_ptr<net::UploadDataStream> Get() const;
|
||||
void Set(const blink::WebHTTPBody& data);
|
||||
void Get(blink::WebHTTPBody& data) const;
|
||||
|
||||
@ -217,7 +219,7 @@ class CefPostDataElementImpl : public CefPostDataElement {
|
||||
void Set(const net::UploadElement& element);
|
||||
void Set(const net::UploadElementReader& element_reader);
|
||||
void Get(net::UploadElement& element) const;
|
||||
net::UploadElementReader* Get() const;
|
||||
std::unique_ptr<net::UploadElementReader> Get() const;
|
||||
void Set(const blink::WebHTTPBody::Element& element);
|
||||
void Get(blink::WebHTTPBody::Element& element) const;
|
||||
|
||||
|
@ -185,25 +185,25 @@ void CefResponseImpl::SetResponseHeaders(
|
||||
}
|
||||
|
||||
void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
||||
DCHECK(!response.isNull());
|
||||
DCHECK(!response.IsNull());
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
blink::WebString str;
|
||||
status_code_ = response.httpStatusCode();
|
||||
str = response.httpStatusText();
|
||||
status_text_ = str.utf16();
|
||||
str = response.mimeType();
|
||||
mime_type_ = str.utf16();
|
||||
status_code_ = response.HttpStatusCode();
|
||||
str = response.HttpStatusText();
|
||||
status_text_ = str.Utf16();
|
||||
str = response.MimeType();
|
||||
mime_type_ = str.Utf16();
|
||||
|
||||
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
|
||||
public:
|
||||
explicit HeaderVisitor(HeaderMap* map) : map_(map) {}
|
||||
|
||||
void visitHeader(const blink::WebString& name,
|
||||
void VisitHeader(const blink::WebString& name,
|
||||
const blink::WebString& value) override {
|
||||
map_->insert(std::make_pair(name.utf16(), value.utf16()));
|
||||
map_->insert(std::make_pair(name.Utf16(), value.Utf16()));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -211,7 +211,7 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
||||
};
|
||||
|
||||
HeaderVisitor visitor(&header_map_);
|
||||
response.visitHTTPHeaderFields(&visitor);
|
||||
response.VisitHTTPHeaderFields(&visitor);
|
||||
}
|
||||
|
||||
void CefResponseImpl::Set(const net::URLRequest* request) {
|
||||
|
@ -199,3 +199,40 @@ void CefValueController::TakeFrom(CefValueController* other) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefValueController::Swap(void* old_value, void* new_value) {
|
||||
DCHECK(old_value && new_value && old_value != new_value);
|
||||
|
||||
// Controller should already be locked.
|
||||
DCHECK(locked());
|
||||
|
||||
if (owner_value_ == old_value)
|
||||
owner_value_ = new_value;
|
||||
|
||||
if (!reference_map_.empty()) {
|
||||
ReferenceMap::iterator it = reference_map_.find(old_value);
|
||||
if (it != reference_map_.end()) {
|
||||
// References should only be added once.
|
||||
DCHECK(reference_map_.find(new_value) == reference_map_.end());
|
||||
reference_map_.insert(std::make_pair(new_value, it->second));
|
||||
reference_map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dependency_map_.empty()) {
|
||||
DependencyMap::iterator it = dependency_map_.find(old_value);
|
||||
if (it != dependency_map_.end()) {
|
||||
dependency_map_.insert(std::make_pair(new_value, it->second));
|
||||
dependency_map_.erase(it);
|
||||
}
|
||||
|
||||
it = dependency_map_.begin();
|
||||
for (; it != dependency_map_.end(); ++it) {
|
||||
DependencySet::iterator dit = it->second.find(old_value);
|
||||
if (dit != it->second.end()) {
|
||||
it->second.insert(new_value);
|
||||
it->second.erase(dit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,11 @@ class CefValueController
|
||||
// |other|. The |other| controller must already be locked.
|
||||
void TakeFrom(CefValueController* other);
|
||||
|
||||
// Replace all instances of |old_value| with |new_value|. Used in cases where
|
||||
// move semantics may move the contents of an object without retaining the
|
||||
// object pointer itself.
|
||||
void Swap(void* old_value, void* new_value);
|
||||
|
||||
protected:
|
||||
friend class base::RefCountedThreadSafe<CefValueController>;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
// static
|
||||
CefRefPtr<CefValue> CefValue::Create() {
|
||||
return new CefValueImpl(base::Value::CreateNullValue().release());
|
||||
return new CefValueImpl(new base::Value());
|
||||
}
|
||||
|
||||
// static
|
||||
@ -25,9 +25,8 @@ CefRefPtr<CefValue> CefValueImpl::GetOrCreateRefOrCopy(
|
||||
DCHECK(value);
|
||||
|
||||
if (value->IsType(base::Value::Type::BINARY)) {
|
||||
base::BinaryValue* binary_value = static_cast<base::BinaryValue*>(value);
|
||||
return new CefValueImpl(CefBinaryValueImpl::GetOrCreateRef(
|
||||
binary_value, parent_value, controller));
|
||||
value, parent_value, controller));
|
||||
}
|
||||
|
||||
if (value->IsType(base::Value::Type::DICTIONARY)) {
|
||||
@ -73,42 +72,48 @@ void CefValueImpl::SetValue(base::Value* value) {
|
||||
SetValueInternal(value);
|
||||
}
|
||||
|
||||
base::Value* CefValueImpl::CopyOrTransferValue(
|
||||
void* new_parent_value,
|
||||
bool new_read_only,
|
||||
base::Value* CefValueImpl::CopyOrDetachValue(
|
||||
CefValueController* new_controller) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (binary_value_) {
|
||||
base::BinaryValue* value =
|
||||
static_cast<CefBinaryValueImpl*>(binary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
binary_value_ = CefBinaryValueImpl::GetOrCreateRef(
|
||||
value, new_parent_value, new_controller);
|
||||
return value;
|
||||
return static_cast<CefBinaryValueImpl*>(binary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
if (dictionary_value_) {
|
||||
base::DictionaryValue* value =
|
||||
static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
dictionary_value_ = CefDictionaryValueImpl::GetOrCreateRef(
|
||||
value, new_parent_value, new_read_only, new_controller);
|
||||
return value;
|
||||
return static_cast<CefDictionaryValueImpl*>(dictionary_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
if (list_value_) {
|
||||
base::ListValue* value =
|
||||
static_cast<CefListValueImpl*>(list_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
list_value_ = CefListValueImpl::GetOrCreateRef(
|
||||
value, new_parent_value, new_read_only, new_controller);
|
||||
return value;
|
||||
return static_cast<CefListValueImpl*>(list_value_.get())->
|
||||
CopyOrDetachValue(new_controller);
|
||||
}
|
||||
|
||||
return value_->DeepCopy();
|
||||
}
|
||||
|
||||
void CefValueImpl::SwapValue(
|
||||
base::Value* new_value,
|
||||
void* new_parent_value,
|
||||
CefValueController* new_controller) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (binary_value_) {
|
||||
binary_value_ = CefBinaryValueImpl::GetOrCreateRef(
|
||||
new_value, new_parent_value, new_controller);
|
||||
} else if (dictionary_value_) {
|
||||
dictionary_value_ = CefDictionaryValueImpl::GetOrCreateRef(
|
||||
static_cast<base::DictionaryValue*>(new_value), new_parent_value,
|
||||
false, new_controller);
|
||||
} else if (list_value_) {
|
||||
list_value_ = CefListValueImpl::GetOrCreateRef(
|
||||
static_cast<base::ListValue*>(new_value), new_parent_value,
|
||||
false, new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
bool CefValueImpl::IsValid() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
@ -292,7 +297,7 @@ CefRefPtr<CefListValue> CefValueImpl::GetList() {
|
||||
}
|
||||
|
||||
bool CefValueImpl::SetNull() {
|
||||
SetValue(base::Value::CreateNullValue().release());
|
||||
SetValue(new base::Value());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -312,7 +317,7 @@ bool CefValueImpl::SetDouble(double value) {
|
||||
}
|
||||
|
||||
bool CefValueImpl::SetString(const CefString& value) {
|
||||
SetValue(new base::StringValue(value.ToString()));
|
||||
SetValue(new base::Value(value.ToString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -348,8 +353,7 @@ void CefValueImpl::SetValueInternal(base::Value* value) {
|
||||
if (value) {
|
||||
switch (value->GetType()) {
|
||||
case base::Value::Type::BINARY:
|
||||
binary_value_ = new CefBinaryValueImpl(
|
||||
static_cast<base::BinaryValue*>(value), true);
|
||||
binary_value_ = new CefBinaryValueImpl(value, true);
|
||||
return;
|
||||
case base::Value::Type::DICTIONARY:
|
||||
dictionary_value_ = new CefDictionaryValueImpl(
|
||||
@ -430,7 +434,7 @@ CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBinaryValue> CefBinaryValueImpl::GetOrCreateRef(
|
||||
base::BinaryValue* value,
|
||||
base::Value* value,
|
||||
void* parent_value,
|
||||
CefValueController* controller) {
|
||||
DCHECK(value);
|
||||
@ -445,28 +449,28 @@ CefRefPtr<CefBinaryValue> CefBinaryValueImpl::GetOrCreateRef(
|
||||
CefBinaryValueImpl::kReference, controller);
|
||||
}
|
||||
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value,
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value,
|
||||
bool will_delete)
|
||||
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
||||
true, NULL) {
|
||||
}
|
||||
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(char* data,
|
||||
size_t data_size)
|
||||
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
||||
new base::BinaryValue(std::vector<char>(data, data + data_size)),
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
new base::Value(std::vector<char>(data, data + data_size)),
|
||||
NULL, kOwnerWillDelete, true, NULL) {
|
||||
}
|
||||
|
||||
base::BinaryValue* CefBinaryValueImpl::CopyValue() {
|
||||
base::Value* CefBinaryValueImpl::CopyValue() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
return const_value().DeepCopy();
|
||||
}
|
||||
|
||||
base::BinaryValue* CefBinaryValueImpl::CopyOrDetachValue(
|
||||
base::Value* CefBinaryValueImpl::CopyOrDetachValue(
|
||||
CefValueController* new_controller) {
|
||||
base::BinaryValue* new_value;
|
||||
base::Value* new_value;
|
||||
|
||||
if (!will_delete()) {
|
||||
// Copy the value.
|
||||
@ -480,21 +484,21 @@ base::BinaryValue* CefBinaryValueImpl::CopyOrDetachValue(
|
||||
return new_value;
|
||||
}
|
||||
|
||||
bool CefBinaryValueImpl::IsSameValue(const base::BinaryValue* that) {
|
||||
bool CefBinaryValueImpl::IsSameValue(const base::Value* that) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return (&const_value() == that);
|
||||
}
|
||||
|
||||
bool CefBinaryValueImpl::IsEqualValue(const base::BinaryValue* that) {
|
||||
bool CefBinaryValueImpl::IsEqualValue(const base::Value* that) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
return const_value().Equals(that);
|
||||
}
|
||||
|
||||
base::BinaryValue* CefBinaryValueImpl::GetValueUnsafe() {
|
||||
base::Value* CefBinaryValueImpl::GetValueUnsafe() {
|
||||
if (!VerifyAttached())
|
||||
return NULL;
|
||||
controller()->AssertLockAcquired();
|
||||
return const_cast<base::BinaryValue*>(&const_value());
|
||||
return const_cast<base::Value*>(&const_value());
|
||||
}
|
||||
|
||||
bool CefBinaryValueImpl::IsValid() {
|
||||
@ -559,11 +563,11 @@ size_t CefBinaryValueImpl::GetData(void* buffer,
|
||||
return size;
|
||||
}
|
||||
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value,
|
||||
CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
CefValueController* controller)
|
||||
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
||||
: CefValueBase<CefBinaryValue, base::Value>(
|
||||
value, parent_value, value_mode, true, controller) {
|
||||
}
|
||||
|
||||
@ -823,8 +827,7 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
|
||||
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
|
||||
&out_value) &&
|
||||
out_value->IsType(base::Value::Type::BINARY)) {
|
||||
base::BinaryValue* binary_value =
|
||||
static_cast<base::BinaryValue*>(const_cast<base::Value*>(out_value));
|
||||
base::Value* binary_value = const_cast<base::Value*>(out_value);
|
||||
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()), controller());
|
||||
}
|
||||
@ -881,15 +884,15 @@ bool CefDictionaryValueImpl::SetValue(const CefString& key,
|
||||
CefValueImpl* impl = static_cast<CefValueImpl*>(value.get());
|
||||
DCHECK(impl);
|
||||
|
||||
base::Value* new_value =
|
||||
impl->CopyOrTransferValue(mutable_value(), false, controller());
|
||||
SetInternal(key, new_value);
|
||||
base::Value* new_value = impl->CopyOrDetachValue(controller());
|
||||
base::Value* actual_value = SetInternal(key, new_value);
|
||||
impl->SwapValue(actual_value, mutable_value(), controller());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefDictionaryValueImpl::SetNull(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
SetInternal(key, base::Value::CreateNullValue().release());
|
||||
SetInternal(key, new base::Value());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -914,7 +917,7 @@ bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
|
||||
bool CefDictionaryValueImpl::SetString(const CefString& key,
|
||||
const CefString& value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
SetInternal(key, new base::StringValue(value.ToString()));
|
||||
SetInternal(key, new base::Value(value.ToString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -971,11 +974,12 @@ bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDictionaryValueImpl::SetInternal(const CefString& key,
|
||||
base::Value* value) {
|
||||
base::Value* CefDictionaryValueImpl::SetInternal(const CefString& key,
|
||||
base::Value* value) {
|
||||
DCHECK(value);
|
||||
RemoveInternal(key);
|
||||
mutable_value()->SetWithoutPathExpansion(base::StringPiece(key), value);
|
||||
return value;
|
||||
}
|
||||
|
||||
CefDictionaryValueImpl::CefDictionaryValueImpl(
|
||||
@ -1107,7 +1111,7 @@ bool CefListValueImpl::SetSize(size_t size) {
|
||||
RemoveInternal(i);
|
||||
} else if (size > 0) {
|
||||
// Expand the list size.
|
||||
mutable_value()->Set(size-1, base::Value::CreateNullValue());
|
||||
mutable_value()->Set(size-1, base::MakeUnique<base::Value>());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1230,8 +1234,7 @@ CefRefPtr<CefBinaryValue> CefListValueImpl::GetBinary(size_t index) {
|
||||
|
||||
if (const_value().Get(index, &out_value) &&
|
||||
out_value->IsType(base::Value::Type::BINARY)) {
|
||||
base::BinaryValue* binary_value =
|
||||
static_cast<base::BinaryValue*>(const_cast<base::Value*>(out_value));
|
||||
base::Value* binary_value = const_cast<base::Value*>(out_value);
|
||||
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
|
||||
const_cast<base::ListValue*>(&const_value()), controller());
|
||||
}
|
||||
@ -1284,15 +1287,15 @@ bool CefListValueImpl::SetValue(size_t index, CefRefPtr<CefValue> value) {
|
||||
CefValueImpl* impl = static_cast<CefValueImpl*>(value.get());
|
||||
DCHECK(impl);
|
||||
|
||||
base::Value* new_value =
|
||||
impl->CopyOrTransferValue(mutable_value(), false, controller());
|
||||
SetInternal(index, new_value);
|
||||
base::Value* new_value = impl->CopyOrDetachValue(controller());
|
||||
base::Value* actual_value = SetInternal(index, new_value);
|
||||
impl->SwapValue(actual_value, mutable_value(), controller());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefListValueImpl::SetNull(size_t index) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
SetInternal(index, base::Value::CreateNullValue().release());
|
||||
SetInternal(index, new base::Value());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1316,7 +1319,7 @@ bool CefListValueImpl::SetDouble(size_t index, double value) {
|
||||
|
||||
bool CefListValueImpl::SetString(size_t index, const CefString& value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
SetInternal(index, new base::StringValue(value.ToString()));
|
||||
SetInternal(index, new base::Value(value.ToString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1353,28 +1356,52 @@ bool CefListValueImpl::SetList(size_t index, CefRefPtr<CefListValue> value) {
|
||||
}
|
||||
|
||||
bool CefListValueImpl::RemoveInternal(size_t index) {
|
||||
// base::Value now uses move semantics which means that Remove() will return
|
||||
// a new base::Value object with the moved contents of the base::Value that
|
||||
// exists in the implementation std::vector. Consequently we use Get() to
|
||||
// retrieve the actual base::Value pointer as it exists in the std::vector.
|
||||
const base::Value* actual_value = nullptr;
|
||||
if (!const_value().Get(index, &actual_value))
|
||||
return false;
|
||||
DCHECK(actual_value);
|
||||
|
||||
std::unique_ptr<base::Value> out_value;
|
||||
if (!mutable_value()->Remove(index, &out_value))
|
||||
return false;
|
||||
|
||||
// Remove the value.
|
||||
controller()->Remove(out_value.get(), true);
|
||||
controller()->Remove(const_cast<base::Value*>(actual_value), true);
|
||||
|
||||
// Only list and dictionary types may have dependencies.
|
||||
if (out_value->IsType(base::Value::Type::LIST) ||
|
||||
out_value->IsType(base::Value::Type::DICTIONARY)) {
|
||||
controller()->RemoveDependencies(out_value.get());
|
||||
controller()->RemoveDependencies(const_cast<base::Value*>(actual_value));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefListValueImpl::SetInternal(size_t index, base::Value* value) {
|
||||
base::Value* CefListValueImpl::SetInternal(size_t index, base::Value* value) {
|
||||
DCHECK(value);
|
||||
|
||||
if (RemoveInternal(index))
|
||||
mutable_value()->Insert(index, base::WrapUnique(value));
|
||||
else
|
||||
mutable_value()->Set(index, value);
|
||||
mutable_value()->Set(index, base::WrapUnique(value));
|
||||
|
||||
// base::Value now uses move semantics which means that Insert()/Set() will
|
||||
// move the contents of the passed-in base::Value instead of keeping the same
|
||||
// object. Consequently we use Get() to retrieve the actual base::Value
|
||||
// pointer as it exists in the std::vector.
|
||||
const base::Value* actual_value = nullptr;
|
||||
const_value().Get(index, &actual_value);
|
||||
DCHECK(actual_value);
|
||||
|
||||
// |value| will have been deleted at this point. Update the controller to
|
||||
// reference |actual_value| instead.
|
||||
controller()->Swap(value, const_cast<base::Value*>(actual_value));
|
||||
|
||||
return const_cast<base::Value*>(actual_value);
|
||||
}
|
||||
|
||||
CefListValueImpl::CefListValueImpl(
|
||||
|
@ -44,10 +44,12 @@ class CefValueImpl : public CefValue {
|
||||
|
||||
// Copy a simple value or transfer ownership of a complex value. If ownership
|
||||
// of the value is tranferred then this object's internal reference to the
|
||||
// value will be updated and remain valid.
|
||||
base::Value* CopyOrTransferValue(void* new_parent_value,
|
||||
bool new_read_only,
|
||||
CefValueController* new_controller);
|
||||
// value will be updated and remain valid. base::Value now uses move semantics
|
||||
// so we need to perform the copy and swap in two steps.
|
||||
base::Value* CopyOrDetachValue(CefValueController* new_controller);
|
||||
void SwapValue(base::Value* new_value,
|
||||
void* new_parent_value,
|
||||
CefValueController* new_controller);
|
||||
|
||||
// Returns a reference to the underlying data. Access must be protected by
|
||||
// calling AcquireLock/ReleaseLock.
|
||||
@ -126,11 +128,11 @@ class CefValueImpl : public CefValue {
|
||||
|
||||
// CefBinaryValue implementation
|
||||
class CefBinaryValueImpl
|
||||
: public CefValueBase<CefBinaryValue, base::BinaryValue> {
|
||||
: public CefValueBase<CefBinaryValue, base::Value> {
|
||||
public:
|
||||
// Get or create a reference value.
|
||||
static CefRefPtr<CefBinaryValue> GetOrCreateRef(
|
||||
base::BinaryValue* value,
|
||||
base::Value* value,
|
||||
void* parent_value,
|
||||
CefValueController* controller);
|
||||
|
||||
@ -140,7 +142,7 @@ class CefBinaryValueImpl
|
||||
// longer valid. Use GetOrCreateRef instead of this constructor if |value| is
|
||||
// owned by some other object and you do not plan to explicitly call
|
||||
// Detach(NULL).
|
||||
CefBinaryValueImpl(base::BinaryValue* value,
|
||||
CefBinaryValueImpl(base::Value* value,
|
||||
bool will_delete);
|
||||
|
||||
// The data will always be copied.
|
||||
@ -148,18 +150,18 @@ class CefBinaryValueImpl
|
||||
size_t data_size);
|
||||
|
||||
// Return a copy of the value.
|
||||
base::BinaryValue* CopyValue();
|
||||
base::Value* CopyValue();
|
||||
|
||||
// If this value is a reference then return a copy. Otherwise, detach and
|
||||
// transfer ownership of the value.
|
||||
base::BinaryValue* CopyOrDetachValue(CefValueController* new_controller);
|
||||
base::Value* CopyOrDetachValue(CefValueController* new_controller);
|
||||
|
||||
bool IsSameValue(const base::BinaryValue* that);
|
||||
bool IsEqualValue(const base::BinaryValue* that);
|
||||
bool IsSameValue(const base::Value* that);
|
||||
bool IsEqualValue(const base::Value* that);
|
||||
|
||||
// Returns the underlying value. Access must be protected by calling
|
||||
// lock/unlock on the controller.
|
||||
base::BinaryValue* GetValueUnsafe();
|
||||
base::Value* GetValueUnsafe();
|
||||
|
||||
// CefBinaryValue methods.
|
||||
bool IsValid() override;
|
||||
@ -175,7 +177,7 @@ class CefBinaryValueImpl
|
||||
private:
|
||||
// See the CefValueBase constructor for usage. Binary values are always
|
||||
// read-only.
|
||||
CefBinaryValueImpl(base::BinaryValue* value,
|
||||
CefBinaryValueImpl(base::Value* value,
|
||||
void* parent_value,
|
||||
ValueMode value_mode,
|
||||
CefValueController* controller);
|
||||
@ -265,7 +267,7 @@ class CefDictionaryValueImpl
|
||||
CefValueController* controller);
|
||||
|
||||
bool RemoveInternal(const CefString& key);
|
||||
void SetInternal(const CefString& key, base::Value* value);
|
||||
base::Value* SetInternal(const CefString& key, base::Value* value);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDictionaryValueImpl);
|
||||
};
|
||||
@ -346,7 +348,7 @@ class CefListValueImpl
|
||||
CefValueController* controller);
|
||||
|
||||
bool RemoveInternal(size_t index);
|
||||
void SetInternal(size_t index, base::Value* value);
|
||||
base::Value* SetInternal(size_t index, base::Value* value);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefListValueImpl);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ class CefWidevineLoader {
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend struct base::DefaultLazyInstanceTraits<CefWidevineLoader>;
|
||||
friend struct base::LazyInstanceTraitsBase<CefWidevineLoader>;
|
||||
|
||||
// Members are only accessed before context initialization or on the UI
|
||||
// thread.
|
||||
|
@ -46,7 +46,6 @@ using blink::WebString;
|
||||
using blink::WebURL;
|
||||
using blink::WebView;
|
||||
|
||||
|
||||
// CefBrowserImpl static methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@ -99,9 +98,9 @@ bool CefBrowserImpl::IsLoading() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
if (render_view()->GetWebView()) {
|
||||
blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
|
||||
blink::WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
|
||||
if (main_frame)
|
||||
return main_frame->toWebLocalFrame()->isLoading();
|
||||
return main_frame->ToWebLocalFrame()->IsLoading();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -109,26 +108,26 @@ bool CefBrowserImpl::IsLoading() {
|
||||
void CefBrowserImpl::Reload() {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
||||
render_view()->GetWebView()->mainFrame()->reload(
|
||||
blink::WebFrameLoadType::Reload);
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) {
|
||||
render_view()->GetWebView()->MainFrame()->Reload(
|
||||
blink::WebFrameLoadType::kReload);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserImpl::ReloadIgnoreCache() {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
||||
render_view()->GetWebView()->mainFrame()->reload(
|
||||
blink::WebFrameLoadType::ReloadBypassingCache);
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) {
|
||||
render_view()->GetWebView()->MainFrame()->Reload(
|
||||
blink::WebFrameLoadType::kReloadBypassingCache);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserImpl::StopLoad() {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||
render_view()->GetWebView()->mainFrame()->stopLoading();
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame())
|
||||
render_view()->GetWebView()->MainFrame()->StopLoading();
|
||||
}
|
||||
|
||||
int CefBrowserImpl::GetIdentifier() {
|
||||
@ -153,16 +152,16 @@ bool CefBrowserImpl::IsPopup() {
|
||||
bool CefBrowserImpl::HasDocument() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||
return !render_view()->GetWebView()->mainFrame()->document().isNull();
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame())
|
||||
return !render_view()->GetWebView()->MainFrame()->GetDocument().IsNull();
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserImpl::GetMainFrame() {
|
||||
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()).get();
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame())
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->MainFrame()).get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -170,8 +169,8 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFocusedFrame() {
|
||||
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||
|
||||
if (render_view()->GetWebView() &&
|
||||
render_view()->GetWebView()->focusedFrame()) {
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->focusedFrame()).get();
|
||||
render_view()->GetWebView()->FocusedFrame()) {
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->FocusedFrame()).get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -187,14 +186,20 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
|
||||
|
||||
blink::WebView* web_view = render_view()->GetWebView();
|
||||
if (web_view) {
|
||||
const blink::WebString& frame_name = blink::WebString::fromUTF16(name);
|
||||
const blink::WebString& frame_name = blink::WebString::FromUTF16(name);
|
||||
// Search by assigned frame name (Frame::name).
|
||||
WebFrame* frame = web_view->findFrameByName(frame_name,
|
||||
web_view->mainFrame());
|
||||
WebFrame* frame = web_view->FindFrameByName(frame_name,
|
||||
web_view->MainFrame());
|
||||
if (!frame) {
|
||||
// Search by unique frame name (Frame::uniqueName).
|
||||
frame = webkit_glue::FindFrameByUniqueName(frame_name,
|
||||
web_view->mainFrame());
|
||||
const std::string& searchname = name;
|
||||
for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame;
|
||||
cur_frame = cur_frame->TraverseNext()) {
|
||||
if (webkit_glue::GetUniqueName(cur_frame) == searchname) {
|
||||
frame = cur_frame;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (frame)
|
||||
return GetWebFrameImpl(frame).get();
|
||||
@ -209,8 +214,8 @@ size_t CefBrowserImpl::GetFrameCount() {
|
||||
int count = 0;
|
||||
|
||||
if (render_view()->GetWebView()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||
frame = frame->traverseNext()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
|
||||
frame = frame->TraverseNext()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -225,8 +230,8 @@ void CefBrowserImpl::GetFrameIdentifiers(std::vector<int64>& identifiers) {
|
||||
identifiers.clear();
|
||||
|
||||
if (render_view()->GetWebView()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||
frame = frame->traverseNext()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
|
||||
frame = frame->TraverseNext()) {
|
||||
identifiers.push_back(webkit_glue::GetIdentifier(frame));
|
||||
}
|
||||
}
|
||||
@ -239,9 +244,9 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
|
||||
names.clear();
|
||||
|
||||
if (render_view()->GetWebView()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||
frame = frame->traverseNext()) {
|
||||
names.push_back(CefString(frame->uniqueName().utf8()));
|
||||
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
|
||||
frame = frame->TraverseNext()) {
|
||||
names.push_back(webkit_glue::GetUniqueName(frame));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -287,7 +292,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
|
||||
blink::WebURLRequest request;
|
||||
CefRequestImpl::Get(params, request);
|
||||
|
||||
web_frame->loadRequest(request);
|
||||
web_frame->LoadRequest(request);
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::SendProcessMessage(CefProcessId target_process,
|
||||
@ -322,10 +327,11 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
||||
CefRefPtr<CefFrameImpl> framePtr(new CefFrameImpl(this, frame));
|
||||
frames_.insert(std::make_pair(frame_id, framePtr));
|
||||
|
||||
int64_t parent_id = frame->parent() == NULL ?
|
||||
const int64_t parent_id = frame->Parent() == NULL ?
|
||||
webkit_glue::kInvalidFrameId :
|
||||
webkit_glue::GetIdentifier(frame->parent());
|
||||
base::string16 name = frame->uniqueName().utf16();
|
||||
webkit_glue::GetIdentifier(frame->Parent());
|
||||
const base::string16& name =
|
||||
base::UTF8ToUTF16(webkit_glue::GetUniqueName(frame));
|
||||
|
||||
// Notify the browser that the frame has been identified.
|
||||
Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name));
|
||||
@ -335,8 +341,8 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
||||
|
||||
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
|
||||
if (frame_id == webkit_glue::kInvalidFrameId) {
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame());
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame())
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->MainFrame());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -347,8 +353,8 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
|
||||
|
||||
if (render_view()->GetWebView()) {
|
||||
// Check if the frame exists but we don't know about it yet.
|
||||
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||
frame = frame->traverseNext()) {
|
||||
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
|
||||
frame = frame->TraverseNext()) {
|
||||
if (webkit_glue::GetIdentifier(frame) == frame_id)
|
||||
return GetWebFrameImpl(frame);
|
||||
}
|
||||
@ -416,12 +422,12 @@ void CefBrowserImpl::DidFailLoad(
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidFinishLoad(blink::WebLocalFrame* frame) {
|
||||
blink::WebDataSource* ds = frame->dataSource();
|
||||
blink::WebDataSource* ds = frame->DataSource();
|
||||
Send(new CefHostMsg_DidFinishLoad(routing_id(),
|
||||
webkit_glue::GetIdentifier(frame),
|
||||
ds->getRequest().url(),
|
||||
!frame->parent(),
|
||||
ds->response().httpStatusCode()));
|
||||
ds->GetRequest().Url(),
|
||||
!frame->Parent(),
|
||||
ds->GetResponse().HttpStatusCode()));
|
||||
OnLoadEnd(frame);
|
||||
}
|
||||
|
||||
@ -468,12 +474,12 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) {
|
||||
CefRefPtr<CefRenderProcessHandler> handler =
|
||||
app->GetRenderProcessHandler();
|
||||
if (handler.get()) {
|
||||
if (node.isNull()) {
|
||||
if (node.IsNull()) {
|
||||
handler->OnFocusedNodeChanged(this, GetFocusedFrame(), NULL);
|
||||
} else {
|
||||
const blink::WebDocument& document = node.document();
|
||||
if (!document.isNull()) {
|
||||
blink::WebFrame* frame = document.frame();
|
||||
const blink::WebDocument& document = node.GetDocument();
|
||||
if (!document.IsNull()) {
|
||||
blink::WebFrame* frame = document.GetFrame();
|
||||
CefRefPtr<CefDOMDocumentImpl> documentImpl =
|
||||
new CefDOMDocumentImpl(this, frame);
|
||||
handler->OnFocusedNodeChanged(this,
|
||||
@ -489,7 +495,7 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) {
|
||||
// Based on ExtensionHelper::DraggableRegionsChanged.
|
||||
void CefBrowserImpl::DraggableRegionsChanged(blink::WebFrame* frame) {
|
||||
blink::WebVector<blink::WebDraggableRegion> webregions =
|
||||
frame->document().draggableRegions();
|
||||
frame->GetDocument().DraggableRegions();
|
||||
std::vector<Cef_DraggableRegion_Params> regions;
|
||||
for (size_t i = 0; i < webregions.size(); ++i) {
|
||||
Cef_DraggableRegion_Params region;
|
||||
@ -561,8 +567,8 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
||||
DCHECK_GE(script_start_line, 0);
|
||||
|
||||
if (is_javascript) {
|
||||
web_frame->executeScript(
|
||||
WebScriptSource(blink::WebString::fromUTF8(code),
|
||||
web_frame->ExecuteScript(
|
||||
WebScriptSource(blink::WebString::FromUTF8(code),
|
||||
GURL(script_url),
|
||||
script_start_line));
|
||||
success = true;
|
||||
@ -586,17 +592,17 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
||||
DCHECK(!command.empty());
|
||||
|
||||
if (base::LowerCaseEqualsASCII(command, "getsource")) {
|
||||
if (web_frame->isWebLocalFrame()) {
|
||||
response = blink::WebFrameContentDumper::dumpAsMarkup(
|
||||
web_frame->toWebLocalFrame()).utf8();
|
||||
if (web_frame->IsWebLocalFrame()) {
|
||||
response = blink::WebFrameContentDumper::DumpAsMarkup(
|
||||
web_frame->ToWebLocalFrame()).Utf8();
|
||||
success = true;
|
||||
}
|
||||
} else if (base::LowerCaseEqualsASCII(command, "gettext")) {
|
||||
response = webkit_glue::DumpDocumentText(web_frame);
|
||||
success = true;
|
||||
} else if (web_frame->isWebLocalFrame() &&
|
||||
web_frame->toWebLocalFrame()->executeCommand(
|
||||
blink::WebString::fromUTF8(command))) {
|
||||
} else if (web_frame->IsWebLocalFrame() &&
|
||||
web_frame->ToWebLocalFrame()->ExecuteCommand(
|
||||
blink::WebString::FromUTF8(command))) {
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@ -614,7 +620,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
||||
params.arguments.GetString(0, &string);
|
||||
params.arguments.GetString(1, &url);
|
||||
|
||||
web_frame->loadHTMLString(string, GURL(url));
|
||||
web_frame->LoadHTMLString(string, GURL(url));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -697,7 +703,8 @@ void CefBrowserImpl::OnLoadEnd(blink::WebLocalFrame* frame) {
|
||||
CefRefPtr<CefLoadHandler> load_handler = handler->GetLoadHandler();
|
||||
if (load_handler.get()) {
|
||||
CefRefPtr<CefFrameImpl> cef_frame = GetWebFrameImpl(frame);
|
||||
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
||||
int httpStatusCode =
|
||||
frame->DataSource()->GetResponse().HttpStatusCode();
|
||||
load_handler->OnLoadEnd(this, cef_frame.get(), httpStatusCode);
|
||||
}
|
||||
}
|
||||
@ -719,8 +726,8 @@ void CefBrowserImpl::OnLoadError(blink::WebLocalFrame* frame,
|
||||
CefRefPtr<CefFrameImpl> cef_frame = GetWebFrameImpl(frame);
|
||||
const cef_errorcode_t errorCode =
|
||||
static_cast<cef_errorcode_t>(error.reason);
|
||||
const std::string& errorText = error.localizedDescription.utf8();
|
||||
const GURL& failedUrl = error.unreachableURL;
|
||||
const std::string& errorText = error.localized_description.Utf8();
|
||||
const GURL& failedUrl = error.unreachable_url;
|
||||
load_handler->OnLoadError(this, cef_frame.get(), errorCode, errorText,
|
||||
failedUrl.spec());
|
||||
}
|
||||
|
@ -103,10 +103,10 @@ namespace {
|
||||
// Stub implementation of blink::WebPrerenderingSupport.
|
||||
class CefPrerenderingSupport : public blink::WebPrerenderingSupport {
|
||||
private:
|
||||
void add(const blink::WebPrerender& prerender) override {}
|
||||
void cancel(const blink::WebPrerender& prerender) override {}
|
||||
void abandon(const blink::WebPrerender& prerender) override {}
|
||||
void prefetchFinished() override {}
|
||||
void Add(const blink::WebPrerender& prerender) override {}
|
||||
void Cancel(const blink::WebPrerender& prerender) override {}
|
||||
void Abandon(const blink::WebPrerender& prerender) override {}
|
||||
void PrefetchFinished() override {}
|
||||
};
|
||||
|
||||
// Stub implementation of blink::WebPrerendererClient.
|
||||
@ -116,7 +116,7 @@ class CefPrerendererClient : public content::RenderViewObserver,
|
||||
explicit CefPrerendererClient(content::RenderView* render_view)
|
||||
: content::RenderViewObserver(render_view) {
|
||||
DCHECK(render_view);
|
||||
render_view->GetWebView()->setPrerendererClient(this);
|
||||
render_view->GetWebView()->SetPrerendererClient(this);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -128,8 +128,8 @@ class CefPrerendererClient : public content::RenderViewObserver,
|
||||
}
|
||||
|
||||
// WebPrerendererClient methods:
|
||||
void willAddPrerender(blink::WebPrerender* prerender) override {}
|
||||
bool isPrefetchOnly() override { return false; }
|
||||
void WillAddPrerender(blink::WebPrerender* prerender) override {}
|
||||
bool IsPrefetchOnly() override { return false; }
|
||||
};
|
||||
|
||||
void AppendParams(const std::vector<base::string16>& additional_names,
|
||||
@ -151,13 +151,13 @@ void AppendParams(const std::vector<base::string16>& additional_names,
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < additional_names.size(); ++i) {
|
||||
names[existing_size + i] = blink::WebString::fromUTF16(additional_names[i]);
|
||||
names[existing_size + i] = blink::WebString::FromUTF16(additional_names[i]);
|
||||
values[existing_size + i] =
|
||||
blink::WebString::fromUTF16(additional_values[i]);
|
||||
blink::WebString::FromUTF16(additional_values[i]);
|
||||
}
|
||||
|
||||
existing_names->swap(names);
|
||||
existing_values->swap(values);
|
||||
existing_names->Swap(names);
|
||||
existing_values->Swap(values);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -219,7 +219,7 @@ CefRefPtr<CefBrowserImpl> CefContentRendererClient::GetBrowserForMainFrame(
|
||||
for (; it != browsers_.end(); ++it) {
|
||||
content::RenderView* render_view = it->second->render_view();
|
||||
if (render_view && render_view->GetWebView() &&
|
||||
render_view->GetWebView()->mainFrame() == frame) {
|
||||
render_view->GetWebView()->MainFrame() == frame) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
CefV8IsolateCreated();
|
||||
|
||||
// TODO(cef): Enable these once the implementation supports it.
|
||||
blink::WebRuntimeFeatures::enableNotifications(false);
|
||||
blink::WebRuntimeFeatures::EnableNotifications(false);
|
||||
|
||||
const CefContentClient::SchemeInfoList* schemes =
|
||||
CefContentClient::Get()->GetCustomSchemes();
|
||||
@ -280,15 +280,15 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
for (; it != schemes->end(); ++it) {
|
||||
const CefContentClient::SchemeInfo& info = *it;
|
||||
const blink::WebString& scheme =
|
||||
blink::WebString::fromUTF8(info.scheme_name);
|
||||
blink::WebString::FromUTF8(info.scheme_name);
|
||||
if (info.is_local)
|
||||
webkit_glue::registerURLSchemeAsLocal(scheme);
|
||||
webkit_glue::RegisterURLSchemeAsLocal(scheme);
|
||||
if (info.is_display_isolated)
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(scheme);
|
||||
blink::WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(scheme);
|
||||
if (info.is_secure)
|
||||
webkit_glue::registerURLSchemeAsSecure(scheme);
|
||||
webkit_glue::RegisterURLSchemeAsSecure(scheme);
|
||||
if (info.is_cors_enabled)
|
||||
webkit_glue::registerURLSchemeAsCORSEnabled(scheme);
|
||||
webkit_glue::RegisterURLSchemeAsCORSEnabled(scheme);
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,10 +298,10 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
const Cef_CrossOriginWhiteListEntry_Params& entry =
|
||||
cross_origin_whitelist_entries_[i];
|
||||
GURL gurl = GURL(entry.source_origin);
|
||||
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
|
||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
||||
gurl,
|
||||
blink::WebString::fromUTF8(entry.target_protocol),
|
||||
blink::WebString::fromUTF8(entry.target_domain),
|
||||
blink::WebString::FromUTF8(entry.target_protocol),
|
||||
blink::WebString::FromUTF8(entry.target_domain),
|
||||
entry.allow_target_subdomains);
|
||||
}
|
||||
cross_origin_whitelist_entries_.clear();
|
||||
@ -411,7 +411,7 @@ void CefContentRendererClient::RenderThreadStarted() {
|
||||
base::MessageLoop::current()->AddDestructionObserver(this);
|
||||
}
|
||||
|
||||
blink::WebPrerenderingSupport::initialize(new CefPrerenderingSupport());
|
||||
blink::WebPrerenderingSupport::Initialize(new CefPrerenderingSupport());
|
||||
|
||||
// Retrieve the new render thread information synchronously.
|
||||
CefProcessHostMsg_GetNewRenderThreadInfo_Params params;
|
||||
@ -475,6 +475,11 @@ void CefContentRendererClient::RenderFrameCreated(
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderFrameCreated(render_frame);
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking))
|
||||
new SpellCheckProvider(render_frame, spellcheck_.get());
|
||||
|
||||
BrowserCreated(render_frame->GetRenderView(), render_frame);
|
||||
}
|
||||
|
||||
@ -487,8 +492,16 @@ void CefContentRendererClient::RenderViewCreated(
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking))
|
||||
new SpellCheckProvider(render_view, spellcheck_.get());
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
// This is a workaround keeping the behavior that, the Blink side spellcheck
|
||||
// enabled state is initialized on RenderView creation.
|
||||
// TODO(xiaochengh): Design better way to sync between Chrome-side and
|
||||
// Blink-side spellcheck enabled states. See crbug.com/710097.
|
||||
if (SpellCheckProvider* provider =
|
||||
SpellCheckProvider::Get(render_view->GetMainRenderFrame())) {
|
||||
provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
BrowserCreated(render_view, render_view->GetMainRenderFrame());
|
||||
}
|
||||
@ -498,7 +511,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
||||
blink::WebLocalFrame* frame,
|
||||
const blink::WebPluginParams& params,
|
||||
blink::WebPlugin** plugin) {
|
||||
std::string orig_mime_type = params.mimeType.utf8();
|
||||
std::string orig_mime_type = params.mime_type.Utf8();
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
!extensions_renderer_client_->OverrideCreatePlugin(render_frame,
|
||||
params)) {
|
||||
@ -509,7 +522,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
render_frame->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
render_frame->GetRoutingID(), url, render_frame->IsMainFrame(),
|
||||
frame->top()->getSecurityOrigin(), orig_mime_type, &output));
|
||||
frame->Top()->GetSecurityOrigin(), orig_mime_type, &output));
|
||||
|
||||
*plugin = CreatePlugin(render_frame, frame, params, output);
|
||||
return true;
|
||||
@ -530,7 +543,7 @@ bool CefContentRendererClient::HandleNavigation(
|
||||
application->GetRenderProcessHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
||||
if (browserPtr.get()) {
|
||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||
CefRefPtr<CefRequest> requestPtr(CefRequest::Create());
|
||||
@ -541,22 +554,22 @@ bool CefContentRendererClient::HandleNavigation(
|
||||
|
||||
cef_navigation_type_t navigation_type = NAVIGATION_OTHER;
|
||||
switch (type) {
|
||||
case blink::WebNavigationTypeLinkClicked:
|
||||
case blink::kWebNavigationTypeLinkClicked:
|
||||
navigation_type = NAVIGATION_LINK_CLICKED;
|
||||
break;
|
||||
case blink::WebNavigationTypeFormSubmitted:
|
||||
case blink::kWebNavigationTypeFormSubmitted:
|
||||
navigation_type = NAVIGATION_FORM_SUBMITTED;
|
||||
break;
|
||||
case blink::WebNavigationTypeBackForward:
|
||||
case blink::kWebNavigationTypeBackForward:
|
||||
navigation_type = NAVIGATION_BACK_FORWARD;
|
||||
break;
|
||||
case blink::WebNavigationTypeReload:
|
||||
case blink::kWebNavigationTypeReload:
|
||||
navigation_type = NAVIGATION_RELOAD;
|
||||
break;
|
||||
case blink::WebNavigationTypeFormResubmitted:
|
||||
case blink::kWebNavigationTypeFormResubmitted:
|
||||
navigation_type = NAVIGATION_FORM_RESUBMITTED;
|
||||
break;
|
||||
case blink::WebNavigationTypeOther:
|
||||
case blink::kWebNavigationTypeOther:
|
||||
navigation_type = NAVIGATION_OTHER;
|
||||
break;
|
||||
}
|
||||
@ -579,7 +592,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer) {
|
||||
DCHECK(!frame->parent());
|
||||
DCHECK(!frame->Parent());
|
||||
|
||||
// For now, we skip the rest for POST submissions. This is because
|
||||
// http://crbug.com/101395 is more likely to cause compatibility issues
|
||||
@ -646,6 +659,12 @@ void CefContentRendererClient::RunScriptsAtDocumentEnd(
|
||||
extensions_renderer_client_->RunScriptsAtDocumentEnd(render_frame);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::RunScriptsAtDocumentIdle(
|
||||
content::RenderFrame* render_frame) {
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RunScriptsAtDocumentIdle(render_frame);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::WillDestroyCurrentMessageLoop() {
|
||||
base::AutoLock lock_scope(single_process_cleanup_lock_);
|
||||
single_process_cleanup_complete_ = true;
|
||||
@ -663,7 +682,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
||||
const std::string& identifier = output.group_identifier;
|
||||
CefViewHostMsg_GetPluginInfo_Status status = output.status;
|
||||
GURL url(original_params.url);
|
||||
std::string orig_mime_type = original_params.mimeType.utf8();
|
||||
std::string orig_mime_type = original_params.mime_type.Utf8();
|
||||
CefPluginPlaceholder* placeholder = NULL;
|
||||
|
||||
// If the browser plugin is to be enabled, this should be handled by the
|
||||
@ -680,16 +699,16 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
||||
if (info.mime_types[i].mime_type == actual_mime_type) {
|
||||
AppendParams(info.mime_types[i].additional_param_names,
|
||||
info.mime_types[i].additional_param_values,
|
||||
¶ms.attributeNames, ¶ms.attributeValues);
|
||||
¶ms.attribute_names, ¶ms.attribute_values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (params.mimeType.isNull() && (actual_mime_type.size() > 0)) {
|
||||
if (params.mime_type.IsNull() && (actual_mime_type.size() > 0)) {
|
||||
// Webkit might say that mime type is null while we already know the
|
||||
// actual mime type via CefViewHostMsg_GetPluginInfo. In that case
|
||||
// we should use what we know since WebpluginDelegateProxy does some
|
||||
// specific initializations based on this information.
|
||||
params.mimeType = blink::WebString::fromUTF8(actual_mime_type.c_str());
|
||||
params.mime_type = blink::WebString::FromUTF8(actual_mime_type);
|
||||
}
|
||||
|
||||
auto create_blocked_plugin = [&render_frame, &frame, ¶ms, &info,
|
||||
@ -717,7 +736,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
||||
|
||||
PowerSaverInfo power_saver_info =
|
||||
PowerSaverInfo::Get(render_frame, power_saver_setting_on, params,
|
||||
info, frame->document().url());
|
||||
info, frame->GetDocument().Url());
|
||||
if (power_saver_info.blocked_for_background_tab || is_prerendering ||
|
||||
!power_saver_info.poster_attribute.empty()) {
|
||||
placeholder = CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
@ -848,7 +867,7 @@ void CefContentRendererClient::BrowserCreated(
|
||||
// WebKit layer, or if it would be exposed as an WebView instance method; the
|
||||
// current implementation uses a static variable, and WebKit needs to be
|
||||
// patched in order to make it work for each WebView instance
|
||||
render_view->GetWebView()->setUseExternalPopupMenusThisInstance(
|
||||
render_view->GetWebView()->SetUseExternalPopupMenusThisInstance(
|
||||
!params.is_windowless);
|
||||
#endif
|
||||
|
||||
|
@ -127,6 +127,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
override;
|
||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
|
||||
|
||||
// MessageLoop::DestructionObserver implementation.
|
||||
void WillDestroyCurrentMessageLoop() override;
|
||||
|
@ -29,8 +29,8 @@ CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser,
|
||||
WebFrame* frame)
|
||||
: browser_(browser),
|
||||
frame_(frame) {
|
||||
const WebDocument& document = frame_->document();
|
||||
DCHECK(!document.isNull());
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
DCHECK(!document.IsNull());
|
||||
}
|
||||
|
||||
CefDOMDocumentImpl::~CefDOMDocumentImpl() {
|
||||
@ -44,29 +44,29 @@ CefDOMDocumentImpl::Type CefDOMDocumentImpl::GetType() {
|
||||
if (!VerifyContext())
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
if (document.isHTMLDocument())
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
if (document.IsHTMLDocument())
|
||||
return DOM_DOCUMENT_TYPE_HTML;
|
||||
if (document.isXHTMLDocument())
|
||||
if (document.IsXHTMLDocument())
|
||||
return DOM_DOCUMENT_TYPE_XHTML;
|
||||
if (document.isPluginDocument())
|
||||
if (document.IsPluginDocument())
|
||||
return DOM_DOCUMENT_TYPE_PLUGIN;
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetDocument() {
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.document());
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
return GetOrCreateNode(document.GetDocument());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetBody() {
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.body());
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
return GetOrCreateNode(document.Body());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetHead() {
|
||||
WebDocument document = frame_->document();
|
||||
return GetOrCreateNode(document.head());
|
||||
WebDocument document = frame_->GetDocument();
|
||||
return GetOrCreateNode(document.Head());
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetTitle() {
|
||||
@ -74,89 +74,89 @@ CefString CefDOMDocumentImpl::GetTitle() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebString& title = document.title();
|
||||
if (!title.isNull())
|
||||
str = title.utf16();
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
const WebString& title = document.Title();
|
||||
if (!title.IsNull())
|
||||
str = title.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id) {
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.getElementById(WebString::fromUTF16(id)));
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
return GetOrCreateNode(document.GetElementById(WebString::FromUTF16(id)));
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
|
||||
const WebDocument& document = frame_->document();
|
||||
return GetOrCreateNode(document.focusedElement());
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
return GetOrCreateNode(document.FocusedElement());
|
||||
}
|
||||
|
||||
bool CefDOMDocumentImpl::HasSelection() {
|
||||
if (!VerifyContext() || !frame_->isWebLocalFrame())
|
||||
if (!VerifyContext() || !frame_->IsWebLocalFrame())
|
||||
return false;
|
||||
|
||||
return frame_->toWebLocalFrame()->hasSelection();
|
||||
return frame_->ToWebLocalFrame()->HasSelection();
|
||||
}
|
||||
|
||||
int CefDOMDocumentImpl::GetSelectionStartOffset() {
|
||||
if (!VerifyContext() || !frame_->isWebLocalFrame())
|
||||
if (!VerifyContext() || !frame_->IsWebLocalFrame())
|
||||
return 0;
|
||||
|
||||
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
|
||||
if (!!local_frame->hasSelection())
|
||||
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame();
|
||||
if (!!local_frame->HasSelection())
|
||||
return 0;
|
||||
|
||||
const WebRange& range = local_frame->selectionRange();
|
||||
if (range.isNull())
|
||||
const WebRange& range = local_frame->SelectionRange();
|
||||
if (range.IsNull())
|
||||
return 0;
|
||||
|
||||
return range.startOffset();
|
||||
return range.StartOffset();
|
||||
}
|
||||
|
||||
int CefDOMDocumentImpl::GetSelectionEndOffset() {
|
||||
if (!VerifyContext() || !frame_->isWebLocalFrame())
|
||||
if (!VerifyContext() || !frame_->IsWebLocalFrame())
|
||||
return 0;
|
||||
|
||||
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
|
||||
if (!!local_frame->hasSelection())
|
||||
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame();
|
||||
if (!!local_frame->HasSelection())
|
||||
return 0;
|
||||
|
||||
const WebRange& range = local_frame->selectionRange();
|
||||
if (range.isNull())
|
||||
const WebRange& range = local_frame->SelectionRange();
|
||||
if (range.IsNull())
|
||||
return 0;
|
||||
|
||||
return range.endOffset();
|
||||
return range.EndOffset();
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
|
||||
CefString str;
|
||||
if (!VerifyContext() || !frame_->isWebLocalFrame())
|
||||
if (!VerifyContext() || !frame_->IsWebLocalFrame())
|
||||
return str;
|
||||
|
||||
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
|
||||
if (!!local_frame->hasSelection())
|
||||
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame();
|
||||
if (!!local_frame->HasSelection())
|
||||
return str;
|
||||
|
||||
const WebString& markup = local_frame->selectionAsMarkup();
|
||||
if (!markup.isNull())
|
||||
str = markup.utf16();
|
||||
const WebString& markup = local_frame->SelectionAsMarkup();
|
||||
if (!markup.IsNull())
|
||||
str = markup.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefString CefDOMDocumentImpl::GetSelectionAsText() {
|
||||
CefString str;
|
||||
if (!VerifyContext() || !frame_->isWebLocalFrame())
|
||||
if (!VerifyContext() || !frame_->IsWebLocalFrame())
|
||||
return str;
|
||||
|
||||
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
|
||||
if (!!local_frame->hasSelection())
|
||||
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame();
|
||||
if (!!local_frame->HasSelection())
|
||||
return str;
|
||||
|
||||
const WebString& text = local_frame->selectionAsText();
|
||||
if (!text.isNull())
|
||||
str = text.utf16();
|
||||
const WebString& text = local_frame->SelectionAsText();
|
||||
if (!text.IsNull())
|
||||
str = text.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -166,9 +166,9 @@ CefString CefDOMDocumentImpl::GetBaseURL() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebURL& url = document.baseURL();
|
||||
if (!url.isNull()) {
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
const WebURL& url = document.BaseURL();
|
||||
if (!url.IsNull()) {
|
||||
GURL gurl = url;
|
||||
str = gurl.spec();
|
||||
}
|
||||
@ -181,9 +181,9 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebDocument& document = frame_->document();
|
||||
const WebURL& url = document.completeURL(WebString::fromUTF16(partialURL));
|
||||
if (!url.isNull()) {
|
||||
const WebDocument& document = frame_->GetDocument();
|
||||
const WebURL& url = document.CompleteURL(WebString::FromUTF16(partialURL));
|
||||
if (!url.IsNull()) {
|
||||
GURL gurl = url;
|
||||
str = gurl.spec();
|
||||
}
|
||||
@ -197,7 +197,7 @@ CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetOrCreateNode(
|
||||
return NULL;
|
||||
|
||||
// Nodes may potentially be null.
|
||||
if (node.isNull())
|
||||
if (node.IsNull())
|
||||
return NULL;
|
||||
|
||||
if (!node_map_.empty()) {
|
||||
|
@ -41,7 +41,7 @@ CefDOMNodeImpl::CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
CefDOMNodeImpl::~CefDOMNodeImpl() {
|
||||
CEF_REQUIRE_RT();
|
||||
|
||||
if (document_.get() && !node_.isNull()) {
|
||||
if (document_.get() && !node_.IsNull()) {
|
||||
// Remove the node from the document.
|
||||
document_->RemoveNode(node_);
|
||||
}
|
||||
@ -58,14 +58,14 @@ bool CefDOMNodeImpl::IsText() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.isTextNode();
|
||||
return node_.IsTextNode();
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::IsElement() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.isElementNode();
|
||||
return node_.IsElementNode();
|
||||
}
|
||||
|
||||
// Logic copied from RenderViewImpl::IsEditableNode.
|
||||
@ -73,19 +73,19 @@ bool CefDOMNodeImpl::IsEditable() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (node_.isContentEditable())
|
||||
if (node_.IsContentEditable())
|
||||
return true;
|
||||
|
||||
if (node_.isElementNode()) {
|
||||
const WebElement& element = node_.toConst<WebElement>();
|
||||
if (node_.IsElementNode()) {
|
||||
const WebElement& element = node_.ToConst<WebElement>();
|
||||
if (webkit_glue::IsTextControlElement(element))
|
||||
return true;
|
||||
|
||||
// Also return true if it has an ARIA role of 'textbox'.
|
||||
for (unsigned i = 0; i < element.attributeCount(); ++i) {
|
||||
if (base::LowerCaseEqualsASCII(element.attributeLocalName(i).utf8(),
|
||||
for (unsigned i = 0; i < element.AttributeCount(); ++i) {
|
||||
if (base::LowerCaseEqualsASCII(element.AttributeLocalName(i).Utf8(),
|
||||
"role")) {
|
||||
if (base::LowerCaseEqualsASCII(element.attributeValue(i).utf8(),
|
||||
if (base::LowerCaseEqualsASCII(element.AttributeValue(i).Utf8(),
|
||||
"textbox")) {
|
||||
return true;
|
||||
}
|
||||
@ -101,9 +101,9 @@ bool CefDOMNodeImpl::IsFormControlElement() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (node_.isElementNode()) {
|
||||
const WebElement& element = node_.toConst<WebElement>();
|
||||
return element.isFormControlElement();
|
||||
if (node_.IsElementNode()) {
|
||||
const WebElement& element = node_.ToConst<WebElement>();
|
||||
return element.IsFormControlElement();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -114,15 +114,15 @@ CefString CefDOMNodeImpl::GetFormControlElementType() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (node_.isElementNode()) {
|
||||
const WebElement& element = node_.toConst<WebElement>();
|
||||
if (element.isFormControlElement()) {
|
||||
if (node_.IsElementNode()) {
|
||||
const WebElement& element = node_.ToConst<WebElement>();
|
||||
if (element.IsFormControlElement()) {
|
||||
// Retrieve the type from the form control element.
|
||||
const WebFormControlElement& formElement =
|
||||
node_.toConst<WebFormControlElement>();
|
||||
node_.ToConst<WebFormControlElement>();
|
||||
|
||||
const base::string16& form_control_type =
|
||||
formElement.formControlType().utf16();
|
||||
formElement.FormControlType().Utf16();
|
||||
str = form_control_type;
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ bool CefDOMNodeImpl::IsSame(CefRefPtr<CefDOMNode> that) {
|
||||
if (!impl || !impl->VerifyContext())
|
||||
return false;
|
||||
|
||||
return node_.equals(impl->node_);
|
||||
return node_.Equals(impl->node_);
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetName() {
|
||||
@ -147,8 +147,8 @@ CefString CefDOMNodeImpl::GetName() {
|
||||
return str;
|
||||
|
||||
const WebString& name = webkit_glue::GetNodeName(node_);
|
||||
if (!name.isNull())
|
||||
str = name.utf16();
|
||||
if (!name.IsNull())
|
||||
str = name.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -158,24 +158,24 @@ CefString CefDOMNodeImpl::GetValue() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (node_.isElementNode()) {
|
||||
const WebElement& element = node_.toConst<WebElement>();
|
||||
if (element.isFormControlElement()) {
|
||||
if (node_.IsElementNode()) {
|
||||
const WebElement& element = node_.ToConst<WebElement>();
|
||||
if (element.IsFormControlElement()) {
|
||||
// Retrieve the value from the form control element.
|
||||
const WebFormControlElement& formElement =
|
||||
node_.toConst<WebFormControlElement>();
|
||||
node_.ToConst<WebFormControlElement>();
|
||||
|
||||
base::string16 value;
|
||||
const base::string16& form_control_type =
|
||||
formElement.formControlType().utf16();
|
||||
formElement.FormControlType().Utf16();
|
||||
if (form_control_type == base::ASCIIToUTF16("text")) {
|
||||
const WebInputElement& input_element =
|
||||
formElement.toConst<WebInputElement>();
|
||||
value = input_element.value().utf16();
|
||||
formElement.ToConst<WebInputElement>();
|
||||
value = input_element.Value().Utf16();
|
||||
} else if (form_control_type == base::ASCIIToUTF16("select-one")) {
|
||||
const WebSelectElement& select_element =
|
||||
formElement.toConst<WebSelectElement>();
|
||||
value = select_element.value().utf16();
|
||||
formElement.ToConst<WebSelectElement>();
|
||||
value = select_element.Value().Utf16();
|
||||
}
|
||||
|
||||
base::TrimWhitespace(value, base::TRIM_LEADING, &value);
|
||||
@ -184,9 +184,9 @@ CefString CefDOMNodeImpl::GetValue() {
|
||||
}
|
||||
|
||||
if (str.empty()) {
|
||||
const WebString& value = node_.nodeValue();
|
||||
if (!value.isNull())
|
||||
str = value.utf16();
|
||||
const WebString& value = node_.NodeValue();
|
||||
if (!value.IsNull())
|
||||
str = value.Utf16();
|
||||
}
|
||||
|
||||
return str;
|
||||
@ -196,10 +196,10 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (node_.isElementNode())
|
||||
if (node_.IsElementNode())
|
||||
return false;
|
||||
|
||||
return webkit_glue::SetNodeValue(node_, WebString::fromUTF16(value));
|
||||
return webkit_glue::SetNodeValue(node_, WebString::FromUTF16(value));
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetAsMarkup() {
|
||||
@ -208,8 +208,8 @@ CefString CefDOMNodeImpl::GetAsMarkup() {
|
||||
return str;
|
||||
|
||||
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
|
||||
if (!markup.isNull())
|
||||
str = markup.utf16();
|
||||
if (!markup.IsNull())
|
||||
str = markup.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -225,42 +225,42 @@ CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetParent() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.parentNode());
|
||||
return document_->GetOrCreateNode(node_.ParentNode());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetPreviousSibling() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.previousSibling());
|
||||
return document_->GetOrCreateNode(node_.PreviousSibling());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetNextSibling() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.nextSibling());
|
||||
return document_->GetOrCreateNode(node_.NextSibling());
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::HasChildren() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return !node_.firstChild().isNull();
|
||||
return !node_.FirstChild().IsNull();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetFirstChild() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.firstChild());
|
||||
return document_->GetOrCreateNode(node_.FirstChild());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetLastChild() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(node_.lastChild());
|
||||
return document_->GetOrCreateNode(node_.LastChild());
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementTagName() {
|
||||
@ -268,15 +268,15 @@ CefString CefDOMNodeImpl::GetElementTagName() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||
const WebString& tagname = element.tagName();
|
||||
if (!tagname.isNull())
|
||||
str = tagname.utf16();
|
||||
const WebElement& element = node_.ToConst<blink::WebElement>();
|
||||
const WebString& tagname = element.TagName();
|
||||
if (!tagname.IsNull())
|
||||
str = tagname.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -285,26 +285,26 @@ bool CefDOMNodeImpl::HasElementAttributes() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||
return (element.attributeCount() > 0);
|
||||
const WebElement& element = node_.ToConst<blink::WebElement>();
|
||||
return (element.AttributeCount() > 0);
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||
return element.hasAttribute(WebString::fromUTF16(attrName));
|
||||
const WebElement& element = node_.ToConst<blink::WebElement>();
|
||||
return element.HasAttribute(WebString::FromUTF16(attrName));
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
|
||||
@ -312,15 +312,15 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||
const WebString& attr = element.getAttribute(WebString::fromUTF16(attrName));
|
||||
if (!attr.isNull())
|
||||
str = attr.utf16();
|
||||
const WebElement& element = node_.ToConst<blink::WebElement>();
|
||||
const WebString& attr = element.GetAttribute(WebString::FromUTF16(attrName));
|
||||
if (!attr.IsNull())
|
||||
str = attr.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -329,19 +329,19 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) {
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return;
|
||||
}
|
||||
|
||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||
unsigned int len = element.attributeCount();
|
||||
const WebElement& element = node_.ToConst<blink::WebElement>();
|
||||
unsigned int len = element.AttributeCount();
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i < len; ++i) {
|
||||
base::string16 name = element.attributeLocalName(i).utf16();
|
||||
base::string16 value = element.attributeValue(i).utf16();
|
||||
base::string16 name = element.AttributeLocalName(i).Utf16();
|
||||
base::string16 value = element.AttributeValue(i).Utf16();
|
||||
attrMap.insert(std::make_pair(name, value));
|
||||
}
|
||||
}
|
||||
@ -351,14 +351,14 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName,
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
WebElement element = node_.to<blink::WebElement>();
|
||||
element.setAttribute(WebString::fromUTF16(attrName),
|
||||
WebString::fromUTF16(value));
|
||||
WebElement element = node_.To<blink::WebElement>();
|
||||
element.SetAttribute(WebString::FromUTF16(attrName),
|
||||
WebString::FromUTF16(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -367,15 +367,15 @@ CefString CefDOMNodeImpl::GetElementInnerText() {
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return str;
|
||||
}
|
||||
|
||||
WebElement element = node_.to<blink::WebElement>();
|
||||
const WebString& text = element.textContent();
|
||||
if (!text.isNull())
|
||||
str = text.utf16();
|
||||
WebElement element = node_.To<blink::WebElement>();
|
||||
const WebString& text = element.TextContent();
|
||||
if (!text.IsNull())
|
||||
str = text.Utf16();
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -385,13 +385,13 @@ CefRect CefDOMNodeImpl::GetElementBounds() {
|
||||
if (!VerifyContext())
|
||||
return rect;
|
||||
|
||||
if (!node_.isElementNode()) {
|
||||
if (!node_.IsElementNode()) {
|
||||
NOTREACHED();
|
||||
return rect;
|
||||
}
|
||||
|
||||
WebElement element = node_.to<blink::WebElement>();
|
||||
blink::WebRect rc = element.boundsInViewport();
|
||||
WebElement element = node_.To<blink::WebElement>();
|
||||
blink::WebRect rc = element.BoundsInViewport();
|
||||
rect.Set(rc.x, rc.y, rc.width, rc.height);
|
||||
|
||||
return rect;
|
||||
@ -399,7 +399,7 @@ CefRect CefDOMNodeImpl::GetElementBounds() {
|
||||
|
||||
void CefDOMNodeImpl::Detach() {
|
||||
document_ = NULL;
|
||||
node_.assign(WebNode());
|
||||
node_.Assign(WebNode());
|
||||
}
|
||||
|
||||
bool CefDOMNodeImpl::VerifyContext() {
|
||||
@ -409,7 +409,7 @@ bool CefDOMNodeImpl::VerifyContext() {
|
||||
}
|
||||
if (!document_->VerifyContext())
|
||||
return false;
|
||||
if (node_.isNull()) {
|
||||
if (node_.IsNull()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
|
||||
const GURL& new_url,
|
||||
bool is_extension_url,
|
||||
bool is_initial_navigation) {
|
||||
DCHECK(!frame->parent());
|
||||
GURL old_url(frame->document().url());
|
||||
DCHECK(!frame->Parent());
|
||||
GURL old_url(frame->GetDocument().Url());
|
||||
|
||||
extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
@ -62,8 +62,9 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
|
||||
// If old_url is still empty and this is an initial navigation, then this is
|
||||
// a window.open operation. We should look at the opener URL. Note that the
|
||||
// opener is a local frame in this case.
|
||||
if (is_initial_navigation && old_url.is_empty() && frame->opener()) {
|
||||
blink::WebLocalFrame* opener_frame = frame->opener()->toWebLocalFrame();
|
||||
if (is_initial_navigation && old_url.is_empty() && frame->Opener() &&
|
||||
frame->Opener()->IsWebLocalFrame()) {
|
||||
blink::WebLocalFrame* opener_frame = frame->Opener()->ToWebLocalFrame();
|
||||
|
||||
// We usually want to compare against the URL that determines the type of
|
||||
// process. In default Chrome, that's the URL of the opener's top frame and
|
||||
@ -74,19 +75,19 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
::switches::kSitePerProcess) ||
|
||||
extensions::IsIsolateExtensionsEnabled())
|
||||
old_url = opener_frame->document().url();
|
||||
old_url = opener_frame->GetDocument().Url();
|
||||
else
|
||||
old_url = opener_frame->top()->document().url();
|
||||
old_url = opener_frame->Top()->GetDocument().Url();
|
||||
|
||||
// If we're about to open a normal web page from a same-origin opener stuck
|
||||
// in an extension process (other than the Chrome Web Store), we want to
|
||||
// keep it in process to allow the opener to script it.
|
||||
blink::WebDocument opener_document = opener_frame->document();
|
||||
blink::WebDocument opener_document = opener_frame->GetDocument();
|
||||
blink::WebSecurityOrigin opener_origin =
|
||||
opener_document.getSecurityOrigin();
|
||||
bool opener_is_extension_url = !opener_origin.isUnique() &&
|
||||
opener_document.GetSecurityOrigin();
|
||||
bool opener_is_extension_url = !opener_origin.IsUnique() &&
|
||||
extension_registry->GetExtensionOrAppByURL(
|
||||
opener_document.url()) != nullptr;
|
||||
opener_document.Url()) != nullptr;
|
||||
const extensions::Extension* opener_top_extension =
|
||||
extension_registry->GetExtensionOrAppByURL(old_url);
|
||||
bool opener_is_web_store =
|
||||
@ -94,14 +95,14 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
|
||||
opener_top_extension->id() == extensions::kWebStoreAppId;
|
||||
if (!is_extension_url && !opener_is_extension_url && !opener_is_web_store &&
|
||||
IsStandaloneExtensionProcess() &&
|
||||
opener_origin.canRequest(blink::WebURL(new_url)))
|
||||
opener_origin.CanRequest(blink::WebURL(new_url)))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only consider keeping non-app URLs in an app process if this window
|
||||
// has an opener (in which case it might be an OAuth popup that tries to
|
||||
// script an iframe within the app).
|
||||
bool should_consider_workaround = !!frame->opener();
|
||||
bool should_consider_workaround = !!frame->Opener();
|
||||
|
||||
return extensions::CrossesExtensionProcessBoundary(
|
||||
*extension_registry->GetMainThreadExtensionSet(), old_url, new_url,
|
||||
@ -157,7 +158,7 @@ void CefExtensionsRendererClient::RenderViewCreated(
|
||||
bool CefExtensionsRendererClient::OverrideCreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params) {
|
||||
if (params.mimeType.utf8() != content::kBrowserPluginMimeType)
|
||||
if (params.mime_type.Utf8() != content::kBrowserPluginMimeType)
|
||||
return true;
|
||||
|
||||
bool guest_view_api_available = false;
|
||||
@ -174,7 +175,7 @@ bool CefExtensionsRendererClient::WillSendRequest(
|
||||
GURL* new_url) {
|
||||
// Check whether the request should be allowed. If not allowed, we reset the
|
||||
// URL to something invalid to prevent the request and cause an error.
|
||||
if (url.protocolIs(extensions::kExtensionScheme) &&
|
||||
if (url.ProtocolIs(extensions::kExtensionScheme) &&
|
||||
!resource_request_policy_->CanRequestResource(GURL(url), frame,
|
||||
transition_type)) {
|
||||
*new_url = GURL(chrome::kExtensionInvalidRequestURL);
|
||||
@ -194,6 +195,11 @@ void CefExtensionsRendererClient::RunScriptsAtDocumentEnd(
|
||||
extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame);
|
||||
}
|
||||
|
||||
void CefExtensionsRendererClient::RunScriptsAtDocumentIdle(
|
||||
content::RenderFrame* render_frame) {
|
||||
extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
@ -232,7 +238,7 @@ bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
// for subframes, so this check only makes sense for top-level frames.
|
||||
// TODO(alexmos,nasko): Figure out how this check should work when reloading
|
||||
// subframes in --site-per-process mode.
|
||||
if (!frame->parent() && GURL(frame->document().url()) == url) {
|
||||
if (!frame->Parent() && GURL(frame->GetDocument().Url()) == url) {
|
||||
if (is_extension_url != IsStandaloneExtensionProcess())
|
||||
return true;
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
GURL* new_url);
|
||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame);
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame);
|
||||
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame);
|
||||
|
||||
static bool ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
|
@ -29,13 +29,13 @@ bool CefPrintWebViewHelperDelegate::CancelPrerender(
|
||||
// Return the PDF object element if |frame| is the out of process PDF extension.
|
||||
blink::WebElement CefPrintWebViewHelperDelegate::GetPdfElement(
|
||||
blink::WebLocalFrame* frame) {
|
||||
GURL url = frame->document().url();
|
||||
GURL url = frame->GetDocument().Url();
|
||||
if (url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
url.host() == extension_misc::kPdfExtensionId) {
|
||||
// <object> with id="plugin" is created in
|
||||
// chrome/browser/resources/pdf/pdf.js.
|
||||
auto plugin_element = frame->document().getElementById("plugin");
|
||||
if (!plugin_element.isNull()) {
|
||||
auto plugin_element = frame->GetDocument().GetElementById("plugin");
|
||||
if (!plugin_element.IsNull()) {
|
||||
return plugin_element;
|
||||
}
|
||||
NOTREACHED();
|
||||
@ -49,7 +49,7 @@ bool CefPrintWebViewHelperDelegate::IsPrintPreviewEnabled() {
|
||||
|
||||
bool CefPrintWebViewHelperDelegate::OverridePrint(
|
||||
blink::WebLocalFrame* frame) {
|
||||
if (!frame->document().isPluginDocument())
|
||||
if (!frame->GetDocument().IsPluginDocument())
|
||||
return false;
|
||||
|
||||
std::vector<extensions::MimeHandlerViewContainer*> mime_handlers =
|
||||
|
@ -84,10 +84,10 @@ void CefFrameImpl::ViewSource() {
|
||||
|
||||
void CefFrameImpl::GetSource(CefRefPtr<CefStringVisitor> visitor) {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
if (frame_ && frame_->isWebLocalFrame()) {
|
||||
if (frame_ && frame_->IsWebLocalFrame()) {
|
||||
const CefString& content =
|
||||
std::string(blink::WebFrameContentDumper::dumpAsMarkup(
|
||||
frame_->toWebLocalFrame()).utf8());
|
||||
std::string(blink::WebFrameContentDumper::DumpAsMarkup(
|
||||
frame_->ToWebLocalFrame()).Utf8());
|
||||
visitor->Visit(content);
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ void CefFrameImpl::LoadString(const CefString& string,
|
||||
|
||||
if (frame_) {
|
||||
GURL gurl = GURL(url.ToString());
|
||||
frame_->loadHTMLString(string.ToString(), gurl);
|
||||
frame_->LoadHTMLString(string.ToString(), gurl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,8 +167,8 @@ void CefFrameImpl::ExecuteJavaScript(const CefString& jsCode,
|
||||
|
||||
if (frame_) {
|
||||
GURL gurl = GURL(scriptUrl.ToString());
|
||||
frame_->executeScript(
|
||||
blink::WebScriptSource(WebString::fromUTF16(jsCode.ToString16()), gurl,
|
||||
frame_->ExecuteScript(
|
||||
blink::WebScriptSource(WebString::FromUTF16(jsCode.ToString16()), gurl,
|
||||
startLine));
|
||||
}
|
||||
}
|
||||
@ -177,15 +177,15 @@ bool CefFrameImpl::IsMain() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
if (frame_)
|
||||
return (frame_->parent() == NULL);
|
||||
return (frame_->Parent() == NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefFrameImpl::IsFocused() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
if (frame_ && frame_->view())
|
||||
return (frame_->view()->focusedFrame() == frame_);
|
||||
if (frame_ && frame_->View())
|
||||
return (frame_->View()->FocusedFrame() == frame_);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ CefString CefFrameImpl::GetName() {
|
||||
CEF_REQUIRE_RT_RETURN(name);
|
||||
|
||||
if (frame_)
|
||||
name = frame_->uniqueName().utf16();
|
||||
name = webkit_glue::GetUniqueName(frame_);
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ CefRefPtr<CefFrame> CefFrameImpl::GetParent() {
|
||||
CEF_REQUIRE_RT_RETURN(NULL);
|
||||
|
||||
if (frame_) {
|
||||
blink::WebFrame* parent = frame_->parent();
|
||||
blink::WebFrame* parent = frame_->Parent();
|
||||
if (parent)
|
||||
return browser_->GetWebFrameImpl(parent).get();
|
||||
}
|
||||
@ -221,7 +221,7 @@ CefString CefFrameImpl::GetURL() {
|
||||
CEF_REQUIRE_RT_RETURN(url);
|
||||
|
||||
if (frame_) {
|
||||
GURL gurl = frame_->document().url();
|
||||
GURL gurl = frame_->GetDocument().Url();
|
||||
url = gurl.spec();
|
||||
}
|
||||
return url;
|
||||
@ -237,9 +237,9 @@ CefRefPtr<CefV8Context> CefFrameImpl::GetV8Context() {
|
||||
CEF_REQUIRE_RT_RETURN(NULL);
|
||||
|
||||
if (frame_) {
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
return new CefV8ContextImpl(isolate, frame_->mainWorldScriptContext());
|
||||
return new CefV8ContextImpl(isolate, frame_->MainWorldScriptContext());
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@ -254,8 +254,8 @@ void CefFrameImpl::VisitDOM(CefRefPtr<CefDOMVisitor> visitor) {
|
||||
// Create a CefDOMDocumentImpl object that is valid only for the scope of this
|
||||
// method.
|
||||
CefRefPtr<CefDOMDocumentImpl> documentImpl;
|
||||
const blink::WebDocument& document = frame_->document();
|
||||
if (!document.isNull())
|
||||
const blink::WebDocument& document = frame_->GetDocument();
|
||||
if (!document.IsNull())
|
||||
documentImpl = new CefDOMDocumentImpl(browser_, frame_);
|
||||
|
||||
visitor->Visit(documentImpl.get());
|
||||
@ -271,8 +271,8 @@ void CefFrameImpl::Detach() {
|
||||
|
||||
void CefFrameImpl::ExecuteCommand(const std::string& command) {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
if (frame_ && frame_->isWebLocalFrame())
|
||||
frame_->toWebLocalFrame()->executeCommand(WebString::fromUTF8(command));
|
||||
if (frame_ && frame_->IsWebLocalFrame())
|
||||
frame_->ToWebLocalFrame()->ExecuteCommand(WebString::FromUTF8(command));
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,13 +115,13 @@ void AddPepperBasedWidevine(
|
||||
for (size_t i = 0; i < codecs.size(); ++i) {
|
||||
if (codecs[i] == kCdmSupportedCodecVp8)
|
||||
supported_codecs |= media::EME_CODEC_WEBM_VP8;
|
||||
if (codecs[i] == kCdmSupportedCodecVp9)
|
||||
if (codecs[i] == kCdmSupportedCodecVp9) {
|
||||
supported_codecs |= media::EME_CODEC_WEBM_VP9;
|
||||
supported_codecs |= media::EME_CODEC_COMMON_VP9;
|
||||
}
|
||||
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
if (codecs[i] == kCdmSupportedCodecAvc1)
|
||||
supported_codecs |= media::EME_CODEC_MP4_AVC1;
|
||||
if (codecs[i] == kCdmSupportedCodecVp9)
|
||||
supported_codecs |= media::EME_CODEC_MP4_VP9;
|
||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginContainer.h"
|
||||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@ -87,7 +88,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateLoadableMissingPlugin(
|
||||
|
||||
// Will destroy itself when its WebViewPlugin is going away.
|
||||
return new CefPluginPlaceholder(render_frame, frame, params, html_data,
|
||||
params.mimeType.utf16());
|
||||
params.mime_type.Utf16());
|
||||
}
|
||||
|
||||
// static
|
||||
@ -106,8 +107,8 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
values.SetString("name", name);
|
||||
values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE));
|
||||
values.SetString("pluginType",
|
||||
frame->view()->mainFrame()->isWebLocalFrame() &&
|
||||
frame->view()->mainFrame()->document().isPluginDocument()
|
||||
frame->View()->MainFrame()->IsWebLocalFrame() &&
|
||||
frame->View()->MainFrame()->GetDocument().IsPluginDocument()
|
||||
? "document"
|
||||
: "embedded");
|
||||
|
||||
@ -117,7 +118,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
|
||||
if (!power_saver_info.custom_poster_size.IsEmpty()) {
|
||||
float zoom_factor =
|
||||
blink::WebView::zoomLevelToZoomFactor(frame->view()->zoomLevel());
|
||||
blink::WebView::ZoomLevelToZoomFactor(frame->View()->ZoomLevel());
|
||||
int width =
|
||||
roundf(power_saver_info.custom_poster_size.width() / zoom_factor);
|
||||
int height =
|
||||
@ -174,16 +175,16 @@ void CefPluginPlaceholder::ShowPermissionBubbleCallback() {
|
||||
void CefPluginPlaceholder::PluginListChanged() {
|
||||
if (!GetFrame() || !plugin())
|
||||
return;
|
||||
blink::WebDocument document = GetFrame()->top()->document();
|
||||
if (document.isNull())
|
||||
blink::WebDocument document = GetFrame()->Top()->GetDocument();
|
||||
if (document.IsNull())
|
||||
return;
|
||||
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
std::string mime_type(GetPluginParams().mimeType.utf8());
|
||||
std::string mime_type(GetPluginParams().mime_type.Utf8());
|
||||
render_frame()->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
routing_id(), GURL(GetPluginParams().url),
|
||||
GetFrame()->parent() == nullptr,
|
||||
GetFrame()->top()->getSecurityOrigin(), mime_type, &output));
|
||||
GetFrame()->Parent() == nullptr,
|
||||
GetFrame()->Top()->GetSecurityOrigin(), mime_type, &output));
|
||||
if (output.status == status_)
|
||||
return;
|
||||
blink::WebPlugin* new_plugin = CefContentRendererClient::CreatePlugin(
|
||||
@ -252,14 +253,18 @@ void CefPluginPlaceholder::ShowContextMenu(
|
||||
content::MenuItem hide_item;
|
||||
hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE;
|
||||
bool is_main_frame_plugin_document =
|
||||
GetFrame()->view()->mainFrame()->isWebLocalFrame() &&
|
||||
GetFrame()->view()->mainFrame()->document().isPluginDocument();
|
||||
GetFrame()->View()->MainFrame()->IsWebLocalFrame() &&
|
||||
GetFrame()->View()->MainFrame()->GetDocument().IsPluginDocument();
|
||||
hide_item.enabled = !is_main_frame_plugin_document;
|
||||
hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE);
|
||||
params.custom_items.push_back(hide_item);
|
||||
|
||||
params.x = event.windowX;
|
||||
params.y = event.windowY;
|
||||
blink::WebPoint point(event.PositionInWidget().x, event.PositionInWidget().y);
|
||||
if (plugin() && plugin()->Container())
|
||||
point = plugin()->Container()->LocalToRootFramePoint(point);
|
||||
|
||||
params.x = point.x;
|
||||
params.y = point.y;
|
||||
|
||||
context_menu_request_id_ = render_frame()->ShowContextMenu(this, params);
|
||||
g_last_active_menu = this;
|
||||
|
@ -76,14 +76,14 @@ void CefPluginPreroller::OnThrottleStateChange() {
|
||||
placeholder->AllowLoading();
|
||||
|
||||
blink::WebPluginContainer* container =
|
||||
throttler_->GetWebPlugin()->container();
|
||||
container->setPlugin(placeholder->plugin());
|
||||
throttler_->GetWebPlugin()->Container();
|
||||
container->SetPlugin(placeholder->plugin());
|
||||
|
||||
bool success = placeholder->plugin()->initialize(container);
|
||||
bool success = placeholder->plugin()->Initialize(container);
|
||||
DCHECK(success);
|
||||
|
||||
container->invalidate();
|
||||
container->reportGeometry();
|
||||
container->Invalidate();
|
||||
container->ReportGeometry();
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void CefRenderFrameObserver::DidCreateScriptContext(
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
|
||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
||||
if (!browserPtr.get())
|
||||
return;
|
||||
|
||||
@ -52,7 +52,7 @@ void CefRenderFrameObserver::DidCreateScriptContext(
|
||||
|
||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope scope(context);
|
||||
v8::MicrotasksScope microtasks_scope(isolate,
|
||||
@ -69,7 +69,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext(
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
|
||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
||||
if (browserPtr.get()) {
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
if (application.get()) {
|
||||
@ -78,7 +78,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext(
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
// The released context should not be used for script execution.
|
||||
|
@ -60,20 +60,20 @@ void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry(
|
||||
const Cef_CrossOriginWhiteListEntry_Params& params) {
|
||||
GURL gurl = GURL(params.source_origin);
|
||||
if (add) {
|
||||
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
|
||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
||||
gurl,
|
||||
blink::WebString::fromUTF8(params.target_protocol),
|
||||
blink::WebString::fromUTF8(params.target_domain),
|
||||
blink::WebString::FromUTF8(params.target_protocol),
|
||||
blink::WebString::FromUTF8(params.target_domain),
|
||||
params.allow_target_subdomains);
|
||||
} else {
|
||||
blink::WebSecurityPolicy::removeOriginAccessWhitelistEntry(
|
||||
blink::WebSecurityPolicy::RemoveOriginAccessWhitelistEntry(
|
||||
gurl,
|
||||
blink::WebString::fromUTF8(params.target_protocol),
|
||||
blink::WebString::fromUTF8(params.target_domain),
|
||||
blink::WebString::FromUTF8(params.target_protocol),
|
||||
blink::WebString::FromUTF8(params.target_domain),
|
||||
params.allow_target_subdomains);
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderThreadObserver::OnClearCrossOriginWhitelist() {
|
||||
blink::WebSecurityPolicy::resetOriginAccessWhitelists();
|
||||
blink::WebSecurityPolicy::ResetOriginAccessWhitelists();
|
||||
}
|
||||
|
@ -37,24 +37,24 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
|
||||
~CefWebURLLoaderClient() override;
|
||||
|
||||
// blink::WebURLLoaderClient methods.
|
||||
bool willFollowRedirect(
|
||||
bool WillFollowRedirect(
|
||||
WebURLRequest& newRequest,
|
||||
const WebURLResponse& redirectResponse) override;
|
||||
void didSendData(
|
||||
void DidSendData(
|
||||
unsigned long long bytesSent,
|
||||
unsigned long long totalBytesToBeSent) override;
|
||||
void didReceiveResponse(
|
||||
void DidReceiveResponse(
|
||||
const WebURLResponse& response) override;
|
||||
void didDownloadData(int dataLength,
|
||||
void DidDownloadData(int dataLength,
|
||||
int encodedDataLength) override;
|
||||
void didReceiveData(const char* data,
|
||||
void DidReceiveData(const char* data,
|
||||
int dataLength) override;
|
||||
void didReceiveCachedMetadata(const char* data,
|
||||
void DidReceiveCachedMetadata(const char* data,
|
||||
int dataLength) override;
|
||||
void didFinishLoading(double finishTime,
|
||||
void DidFinishLoading(double finishTime,
|
||||
int64_t totalEncodedDataLength,
|
||||
int64_t totalEncodedBodyLength) override;
|
||||
void didFail(const WebURLError& error,
|
||||
void DidFail(const WebURLError& error,
|
||||
int64_t totalEncodedDataLength,
|
||||
int64_t totalEncodedBodyLength) override;
|
||||
|
||||
@ -100,14 +100,14 @@ class CefRenderURLRequest::Context
|
||||
if (!url.is_valid())
|
||||
return false;
|
||||
|
||||
loader_.reset(blink::Platform::current()->createURLLoader());
|
||||
loader_.reset(blink::Platform::Current()->CreateURLLoader());
|
||||
url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags()));
|
||||
|
||||
WebURLRequest urlRequest;
|
||||
static_cast<CefRequestImpl*>(request_.get())->Get(urlRequest,
|
||||
upload_data_size_);
|
||||
|
||||
loader_->loadAsynchronously(urlRequest, url_client_.get());
|
||||
loader_->LoadAsynchronously(urlRequest, url_client_.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ class CefRenderURLRequest::Context
|
||||
error_code_ = ERR_ABORTED;
|
||||
|
||||
// Will result in a call to OnError().
|
||||
loader_->cancel();
|
||||
loader_->Cancel();
|
||||
}
|
||||
|
||||
void OnResponse(const WebURLResponse& response) {
|
||||
@ -134,7 +134,7 @@ class CefRenderURLRequest::Context
|
||||
responseImpl->Set(response);
|
||||
responseImpl->SetReadOnly(true);
|
||||
|
||||
download_data_total_ = response.expectedContentLength();
|
||||
download_data_total_ = response.ExpectedContentLength();
|
||||
}
|
||||
|
||||
void OnError(const WebURLError& error) {
|
||||
@ -244,29 +244,29 @@ CefWebURLLoaderClient::CefWebURLLoaderClient(
|
||||
CefWebURLLoaderClient::~CefWebURLLoaderClient() {
|
||||
}
|
||||
|
||||
bool CefWebURLLoaderClient::willFollowRedirect(
|
||||
bool CefWebURLLoaderClient::WillFollowRedirect(
|
||||
WebURLRequest& newRequest,
|
||||
const WebURLResponse& redirectResponse) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didSendData(
|
||||
void CefWebURLLoaderClient::DidSendData(
|
||||
unsigned long long bytesSent,
|
||||
unsigned long long totalBytesToBeSent) {
|
||||
if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS)
|
||||
context_->OnUploadProgress(bytesSent, totalBytesToBeSent);
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didReceiveResponse(
|
||||
void CefWebURLLoaderClient::DidReceiveResponse(
|
||||
const WebURLResponse& response) {
|
||||
context_->OnResponse(response);
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didDownloadData(int dataLength,
|
||||
void CefWebURLLoaderClient::DidDownloadData(int dataLength,
|
||||
int encodedDataLength) {
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didReceiveData(const char* data,
|
||||
void CefWebURLLoaderClient::DidReceiveData(const char* data,
|
||||
int dataLength) {
|
||||
context_->OnDownloadProgress(dataLength);
|
||||
|
||||
@ -274,17 +274,17 @@ void CefWebURLLoaderClient::didReceiveData(const char* data,
|
||||
context_->OnDownloadData(data, dataLength);
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didReceiveCachedMetadata(const char* data,
|
||||
void CefWebURLLoaderClient::DidReceiveCachedMetadata(const char* data,
|
||||
int dataLength) {
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didFinishLoading(double finishTime,
|
||||
void CefWebURLLoaderClient::DidFinishLoading(double finishTime,
|
||||
int64_t totalEncodedDataLength,
|
||||
int64_t totalEncodedBodyLength) {
|
||||
context_->OnComplete();
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::didFail(const WebURLError& error,
|
||||
void CefWebURLLoaderClient::DidFail(const WebURLError& error,
|
||||
int64_t totalEncodedDataLength,
|
||||
int64_t totalEncodedBodyLength) {
|
||||
context_->OnError(error);
|
||||
|
@ -290,7 +290,8 @@ public:
|
||||
base::ThreadLocalPointer<CefV8IsolateManager> current_tls_;
|
||||
};
|
||||
|
||||
base::LazyInstance<CefV8StateManager> g_v8_state = LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<CefV8StateManager>::Leaky g_v8_state =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
CefV8IsolateManager* GetIsolateManager() {
|
||||
return g_v8_state.Pointer()->GetIsolateManager();
|
||||
@ -1005,7 +1006,7 @@ CefRefPtr<CefBrowser> CefV8ContextImpl::GetBrowser() {
|
||||
|
||||
blink::WebFrame* webframe = GetWebFrame();
|
||||
if (webframe)
|
||||
browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->top());
|
||||
browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->Top());
|
||||
|
||||
return browser;
|
||||
}
|
||||
@ -1017,7 +1018,7 @@ CefRefPtr<CefFrame> CefV8ContextImpl::GetFrame() {
|
||||
blink::WebFrame* webframe = GetWebFrame();
|
||||
if (webframe) {
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(webframe->top());
|
||||
CefBrowserImpl::GetBrowserForMainFrame(webframe->Top());
|
||||
frame = browser->GetFrame(webkit_glue::GetIdentifier(webframe));
|
||||
}
|
||||
|
||||
@ -1116,8 +1117,8 @@ bool CefV8ContextImpl::Eval(const CefString& code,
|
||||
v8::Local<v8::Context> context = GetV8Context();
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
const blink::WebString& source = blink::WebString::fromUTF16(code);
|
||||
const blink::WebString& source_url = blink::WebString::fromUTF16(script_url);
|
||||
const blink::WebString& source = blink::WebString::FromUTF16(code);
|
||||
const blink::WebString& source_url = blink::WebString::FromUTF16(script_url);
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
@ -1125,7 +1126,7 @@ bool CefV8ContextImpl::Eval(const CefString& code,
|
||||
v8::MaybeLocal<v8::Value> func_rv =
|
||||
webkit_glue::ExecuteV8ScriptAndReturnValue(source, source_url, start_line,
|
||||
context, isolate, try_catch,
|
||||
blink::AccessControlStatus::NotSharableCrossOrigin);
|
||||
blink::AccessControlStatus::kNotSharableCrossOrigin);
|
||||
|
||||
if (try_catch.HasCaught()) {
|
||||
exception = new CefV8ExceptionImpl(context, try_catch.Message());
|
||||
@ -1152,7 +1153,7 @@ blink::WebFrame* CefV8ContextImpl::GetWebFrame() {
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Local<v8::Context> context = GetV8Context();
|
||||
v8::Context::Scope context_scope(context);
|
||||
return blink::WebLocalFrame::frameForContext(context);
|
||||
return blink::WebLocalFrame::FrameForContext(context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ MSVC_POP_WARNING();
|
||||
#undef LOG
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/renderer/render_frame_impl.h"
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
@ -50,45 +50,45 @@ bool CanGoBack(blink::WebView* view) {
|
||||
if (!view)
|
||||
return false;
|
||||
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
||||
return (impl->client()->historyBackListCount() > 0);
|
||||
return (impl->Client()->HistoryBackListCount() > 0);
|
||||
}
|
||||
|
||||
bool CanGoForward(blink::WebView* view) {
|
||||
if (!view)
|
||||
return false;
|
||||
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
||||
return (impl->client()->historyForwardListCount() > 0);
|
||||
return (impl->Client()->HistoryForwardListCount() > 0);
|
||||
}
|
||||
|
||||
void GoBack(blink::WebView* view) {
|
||||
if (!view)
|
||||
return;
|
||||
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
||||
if (impl->client()->historyBackListCount() > 0)
|
||||
impl->client()->navigateBackForwardSoon(-1);
|
||||
if (impl->Client()->HistoryBackListCount() > 0)
|
||||
impl->Client()->NavigateBackForwardSoon(-1);
|
||||
}
|
||||
|
||||
void GoForward(blink::WebView* view) {
|
||||
if (!view)
|
||||
return;
|
||||
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
||||
if (impl->client()->historyForwardListCount() > 0)
|
||||
impl->client()->navigateBackForwardSoon(1);
|
||||
if (impl->Client()->HistoryForwardListCount() > 0)
|
||||
impl->Client()->NavigateBackForwardSoon(1);
|
||||
}
|
||||
|
||||
std::string DumpDocumentText(blink::WebFrame* frame) {
|
||||
// We use the document element's text instead of the body text here because
|
||||
// not all documents have a body, such as XML documents.
|
||||
blink::WebElement document_element = frame->document().documentElement();
|
||||
if (document_element.isNull())
|
||||
blink::WebElement document_element = frame->GetDocument().DocumentElement();
|
||||
if (document_element.IsNull())
|
||||
return std::string();
|
||||
|
||||
blink::Element* web_element = document_element.unwrap<blink::Element>();
|
||||
return blink::WebString(web_element->innerText()).utf8();
|
||||
blink::Element* web_element = document_element.Unwrap<blink::Element>();
|
||||
return blink::WebString(web_element->innerText()).Utf8();
|
||||
}
|
||||
|
||||
cef_dom_node_type_t GetNodeType(const blink::WebNode& node) {
|
||||
const blink::Node* web_node = node.constUnwrap<blink::Node>();
|
||||
const blink::Node* web_node = node.ConstUnwrap<blink::Node>();
|
||||
switch (web_node->getNodeType()) {
|
||||
case blink::Node::kElementNode:
|
||||
return DOM_NODE_TYPE_ELEMENT;
|
||||
@ -113,17 +113,17 @@ cef_dom_node_type_t GetNodeType(const blink::WebNode& node) {
|
||||
}
|
||||
|
||||
blink::WebString GetNodeName(const blink::WebNode& node) {
|
||||
const blink::Node* web_node = node.constUnwrap<blink::Node>();
|
||||
const blink::Node* web_node = node.ConstUnwrap<blink::Node>();
|
||||
return web_node->nodeName();
|
||||
}
|
||||
|
||||
blink::WebString CreateNodeMarkup(const blink::WebNode& node) {
|
||||
const blink::Node* web_node = node.constUnwrap<blink::Node>();
|
||||
return blink::createMarkup(web_node);
|
||||
const blink::Node* web_node = node.ConstUnwrap<blink::Node>();
|
||||
return blink::CreateMarkup(web_node);
|
||||
}
|
||||
|
||||
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
|
||||
blink::Node* web_node = node.unwrap<blink::Node>();
|
||||
blink::Node* web_node = node.Unwrap<blink::Node>();
|
||||
web_node->setNodeValue(value);
|
||||
return true;
|
||||
}
|
||||
@ -139,30 +139,13 @@ int64_t GetIdentifier(blink::WebFrame* frame) {
|
||||
return kInvalidFrameId;
|
||||
}
|
||||
|
||||
// Based on WebViewImpl::findFrameByName and FrameTree::find.
|
||||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||
blink::WebFrame* relative_to_frame) {
|
||||
blink::Frame* start_frame = toWebLocalFrameImpl(relative_to_frame)->frame();
|
||||
if (!start_frame)
|
||||
return NULL;
|
||||
|
||||
const AtomicString& atomic_name = unique_name;
|
||||
blink::Frame* found_frame = NULL;
|
||||
|
||||
// Search the subtree starting with |start_frame|.
|
||||
for (blink::Frame* frame = start_frame;
|
||||
frame;
|
||||
frame = frame->tree().traverseNext(start_frame)) {
|
||||
if (frame->tree().uniqueName() == atomic_name) {
|
||||
found_frame = frame;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_frame && found_frame->isLocalFrame())
|
||||
return blink::WebLocalFrameImpl::fromFrame(toLocalFrame(found_frame));
|
||||
|
||||
return NULL;
|
||||
std::string GetUniqueName(blink::WebFrame* frame) {
|
||||
content::RenderFrameImpl* render_frame =
|
||||
content::RenderFrameImpl::FromWebFrame(frame);
|
||||
DCHECK(render_frame);
|
||||
if (render_frame)
|
||||
return render_frame->unique_name();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
||||
@ -175,21 +158,20 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
||||
|
||||
// Execute the function call using the V8ScriptRunner so that inspector
|
||||
// instrumentation works.
|
||||
blink::LocalFrame* frame =
|
||||
toLocalFrame(blink::toFrameIfNotDetached(context));
|
||||
blink::LocalFrame* frame = blink::ToLocalFrameIfNotDetached(context);
|
||||
DCHECK(frame);
|
||||
if (frame &&
|
||||
frame->document()->canExecuteScripts(blink::AboutToExecuteScript)) {
|
||||
func_rv = blink::V8ScriptRunner::callFunction(
|
||||
function, frame->document(), receiver, argc, args, isolate);
|
||||
frame->GetDocument()->CanExecuteScripts(blink::kAboutToExecuteScript)) {
|
||||
func_rv = blink::V8ScriptRunner::CallFunction(
|
||||
function, frame->GetDocument(), receiver, argc, args, isolate);
|
||||
}
|
||||
|
||||
return func_rv;
|
||||
}
|
||||
|
||||
bool IsTextControlElement(const blink::WebElement& element) {
|
||||
const blink::Element* web_element = element.constUnwrap<blink::Element>();
|
||||
return web_element->isTextControl();
|
||||
const blink::Element* web_element = element.ConstUnwrap<blink::Element>();
|
||||
return web_element->IsTextControl();
|
||||
}
|
||||
|
||||
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||
@ -206,51 +188,50 @@ v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||
if (start_line < 1)
|
||||
start_line = 1;
|
||||
|
||||
const blink::KURL kurl = source_url.isEmpty() ?
|
||||
blink::KURL() : blink::KURL(blink::ParsedURLString, source_url);
|
||||
const blink::KURL kurl = source_url.IsEmpty() ?
|
||||
blink::KURL() : blink::KURL(blink::kParsedURLString, source_url);
|
||||
|
||||
const blink::ScriptSourceCode ssc = blink::ScriptSourceCode(source, kurl,
|
||||
WTF::TextPosition(WTF::OrdinalNumber::fromOneBasedInt(start_line),
|
||||
WTF::OrdinalNumber::fromZeroBasedInt(0)));
|
||||
WTF::TextPosition(WTF::OrdinalNumber::FromOneBasedInt(start_line),
|
||||
WTF::OrdinalNumber::FromZeroBasedInt(0)));
|
||||
|
||||
v8::MaybeLocal<v8::Value> result;
|
||||
|
||||
blink::LocalFrame* frame =
|
||||
toLocalFrame(blink::toFrameIfNotDetached(context));
|
||||
blink::LocalFrame* frame = blink::ToLocalFrameIfNotDetached(context);
|
||||
DCHECK(frame);
|
||||
|
||||
if (frame) {
|
||||
blink::V8CacheOptions v8CacheOptions(blink::V8CacheOptionsDefault);
|
||||
if (frame && frame->settings())
|
||||
v8CacheOptions = frame->settings()->getV8CacheOptions();
|
||||
blink::V8CacheOptions v8CacheOptions(blink::kV8CacheOptionsDefault);
|
||||
if (frame && frame->GetSettings())
|
||||
v8CacheOptions = frame->GetSettings()->GetV8CacheOptions();
|
||||
|
||||
v8::Local<v8::Script> script;
|
||||
if (!blink::v8Call(blink::V8ScriptRunner::compileScript(ssc, isolate,
|
||||
if (!blink::V8Call(blink::V8ScriptRunner::CompileScript(ssc, isolate,
|
||||
accessControlStatus, v8CacheOptions), script, tryCatch)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = blink::V8ScriptRunner::runCompiledScript(isolate, script,
|
||||
blink::toExecutionContext(context));
|
||||
result = blink::V8ScriptRunner::RunCompiledScript(isolate, script,
|
||||
blink::ToExecutionContext(context));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsScriptForbidden() {
|
||||
return blink::ScriptForbiddenScope::isScriptForbidden();
|
||||
return blink::ScriptForbiddenScope::IsScriptForbidden();
|
||||
}
|
||||
|
||||
void registerURLSchemeAsLocal(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::registerURLSchemeAsLocal(scheme);
|
||||
void RegisterURLSchemeAsLocal(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsLocal(scheme);
|
||||
}
|
||||
|
||||
void registerURLSchemeAsSecure(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::registerURLSchemeAsSecure(scheme);
|
||||
void RegisterURLSchemeAsSecure(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsSecure(scheme);
|
||||
}
|
||||
|
||||
void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme);
|
||||
void RegisterURLSchemeAsCORSEnabled(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(scheme);
|
||||
}
|
||||
|
||||
} // webkit_glue
|
||||
|
@ -41,11 +41,7 @@ blink::WebString CreateNodeMarkup(const blink::WebNode& node);
|
||||
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value);
|
||||
|
||||
int64_t GetIdentifier(blink::WebFrame* frame);
|
||||
|
||||
// Find the frame with the specified |unique_name| relative to
|
||||
// |relative_to_frame| in the frame hierarchy.
|
||||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||
blink::WebFrame* relative_to_frame);
|
||||
std::string GetUniqueName(blink::WebFrame* frame);
|
||||
|
||||
bool IsTextControlElement(const blink::WebElement& element);
|
||||
|
||||
@ -67,9 +63,9 @@ v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||
|
||||
bool IsScriptForbidden();
|
||||
|
||||
void registerURLSchemeAsLocal(const blink::WebString& scheme);
|
||||
void registerURLSchemeAsSecure(const blink::WebString& scheme);
|
||||
void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme);
|
||||
void RegisterURLSchemeAsLocal(const blink::WebString& scheme);
|
||||
void RegisterURLSchemeAsSecure(const blink::WebString& scheme);
|
||||
void RegisterURLSchemeAsCORSEnabled(const blink::WebString& scheme);
|
||||
|
||||
} // webkit_glue
|
||||
|
||||
|
@ -68,15 +68,12 @@ patches = [
|
||||
#
|
||||
# Support creation of captionless windows with resizable borders.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1749
|
||||
#
|
||||
# Remove console spam from RenderWidgetHostViewBase::IsInVR.
|
||||
# https://codereview.chromium.org/2822223002
|
||||
'name': 'views_widget_180_1481_1565_1677_1749',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Allow continued use of ContentRendererClient::HandleNavigation.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1129
|
||||
'name': 'content_nav_1129',
|
||||
'path': '../content/',
|
||||
},
|
||||
{
|
||||
# Allow specification of a custom WebContentsView.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1257
|
||||
@ -152,10 +149,13 @@ patches = [
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Split service_manager::Main into the separate steps required by CEF.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=654986#c17
|
||||
#
|
||||
# Remove DCHECK on Linux when initialized CEF from a non-main thread.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issue/1639
|
||||
'name': 'process_title_1639',
|
||||
'path': '../content/common/',
|
||||
'name': 'service_manager_654986',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Fix rendering of the PDF extension with OSR when the device scale factor
|
||||
@ -206,8 +206,20 @@ patches = [
|
||||
# Modify views::View to extend SupportsUserData.
|
||||
# Modify views::MenuButton behavior.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1749
|
||||
#
|
||||
# Don't add TestDesktopScreenX11 dependency on Linux.
|
||||
# Reverts ui_controls_factory_desktop_aurax11.cc changes from
|
||||
# https://codereview.chromium.org/2327623002
|
||||
#
|
||||
# Add InkDropHostView::ink_drop_mode method.
|
||||
# Reverts ink_drop_host_view.h changes from
|
||||
# https://codereview.chromium.org/2723843002
|
||||
#
|
||||
# Make LabelButton::SetFontList method public.
|
||||
# Reverts label_button.h changes from
|
||||
# https://codereview.chromium.org/2793283002
|
||||
'name': 'views_1749',
|
||||
'path': '../ui/views/',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Expose RenderViewHostImpl swapped-out state.
|
||||
@ -248,13 +260,6 @@ patches = [
|
||||
'name': 'storage_partition_1973',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Don't add TestDesktopScreenX11 dependency on Linux.
|
||||
# Revert ui_controls_factory_desktop_aurax11.cc changes from
|
||||
# https://codereview.chromium.org/2327623002
|
||||
'name': 'ui_views_test_640741',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Fix plugin placeholder blocked message.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2020/
|
||||
@ -293,9 +298,6 @@ patches = [
|
||||
#
|
||||
# Implement better rate-limiting/retry logic.
|
||||
# https://bugs.chromium.org/p/crashpad/issues/detail?id=23
|
||||
#
|
||||
# Windows: Support crash upload URLs with query component.
|
||||
# https://bugs.chromium.org/p/crashpad/issues/detail?id=163
|
||||
'name': 'crashpad_tp_1995',
|
||||
'path': '../third_party/crashpad/',
|
||||
},
|
||||
@ -306,18 +308,25 @@ patches = [
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Allow continued use of ContentRendererClient::HandleNavigation.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/1129
|
||||
#
|
||||
# Pass is_main_frame to PluginServiceFilter::IsPluginAvailable.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2015
|
||||
#
|
||||
# Pass the render process id to PluginServiceFilter::IsPluginAvailable.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=626728#c15
|
||||
'name': 'plugin_info_2015',
|
||||
#
|
||||
# Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on
|
||||
# network error.
|
||||
# https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ
|
||||
'name': 'content_1129_2015',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Pass is_main_frame to PluginServiceFilter::IsPluginAvailable.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2015
|
||||
'name': 'plugin_info_webkit_2015',
|
||||
'name': 'webkit_plugin_info_2015',
|
||||
'path': '../third_party/WebKit/',
|
||||
},
|
||||
{
|
||||
@ -328,10 +337,15 @@ patches = [
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on
|
||||
# network error.
|
||||
# https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ
|
||||
'name': 'navigation_handle',
|
||||
# Mac: Fix build error when including openssl/opensslconf.h.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=711670
|
||||
'name': 'mac_build_711670',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Linux: Remove DCHECK during GPU feature info detection.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=699278
|
||||
'name': 'gpu_feature_info_699278',
|
||||
'path': '../',
|
||||
},
|
||||
]
|
||||
|
@ -1,8 +1,8 @@
|
||||
diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
|
||||
index d0ecb71..84c20b4 100644
|
||||
index 1c73b7f..606f29c 100644
|
||||
--- content/browser/renderer_host/browser_compositor_view_mac.h
|
||||
+++ content/browser/renderer_host/browser_compositor_view_mac.h
|
||||
@@ -56,9 +56,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver,
|
||||
@@ -51,9 +51,11 @@ class BrowserCompositorMac : public DelegatedFrameHostClient {
|
||||
|
||||
// These will not return nullptr until Destroy is called.
|
||||
DelegatedFrameHost* GetDelegatedFrameHost();
|
||||
@ -13,12 +13,12 @@ index d0ecb71..84c20b4 100644
|
||||
+ ui::Compositor* GetCompositor();
|
||||
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac();
|
||||
|
||||
void SwapCompositorFrame(uint32_t compositor_frame_sink_id,
|
||||
void DidCreateNewRendererCompositorFrameSink(
|
||||
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||
index e4c25e73..e2f789e 100644
|
||||
index fba983b..8cf9629 100644
|
||||
--- content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||
@@ -201,6 +201,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
|
||||
@@ -202,6 +202,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
|
||||
g_spare_recyclable_compositors.Get().clear();
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ index e4c25e73..e2f789e 100644
|
||||
ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() {
|
||||
if (recyclable_compositor_)
|
||||
return recyclable_compositor_->accelerated_widget_mac();
|
||||
@@ -417,8 +423,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor(
|
||||
@@ -421,8 +427,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor(
|
||||
}
|
||||
|
||||
gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const {
|
||||
|
@ -1,5 +1,5 @@
|
||||
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
|
||||
index 2197f73a..ab100b6 100644
|
||||
index fc720a7..1c30365 100644
|
||||
--- render_widget_host_view_guest.cc
|
||||
+++ render_widget_host_view_guest.cc
|
||||
@@ -247,13 +247,14 @@ void RenderWidgetHostViewGuest::Destroy() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user