Update to Chromium revision ff259bab (#488528)

This commit is contained in:
Marshall Greenblatt 2017-07-26 19:19:27 -04:00
parent 6da2bbf229
commit f229796a39
416 changed files with 2724 additions and 2213 deletions

View File

@ -277,6 +277,7 @@ source_set("webkit_set") {
deps = [ deps = [
"//skia", "//skia",
"//third_party/icu", "//third_party/icu",
"//third_party/boringssl",
"//v8", "//v8",
] ]
} }
@ -704,6 +705,7 @@ static_library("libcef_static") {
"//components/keyed_service/content:content", "//components/keyed_service/content:content",
"//components/keyed_service/core:core", "//components/keyed_service/core:core",
"//components/navigation_interception", "//components/navigation_interception",
"//components/network_session_configurator/common",
"//components/pdf/browser", "//components/pdf/browser",
"//components/pdf/renderer", "//components/pdf/renderer",
"//components/plugins/renderer", "//components/plugins/renderer",
@ -723,7 +725,7 @@ static_library("libcef_static") {
"//components/visitedlink/browser", "//components/visitedlink/browser",
"//components/visitedlink/common", "//components/visitedlink/common",
"//components/visitedlink/renderer", "//components/visitedlink/renderer",
"//components/viz/display_compositor", "//components/viz/service",
"//components/web_cache/renderer", "//components/web_cache/renderer",
"//content/public/app:both", "//content/public/app:both",
"//content/public/browser", "//content/public/browser",
@ -842,7 +844,7 @@ static_library("libcef_static") {
deps += [ deps += [
"//build/config/freetype", "//build/config/freetype",
"//build/linux:fontconfig", "//third_party/fontconfig",
] ]
} }
@ -957,6 +959,7 @@ static_library("libcef_static") {
"//ui/events", "//ui/events",
"//ui/strings", "//ui/strings",
"//ui/wm", "//ui/wm",
"//ui/wm/public",
] ]
if (toolkit_views) { if (toolkit_views) {

View File

@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{ {
'chromium_checkout': 'd483fb7716e28b377c70c26c1bf1e3695aa1d8c9', 'chromium_checkout': 'ff259bab28b35d242e10186cd63af7ed404fae0d',
} }

View File

@ -39,14 +39,49 @@
#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ #define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
#pragma once #pragma once
#if defined(BASE_ATOMIC_REF_COUNT_H_) #if defined(USING_CHROMIUM_INCLUDES)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly. // When building CEF include the Chromium header directly.
#include "base/atomic_ref_count.h" #include "base/atomic_ref_count.h"
// Used when declaring a base::AtomicRefCount value. This is an object type with
// Chromium headers.
#define ATOMIC_DECLARATION (0)
// Maintaining compatibility with AtompicRefCount* functions that were removed
// from Chromium in http://crrev.com/ee96d561.
namespace base {
// Increment a reference count by 1.
inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) {
const_cast<AtomicRefCount*>(ptr)->Increment();
}
// Decrement a reference count by 1 and return whether the result is non-zero.
// Insert barriers to ensure that state written before the reference count
// became zero will be visible to a thread that has just made the count zero.
inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->Decrement();
}
// Return whether the reference count is one. If the reference count is used
// in the conventional way, a refrerence count of 1 implies that the current
// thread owns the reference and no other thread shares it. This call performs
// the test for a reference count of one, and performs the memory barrier
// needed for the owning thread to act on the object, knowing that it has
// exclusive access to the object.
inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->IsOne();
}
// Return whether the reference count is zero. With conventional object
// referencing counting, the object will be destroyed, so the reference count
// should never be zero. Hence this is generally used for a debug check.
inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->IsZero();
}
} // namespace base
#else // !USING_CHROMIUM_INCLUDES #else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation. // The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be // If the Chromium implementation diverges the below implementation should be
@ -58,6 +93,10 @@
#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ #define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */ #define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
// Used when declaring a base::AtomicRefCount value. This is an integer/ptr type
// with CEF headers.
#define ATOMIC_DECLARATION = 0
namespace base { namespace base {
typedef subtle::Atomic32 AtomicRefCount; typedef subtle::Atomic32 AtomicRefCount;

View File

@ -1916,12 +1916,7 @@ typedef struct _cef_popup_features_t {
int menuBarVisible; int menuBarVisible;
int statusBarVisible; int statusBarVisible;
int toolBarVisible; int toolBarVisible;
int locationBarVisible;
int scrollbarsVisible; int scrollbarsVisible;
int resizable;
int fullscreen;
int dialog;
} cef_popup_features_t; } cef_popup_features_t;
/// ///
@ -2463,42 +2458,61 @@ typedef enum {
// Policy for how the Referrer HTTP header value will be sent during navigation. // Policy for how the Referrer HTTP header value will be sent during navigation.
// If the `--no-referrers` command-line flag is specified then the policy value // If the `--no-referrers` command-line flag is specified then the policy value
// will be ignored and the Referrer value will never be sent. // will be ignored and the Referrer value will never be sent.
// Must be kept synchronized with net::URLRequest::ReferrerPolicy from Chromium.
/// ///
typedef enum { typedef enum {
/// ///
// Always send the complete Referrer value. // Clear the referrer header if the header value is HTTPS but the request
// destination is HTTP. This is the default behavior.
/// ///
REFERRER_POLICY_ALWAYS, REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
REFERRER_POLICY_DEFAULT =
REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
/// ///
// Use the default policy. This is REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN // A slight variant on CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
// when the `--reduced-referrer-granularity` command-line flag is specified // If the request destination is HTTP, an HTTPS referrer will be cleared. If
// and REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE otherwise. // the request's destination is cross-origin with the referrer (but does not
// // downgrade), the referrer's granularity will be stripped down to an origin
// rather than a full URL. Same-origin requests will send the full referrer.
/// ///
REFERRER_POLICY_DEFAULT, REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN,
/// ///
// When navigating from HTTPS to HTTP do not send the Referrer value. // Strip the referrer down to an origin when the origin of the referrer is
// Otherwise, send the complete Referrer value. // different from the destination's origin.
/// ///
REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE, REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN,
/// ///
// Never send the Referrer value. // Never change the referrer.
/// ///
REFERRER_POLICY_NEVER, REFERRER_POLICY_NEVER_CLEAR_REFERRER,
/// ///
// Only send the origin component of the Referrer value. // Strip the referrer down to the origin regardless of the redirect location.
/// ///
REFERRER_POLICY_ORIGIN, REFERRER_POLICY_ORIGIN,
/// ///
// When navigating cross-origin only send the origin component of the Referrer // Clear the referrer when the request's referrer is cross-origin with the
// value. Otherwise, send the complete Referrer value. // request's destination.
/// ///
REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN, REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_CROSS_ORIGIN,
///
// Strip the referrer down to the origin, but clear it entirely if the
// referrer value is HTTPS and the destination is HTTP.
///
REFERRER_POLICY_ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
///
// Always clear the referrer regardless of the request destination.
///
REFERRER_POLICY_NO_REFERRER,
// Always the last value in this enumeration.
REFERRER_POLICY_LAST_VALUE,
} cef_referrer_policy_t; } cef_referrer_policy_t;
/// ///

View File

@ -488,9 +488,7 @@ struct CefPopupFeaturesTraits {
s->menuBarVisible = true; s->menuBarVisible = true;
s->statusBarVisible = true; s->statusBarVisible = true;
s->toolBarVisible = true; s->toolBarVisible = true;
s->locationBarVisible = true;
s->scrollbarsVisible = true; s->scrollbarsVisible = true;
s->resizable = true;
} }
static inline void clear(struct_type* s) {} static inline void clear(struct_type* s) {}
@ -509,11 +507,7 @@ struct CefPopupFeaturesTraits {
target->menuBarVisible = src->menuBarVisible; target->menuBarVisible = src->menuBarVisible;
target->statusBarVisible = src->statusBarVisible; target->statusBarVisible = src->statusBarVisible;
target->toolBarVisible = src->toolBarVisible; target->toolBarVisible = src->toolBarVisible;
target->locationBarVisible = src->locationBarVisible;
target->scrollbarsVisible = src->scrollbarsVisible; target->scrollbarsVisible = src->scrollbarsVisible;
target->resizable = src->resizable;
target->fullscreen = src->fullscreen;
target->dialog = src->dialog;
} }
}; };

View File

@ -427,6 +427,11 @@ CefBrowserContextImpl::GetBackgroundSyncController() {
return nullptr; return nullptr;
} }
content::BrowsingDataRemoverDelegate*
CefBrowserContextImpl::GetBrowsingDataRemoverDelegate() {
return nullptr;
}
net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext( net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) { content::URLRequestInterceptorScopedVector request_interceptors) {
@ -453,7 +458,6 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
url_request_getter_ = new CefURLRequestContextGetterImpl( url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_, GetPrefs(), settings_, GetPrefs(),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
protocol_handlers, std::move(proxy_config_service), protocol_handlers, std::move(proxy_config_service),
std::move(request_interceptors)); std::move(request_interceptors));
resource_context()->set_url_request_context_getter(url_request_getter_.get()); resource_context()->set_url_request_context_getter(url_request_getter_.get());

View File

@ -69,6 +69,8 @@ class CefBrowserContextImpl : public CefBrowserContext,
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override; content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override; content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
override;
net::URLRequestContextGetter* CreateRequestContext( net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override; content::URLRequestInterceptorScopedVector request_interceptors) override;

View File

@ -161,6 +161,11 @@ CefBrowserContextProxy::GetBackgroundSyncController() {
return parent_->GetBackgroundSyncController(); return parent_->GetBackgroundSyncController();
} }
content::BrowsingDataRemoverDelegate*
CefBrowserContextProxy::GetBrowsingDataRemoverDelegate() {
return parent_->GetBrowsingDataRemoverDelegate();
}
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext( net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) { content::URLRequestInterceptorScopedVector request_interceptors) {

View File

@ -44,6 +44,8 @@ class CefBrowserContextProxy : public CefBrowserContext {
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override; content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override; content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
override;
net::URLRequestContextGetter* CreateRequestContext( net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override; content::URLRequestInterceptorScopedVector request_interceptors) override;

View File

@ -65,6 +65,7 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_request_info.h"
#include "content/public/common/favicon_url.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "third_party/WebKit/public/web/WebFindOptions.h" #include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/events/base_event_utils.h" #include "ui/events/base_event_utils.h"
@ -700,7 +701,7 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
std::unique_ptr<content::DownloadUrlParameters> params( std::unique_ptr<content::DownloadUrlParameters> params(
content::DownloadUrlParameters::CreateForWebContentsMainFrame( content::DownloadUrlParameters::CreateForWebContentsMainFrame(
web_contents(), gurl)); web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET));
manager->DownloadUrl(std::move(params)); manager->DownloadUrl(std::move(params));
} }
@ -1526,7 +1527,9 @@ void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
request.method = params.method; request.method = params.method;
request.referrer = params.referrer.url; request.referrer = params.referrer.url;
request.referrer_policy = params.referrer.policy; request.referrer_policy =
CefRequestImpl::BlinkReferrerPolicyToNetReferrerPolicy(
params.referrer.policy);
request.frame_id = params.frame_id; request.frame_id = params.frame_id;
request.first_party_for_cookies = params.first_party_for_cookies; request.first_party_for_cookies = params.first_party_for_cookies;
request.headers = params.headers; request.headers = params.headers;
@ -2305,8 +2308,7 @@ void CefBrowserHostImpl::WebContentsCreated(
int opener_render_frame_id, int opener_render_frame_id,
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
content::WebContents* new_contents, content::WebContents* new_contents) {
const base::Optional<content::WebContents::CreateParams>& create_params) {
CefBrowserSettings settings; CefBrowserSettings settings;
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate; std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
@ -2673,7 +2675,7 @@ void CefBrowserHostImpl::DidUpdateFaviconURL(
std::vector<CefString> icon_urls; std::vector<CefString> icon_urls;
std::vector<content::FaviconURL>::const_iterator it = candidates.begin(); std::vector<content::FaviconURL>::const_iterator it = candidates.begin();
for (; it != candidates.end(); ++it) { for (; it != candidates.end(); ++it) {
if (it->icon_type == content::FaviconURL::FAVICON) if (it->icon_type == content::FaviconURL::IconType::kFavicon)
icon_urls.push_back(it->icon_url.spec()); icon_urls.push_back(it->icon_url.spec());
} }
if (!icon_urls.empty()) if (!icon_urls.empty())
@ -2736,7 +2738,8 @@ void CefBrowserHostImpl::AccessibilityLocationChangesReceived(
} }
} }
void CefBrowserHostImpl::OnWebContentsFocused() { void CefBrowserHostImpl::OnWebContentsFocused(
content::RenderWidgetHost* render_widget_host) {
if (client_.get()) { if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler(); CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
if (handler.get()) if (handler.get())

View File

@ -35,7 +35,7 @@
namespace content { namespace content {
struct DragEventSourceInfo; struct DragEventSourceInfo;
class RenderWidgetHostImpl; class RenderWidgetHostImpl;
} } // namespace content
namespace net { namespace net {
class URLRequest; class URLRequest;
@ -412,15 +412,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
int opener_render_frame_id, int opener_render_frame_id,
content::WebContentsView** view, content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override; content::RenderViewHostDelegateView** delegate_view) override;
void WebContentsCreated( void WebContentsCreated(content::WebContents* source_contents,
content::WebContents* source_contents, int opener_render_process_id,
int opener_render_process_id, int opener_render_frame_id,
int opener_render_frame_id, const std::string& frame_name,
const std::string& frame_name, const GURL& target_url,
const GURL& target_url, content::WebContents* new_contents) override;
content::WebContents* new_contents,
const base::Optional<content::WebContents::CreateParams>& create_params)
override;
void DidNavigateMainFramePostCommit( void DidNavigateMainFramePostCommit(
content::WebContents* web_contents) override; content::WebContents* web_contents) override;
content::JavaScriptDialogManager* GetJavaScriptDialogManager( content::JavaScriptDialogManager* GetJavaScriptDialogManager(
@ -484,7 +481,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
const std::vector<content::AXLocationChangeNotificationDetails>& locData) const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override; override;
void OnWebContentsFocused() override; void OnWebContentsFocused(
content::RenderWidgetHost* render_widget_host) override;
// Override to provide a thread safe implementation. // Override to provide a thread safe implementation.
bool Send(IPC::Message* message) override; bool Send(IPC::Message* message) override;

View File

@ -37,12 +37,7 @@ void TranslatePopupFeatures(const blink::mojom::WindowFeatures& webKitFeatures,
features.menuBarVisible = webKitFeatures.menu_bar_visible; features.menuBarVisible = webKitFeatures.menu_bar_visible;
features.statusBarVisible = webKitFeatures.status_bar_visible; features.statusBarVisible = webKitFeatures.status_bar_visible;
features.toolBarVisible = webKitFeatures.tool_bar_visible; features.toolBarVisible = webKitFeatures.tool_bar_visible;
features.locationBarVisible = webKitFeatures.location_bar_visible;
features.scrollbarsVisible = webKitFeatures.scrollbars_visible; features.scrollbarsVisible = webKitFeatures.scrollbars_visible;
features.resizable = webKitFeatures.resizable;
features.fullscreen = webKitFeatures.fullscreen;
features.dialog = webKitFeatures.dialog;
} }
CefBrowserInfoManager* g_info_manager = nullptr; CefBrowserInfoManager* g_info_manager = nullptr;
@ -112,11 +107,11 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
PendingNewBrowserInfoList::iterator it = PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin(); pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) { for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it; PendingNewBrowserInfo* info = it->get();
if (info->render_process_id == render_process_id && if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id && info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) { info->render_frame_routing_id == render_frame_routing_id) {
SendNewBrowserInfoResponse(render_process_id, browser_info.get(), false, SendNewBrowserInfoResponse(render_process_id, browser_info, false,
info->reply_msg); info->reply_msg);
pending_new_browser_info_list_.erase(it); pending_new_browser_info_list_.erase(it);
@ -304,8 +299,8 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
if (browser_info.get()) { if (browser_info.get()) {
// Send the response immediately. // Send the response immediately.
SendNewBrowserInfoResponse(render_process_id, browser_info.get(), SendNewBrowserInfoResponse(render_process_id, browser_info, is_guest_view,
is_guest_view, reply_msg); reply_msg);
return; return;
} }
@ -315,7 +310,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
PendingNewBrowserInfoList::const_iterator it = PendingNewBrowserInfoList::const_iterator it =
pending_new_browser_info_list_.begin(); pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) { for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it; PendingNewBrowserInfo* info = it->get();
if (info->render_process_id == render_process_id && if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id && info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) { info->render_frame_routing_id == render_frame_routing_id) {
@ -416,7 +411,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
PendingNewBrowserInfoList::iterator it = PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin(); pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_list_.end()) { while (it != pending_new_browser_info_list_.end()) {
PendingNewBrowserInfo* info = *it; PendingNewBrowserInfo* info = it->get();
if (info->render_process_id == render_process_id) if (info->render_process_id == render_process_id)
it = pending_new_browser_info_list_.erase(it); it = pending_new_browser_info_list_.erase(it);
else else
@ -428,7 +423,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
{ {
PendingPopupList::iterator it = pending_popup_list_.begin(); PendingPopupList::iterator it = pending_popup_list_.begin();
while (it != pending_popup_list_.end()) { while (it != pending_popup_list_.end()) {
PendingPopup* popup = *it; PendingPopup* popup = it->get();
if (popup->opener_process_id == render_process_id) { if (popup->opener_process_id == render_process_id) {
it = pending_popup_list_.erase(it); it = pending_popup_list_.erase(it);
} else { } else {
@ -455,11 +450,13 @@ CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step step,
PendingPopupList::iterator it = pending_popup_list_.begin(); PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) { for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = *it; PendingPopup* popup = it->get();
if (popup->step == step && popup->opener_process_id == opener_process_id && if (popup->step == step && popup->opener_process_id == opener_process_id &&
popup->opener_frame_id == opener_frame_id && popup->opener_frame_id == opener_frame_id &&
popup->target_url == target_url) { popup->target_url == target_url) {
pending_popup_list_.weak_erase(it); // Transfer ownership of the pointer.
it->release();
pending_popup_list_.erase(it);
return base::WrapUnique(popup); return base::WrapUnique(popup);
} }
} }
@ -525,7 +522,7 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
// static // static
void CefBrowserInfoManager::SendNewBrowserInfoResponse( void CefBrowserInfoManager::SendNewBrowserInfoResponse(
int render_process_id, int render_process_id,
CefBrowserInfo* browser_info, scoped_refptr<CefBrowserInfo> browser_info,
bool is_guest_view, bool is_guest_view,
IPC::Message* reply_msg) { IPC::Message* reply_msg) {
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {

View File

@ -9,10 +9,11 @@
#include "include/cef_client.h" #include "include/cef_client.h"
#include <list> #include <list>
#include <memory>
#include <vector>
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include "base/memory/scoped_vector.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_process_host_observer.h"
#include "third_party/WebKit/public/web/window_features.mojom.h" #include "third_party/WebKit/public/web/window_features.mojom.h"
@ -29,7 +30,7 @@ class RenderFrameHost;
class RenderViewHostDelegateView; class RenderViewHostDelegateView;
class WebContents; class WebContents;
class WebContentsView; class WebContentsView;
} } // namespace content
namespace IPC { namespace IPC {
class Message; class Message;
@ -184,10 +185,11 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
bool* is_guest_view); bool* is_guest_view);
// Send the response for a pending OnGetNewBrowserInfo request. // Send the response for a pending OnGetNewBrowserInfo request.
static void SendNewBrowserInfoResponse(int render_process_id, static void SendNewBrowserInfoResponse(
CefBrowserInfo* browser_info, int render_process_id,
bool is_guest_view, scoped_refptr<CefBrowserInfo> browser_info,
IPC::Message* reply_msg); bool is_guest_view,
IPC::Message* reply_msg);
// Pending request for OnGetNewBrowserInfo. // Pending request for OnGetNewBrowserInfo.
struct PendingNewBrowserInfo { struct PendingNewBrowserInfo {
@ -204,11 +206,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
BrowserInfoList browser_info_list_; BrowserInfoList browser_info_list_;
int next_browser_id_; int next_browser_id_;
typedef ScopedVector<PendingNewBrowserInfo> PendingNewBrowserInfoList; using PendingNewBrowserInfoList =
std::vector<std::unique_ptr<PendingNewBrowserInfo>>;
PendingNewBrowserInfoList pending_new_browser_info_list_; PendingNewBrowserInfoList pending_new_browser_info_list_;
// Only accessed on the UI thread. // Only accessed on the UI thread.
typedef ScopedVector<PendingPopup> PendingPopupList; using PendingPopupList = std::vector<std::unique_ptr<PendingPopup>>;
PendingPopupList pending_popup_list_; PendingPopupList pending_popup_list_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoManager); DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoManager);

View File

@ -10,7 +10,6 @@
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/scoped_vector.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
@ -20,7 +19,7 @@
namespace base { namespace base {
class MessageLoop; class MessageLoop;
class Thread; class Thread;
} } // namespace base
namespace content { namespace content {
struct MainFunctionParams; struct MainFunctionParams;
@ -29,7 +28,7 @@ struct MainFunctionParams;
namespace extensions { namespace extensions {
class ExtensionsBrowserClient; class ExtensionsBrowserClient;
class ExtensionsClient; class ExtensionsClient;
} } // namespace extensions
#if defined(USE_AURA) #if defined(USE_AURA)
namespace wm { namespace wm {

View File

@ -9,7 +9,6 @@
#include "libcef/browser/browser_main.h" #include "libcef/browser/browser_main.h"
#include "cef/grit/cef_strings.h" #include "cef/grit/cef_strings.h"
#include "chrome/common/chrome_utility_messages.h"
#include "content/public/browser/utility_process_host.h" #include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h" #include "content/public/browser/utility_process_host_client.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"

View File

@ -37,12 +37,13 @@ void ChromeBrowserProcessStub::Initialize(
DCHECK(!context_initialized_); DCHECK(!context_initialized_);
DCHECK(!shutdown_); DCHECK(!shutdown_);
base::FilePath net_log_path; net_log_ = base::MakeUnique<net_log::ChromeNetLog>();
if (command_line.HasSwitch(switches::kLogNetLog)) if (command_line.HasSwitch(switches::kLogNetLog)) {
net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); net_log_->StartWritingToFile(
net_log_.reset(new net_log::ChromeNetLog( command_line.GetSwitchValuePath(switches::kLogNetLog),
net_log_path, GetNetCaptureModeFromCommandLine(command_line), GetNetCaptureModeFromCommandLine(command_line),
command_line.GetCommandLineString(), std::string())); command_line.GetCommandLineString(), std::string());
}
initialized_ = true; initialized_ = true;
} }
@ -349,7 +350,7 @@ ChromeBrowserProcessStub::CachedDefaultWebClientState() {
return shell_integration::UNKNOWN_DEFAULT; return shell_integration::UNKNOWN_DEFAULT;
} }
memory::TabManager* ChromeBrowserProcessStub::GetTabManager() { resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
} }
@ -360,6 +361,12 @@ ChromeBrowserProcessStub::GetPhysicalWebDataSource() {
return NULL; return NULL;
} }
prefs::InProcessPrefServiceFactory*
ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED();
return NULL;
}
content::BrowserContext* content::BrowserContext*
ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito( ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito(
content::BrowserContext* context) { content::BrowserContext* context) {

View File

@ -106,8 +106,9 @@ class ChromeBrowserProcessStub : public BrowserProcess,
gcm::GCMDriver* gcm_driver() override; gcm::GCMDriver* gcm_driver() override;
shell_integration::DefaultWebClientState CachedDefaultWebClientState() shell_integration::DefaultWebClientState CachedDefaultWebClientState()
override; override;
memory::TabManager* GetTabManager() override; resource_coordinator::TabManager* GetTabManager() override;
physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override; physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
// BrowserContextIncognitoHelper implementation. // BrowserContextIncognitoHelper implementation.
content::BrowserContext* GetBrowserContextRedirectedInIncognito( content::BrowserContext* GetBrowserContextRedirectedInIncognito(

View File

@ -44,7 +44,7 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "cef/grit/cef_resources.h" #include "cef/grit/cef_resources.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter.h" #include "chrome/browser/spellchecker/spell_check_host_impl.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/intercept_navigation_throttle.h"
@ -246,14 +246,32 @@ class CefSelectClientCertificateCallbackImpl
CefRefPtr<CefX509Certificate> cert) { CefRefPtr<CefX509Certificate> cert) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
scoped_refptr<net::X509Certificate> x509cert = NULL;
if (cert) { if (cert) {
CefX509CertificateImpl* certImpl = CefX509CertificateImpl* certImpl =
static_cast<CefX509CertificateImpl*>(cert.get()); static_cast<CefX509CertificateImpl*>(cert.get());
x509cert = certImpl->GetInternalCertObject(); certImpl->AcquirePrivateKey(
base::Bind(&CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
base::Passed(std::move(delegate)), cert));
return;
} }
delegate->ContinueWithCertificate(x509cert.get()); delegate->ContinueWithCertificate(nullptr, nullptr);
}
static void RunWithPrivateKey(
std::unique_ptr<content::ClientCertificateDelegate> delegate,
CefRefPtr<CefX509Certificate> cert,
scoped_refptr<net::SSLPrivateKey> key) {
CEF_REQUIRE_UIT();
DCHECK(cert);
if (key) {
CefX509CertificateImpl* certImpl =
static_cast<CefX509CertificateImpl*>(cert.get());
delegate->ContinueWithCertificate(certImpl->GetInternalCertObject(), key);
} else {
delegate->ContinueWithCertificate(nullptr, nullptr);
}
} }
std::unique_ptr<content::ClientCertificateDelegate> delegate_; std::unique_ptr<content::ClientCertificateDelegate> delegate_;
@ -449,20 +467,19 @@ content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
void CefContentBrowserClient::RenderProcessWillLaunch( void CefContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) { content::RenderProcessHost* host) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
const int id = host->GetID(); const int id = host->GetID();
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
host->AddFilter(new CefBrowserMessageFilter(id)); host->AddFilter(new CefBrowserMessageFilter(id));
host->AddFilter(new printing::CefPrintingMessageFilter(id, profile)); host->AddFilter(new printing::CefPrintingMessageFilter(id, profile));
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
host->AddFilter(new SpellCheckMessageFilter(id));
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
host->AddFilter(new SpellCheckMessageFilterPlatform(id)); host->AddFilter(new SpellCheckMessageFilterPlatform(id));
#endif
} }
#endif
host->AddFilter(new CefPluginInfoMessageFilter( host->AddFilter(new CefPluginInfoMessageFilter(
id, static_cast<CefBrowserContext*>(profile))); id, static_cast<CefBrowserContext*>(profile)));
@ -578,8 +595,9 @@ void CefContentBrowserClient::SiteInstanceDeleting(
void CefContentBrowserClient::RegisterOutOfProcessServices( void CefContentBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) { OutOfProcessServiceMap* services) {
services->emplace(printing::mojom::kServiceName, (*services)[printing::mojom::kServiceName] = {
base::ASCIIToUTF16("PDF Compositor Service")); base::ASCIIToUTF16("PDF Compositor Service"),
content::SANDBOX_TYPE_UTILITY};
} }
std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay( std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
@ -712,12 +730,9 @@ CefContentBrowserClient::CreateQuotaPermissionContext() {
void CefContentBrowserClient::GetQuotaSettings( void CefContentBrowserClient::GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
const storage::OptionalQuotaSettingsCallback& callback) { storage::OptionalQuotaSettingsCallback callback) {
content::BrowserThread::PostTaskAndReplyWithResult( storage::GetNominalDynamicSettings(
content::BrowserThread::FILE, FROM_HERE, partition->GetPath(), context->IsOffTheRecord(), std::move(callback));
base::Bind(&storage::CalculateNominalDynamicSettings,
partition->GetPath(), context->IsOffTheRecord()),
callback);
} }
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() { content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
@ -783,7 +798,7 @@ void CefContentBrowserClient::AllowCertificateError(
void CefContentBrowserClient::SelectClientCertificate( void CefContentBrowserClient::SelectClientCertificate(
content::WebContents* web_contents, content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info, net::SSLCertRequestInfo* cert_request_info,
net::CertificateList client_certs, net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) { std::unique_ptr<content::ClientCertificateDelegate> delegate) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
@ -797,15 +812,14 @@ void CefContentBrowserClient::SelectClientCertificate(
} }
if (!handler.get()) { if (!handler.get()) {
delegate->ContinueWithCertificate(NULL); delegate->ContinueWithCertificate(nullptr, nullptr);
return; return;
} }
CefRequestHandler::X509CertificateList certs; CefRequestHandler::X509CertificateList certs;
for (std::vector<scoped_refptr<net::X509Certificate>>::iterator iter = for (net::ClientCertIdentityList::iterator iter = client_certs.begin();
client_certs.begin();
iter != client_certs.end(); iter++) { iter != client_certs.end(); iter++) {
certs.push_back(new CefX509CertificateImpl(*iter)); certs.push_back(new CefX509CertificateImpl(std::move(*iter)));
} }
CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl( CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl(
@ -921,10 +935,8 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
std::unique_ptr<content::NavigationThrottle> throttle = std::unique_ptr<content::NavigationThrottle> throttle =
base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
navigation_handle, navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame,
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id, frame_id, parent_frame_id));
parent_frame_id),
true);
throttles.push_back(std::move(throttle)); throttles.push_back(std::move(throttle));
return throttles; return throttles;
@ -964,6 +976,22 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
void CefContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
content::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI);
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
registry->AddInterface(
base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()),
ui_task_runner);
}
}
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) { void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
// Register as a Web-safe scheme so that requests for the scheme from a // Register as a Web-safe scheme so that requests for the scheme from a
// render process will be allowed in resource_dispatcher_host_impl.cc // render process will be allowed in resource_dispatcher_host_impl.cc

View File

@ -26,7 +26,7 @@ class CefResourceDispatcherHostDelegate;
namespace content { namespace content {
class PluginServiceFilter; class PluginServiceFilter;
class SiteInstance; class SiteInstance;
} } // namespace content
namespace extensions { namespace extensions {
class Extension; class Extension;
@ -59,7 +59,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
void GetQuotaSettings( void GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
const storage::OptionalQuotaSettingsCallback& callback) override; storage::OptionalQuotaSettingsCallback callback) override;
content::MediaObserver* GetMediaObserver() override; content::MediaObserver* GetMediaObserver() override;
content::SpeechRecognitionManagerDelegate* content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override; CreateSpeechRecognitionManagerDelegate() override;
@ -77,7 +77,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
void SelectClientCertificate( void SelectClientCertificate(
content::WebContents* web_contents, content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info, net::SSLCertRequestInfo* cert_request_info,
net::CertificateList client_certs, net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override; std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
bool CanCreateWindow(content::RenderFrameHost* opener, bool CanCreateWindow(content::RenderFrameHost* opener,
const GURL& opener_url, const GURL& opener_url,
@ -115,6 +115,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override; bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
#endif #endif
void ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
content::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) override;
// Perform browser process registration for the custom scheme. // Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme); void RegisterCustomScheme(const std::string& scheme);

View File

@ -22,6 +22,7 @@
#include "base/debug/debugger.h" #include "base/debug/debugger.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "content/app/content_service_manager_main_delegate.h" #include "content/app/content_service_manager_main_delegate.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"

View File

@ -94,7 +94,7 @@ void RunAsyncCompletionOnIOThread(CefRefPtr<CefCompletionCallback> callback) {
// Always execute the callback asynchronously. // Always execute the callback asynchronously.
void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback, void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
int num_deleted) { uint32_t num_deleted) {
if (!callback.get()) if (!callback.get())
return; return;
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete, CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,

View File

@ -6,14 +6,18 @@
#include <stddef.h> #include <stddef.h>
#include <utility>
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include "libcef/browser/devtools_manager_delegate.h" #include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/net/devtools_scheme_handler.h" #include "libcef/browser/net/devtools_scheme_handler.h"
#include "base/guid.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/json/string_escape.h" #include "base/json/string_escape.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@ -22,6 +26,7 @@
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
@ -189,14 +194,24 @@ CefDevToolsFrontend::~CefDevToolsFrontend() {
delete pair.first; delete pair.first;
} }
void CefDevToolsFrontend::RenderViewCreated( void CefDevToolsFrontend::ReadyToCommitNavigation(
content::RenderViewHost* render_view_host) { content::NavigationHandle* navigation_handle) {
if (!frontend_host_) { content::RenderFrameHost* frame = navigation_handle->GetRenderFrameHost();
if (navigation_handle->IsInMainFrame()) {
frontend_host_.reset(content::DevToolsFrontendHost::Create( frontend_host_.reset(content::DevToolsFrontendHost::Create(
web_contents()->GetMainFrame(), frame,
base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend, base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
base::Unretained(this)))); base::Unretained(this))));
return;
} }
std::string origin = navigation_handle->GetURL().GetOrigin().spec();
auto it = extensions_api_.find(origin);
if (it == extensions_api_.end())
return;
std::string script = base::StringPrintf("%s(\"%s\")", it->second.c_str(),
base::GenerateGUID().c_str());
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
} }
void CefDevToolsFrontend::DocumentAvailableInMainFrame() { void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
@ -296,7 +311,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
destination: OTHER destination: OTHER
} }
policy { policy {
cookies_allowed: true cookies_allowed: YES
cookies_store: "user" cookies_store: "user"
setting: setting:
"It's not possible to disable this feature from settings." "It's not possible to disable this feature from settings."
@ -346,6 +361,12 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
} else if (method == "reattach") { } else if (method == "reattach") {
agent_host_->DetachClient(this); agent_host_->DetachClient(this);
agent_host_->AttachClient(this); agent_host_->AttachClient(this);
} else if (method == "registerExtensionsAPI") {
std::string origin;
std::string script;
if (!params->GetString(0, &origin) || !params->GetString(1, &script))
return;
extensions_api_[origin + "/"] = script;
} else { } else {
return; return;
} }
@ -386,16 +407,16 @@ void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(it != pending_requests_.end()); DCHECK(it != pending_requests_.end());
base::DictionaryValue response; base::DictionaryValue response;
base::DictionaryValue* headers = new base::DictionaryValue(); auto headers = base::MakeUnique<base::DictionaryValue>();
net::HttpResponseHeaders* rh = source->GetResponseHeaders(); net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200); response.SetInteger("statusCode", rh ? rh->response_code() : 200);
response.Set("headers", headers);
size_t iterator = 0; size_t iterator = 0;
std::string name; std::string name;
std::string value; std::string value;
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value))
headers->SetString(name, value); headers->SetString(name, value);
response.Set("headers", std::move(headers));
SendMessageAck(it->second, &response); SendMessageAck(it->second, &response);
pending_requests_.erase(it); pending_requests_.erase(it);

View File

@ -24,9 +24,10 @@ class Value;
} }
namespace content { namespace content {
class NavigationHandle;
class RenderViewHost; class RenderViewHost;
class WebContents; class WebContents;
} } // namespace content
class PrefService; class PrefService;
@ -73,7 +74,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
private: private:
// WebContentsObserver overrides // WebContentsObserver overrides
void RenderViewCreated(content::RenderViewHost* render_view_host) override; void ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) override;
void DocumentAvailableInMainFrame() override; void DocumentAvailableInMainFrame() override;
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
@ -91,6 +93,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_; std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
using PendingRequestsMap = std::map<const net::URLFetcher*, int>; using PendingRequestsMap = std::map<const net::URLFetcher*, int>;
PendingRequestsMap pending_requests_; PendingRequestsMap pending_requests_;
using ExtensionsAPIs = std::map<std::string, std::string>;
ExtensionsAPIs extensions_api_;
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_; base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend); DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);

View File

@ -245,6 +245,11 @@ KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() {
return NULL; return NULL;
} }
bool CefExtensionsBrowserClient::IsLockScreenContext(
content::BrowserContext* context) {
return false;
}
void CefExtensionsBrowserClient::SetAPIClientForTest( void CefExtensionsBrowserClient::SetAPIClientForTest(
ExtensionsAPIClient* api_client) { ExtensionsAPIClient* api_client) {
api_client_.reset(api_client); api_client_.reset(api_client);

View File

@ -80,6 +80,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionWebContentsObserver* GetExtensionWebContentsObserver( ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
content::WebContents* web_contents) override; content::WebContents* web_contents) override;
KioskDelegate* GetKioskDelegate() override; KioskDelegate* GetKioskDelegate() override;
bool IsLockScreenContext(content::BrowserContext* context) override;
// Sets the API client. // Sets the API client.
void SetAPIClientForTest(ExtensionsAPIClient* api_client); void SetAPIClientForTest(ExtensionsAPIClient* api_client);

View File

@ -62,13 +62,7 @@ bool PNGMethod(bool with_transparency,
bool JPEGMethod(int quality, bool JPEGMethod(int quality,
const SkBitmap& bitmap, const SkBitmap& bitmap,
std::vector<unsigned char>* compressed) { std::vector<unsigned char>* compressed) {
return gfx::JPEGCodec::Encode( return gfx::JPEGCodec::Encode(bitmap, quality, compressed);
reinterpret_cast<unsigned char*>(bitmap.getPixels()),
bitmap.colorType() == kBGRA_8888_SkColorType
? gfx::JPEGCodec::FORMAT_BGRA
: gfx::JPEGCodec::FORMAT_RGBA,
bitmap.width(), bitmap.height(), static_cast<int>(bitmap.rowBytes()),
quality, compressed);
} }
} // namespace } // namespace

View File

@ -112,9 +112,7 @@ void CefMenuManager::Destroy() {
bool CefMenuManager::IsShowingContextMenu() { bool CefMenuManager::IsShowingContextMenu() {
if (!web_contents()) if (!web_contents())
return false; return false;
content::RenderWidgetHostView* view = return web_contents()->IsShowingContextMenu();
web_contents()->GetRenderWidgetHostView();
return (view && view->IsShowingContextMenu());
} }
bool CefMenuManager::CreateContextMenu( bool CefMenuManager::CreateContextMenu(
@ -241,10 +239,7 @@ void CefMenuManager::MenuWillShow(CefRefPtr<CefMenuModelImpl> source) {
return; return;
// Notify the host before showing the context menu. // Notify the host before showing the context menu.
content::RenderWidgetHostView* view = web_contents()->SetShowingContextMenu(true);
web_contents()->GetRenderWidgetHostView();
if (view)
view->SetShowingContextMenu(true);
} }
void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) { void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
@ -267,10 +262,7 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
} }
// Notify the host after closing the context menu. // Notify the host after closing the context menu.
content::RenderWidgetHostView* view = web_contents()->SetShowingContextMenu(false);
web_contents()->GetRenderWidgetHostView();
if (view)
view->SetShowingContextMenu(false);
web_contents()->NotifyContextMenuClosed(params_.custom_context); web_contents()->NotifyContextMenuClosed(params_.custom_context);
} }

View File

@ -32,7 +32,6 @@
#include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_insertion_delegate_win.h" #include "ui/views/controls/menu/menu_insertion_delegate_win.h"
#include "ui/views/controls/menu/menu_listener.h" #include "ui/views/controls/menu/menu_listener.h"
#include "ui/views/layout/layout_constants.h"
using ui::NativeTheme; using ui::NativeTheme;
@ -50,6 +49,10 @@ static const int kItemLeftMargin = 4;
// The width for displaying the sub-menu arrow. // The width for displaying the sub-menu arrow.
static const int kArrowWidth = 10; static const int kArrowWidth = 10;
// Horizontal spacing between the end of an item (i.e. an icon or a checkbox)
// and the start of its corresponding text.
constexpr int kItemLabelSpacing = 10;
namespace { namespace {
// Draws the top layer of the canvas into the specified HDC. Only works // Draws the top layer of the canvas into the specified HDC. Only works
@ -195,7 +198,7 @@ class CefNativeMenuWin::MenuHostWindow {
gfx::FontList font_list; gfx::FontList font_list;
measure_item_struct->itemWidth = measure_item_struct->itemWidth =
gfx::GetStringWidth(data->label, font_list) + kIconWidth + gfx::GetStringWidth(data->label, font_list) + kIconWidth +
kItemLeftMargin + views::kItemLabelSpacing - kItemLeftMargin + kItemLabelSpacing -
GetSystemMetrics(SM_CXMENUCHECK); GetSystemMetrics(SM_CXMENUCHECK);
if (data->submenu.get()) if (data->submenu.get())
measure_item_struct->itemWidth += kArrowWidth; measure_item_struct->itemWidth += kArrowWidth;
@ -241,7 +244,7 @@ class CefNativeMenuWin::MenuHostWindow {
rect.top += kItemTopMargin; rect.top += kItemTopMargin;
// Should we add kIconWidth only when icon.width() != 0 ? // Should we add kIconWidth only when icon.width() != 0 ?
rect.left += kItemLeftMargin + kIconWidth; rect.left += kItemLeftMargin + kIconWidth;
rect.right -= views::kItemLabelSpacing; rect.right -= kItemLabelSpacing;
UINT format = DT_TOP | DT_SINGLELINE; UINT format = DT_TOP | DT_SINGLELINE;
// Check whether the mnemonics should be underlined. // Check whether the mnemonics should be underlined.
BOOL underline_mnemonics; BOOL underline_mnemonics;

View File

@ -54,7 +54,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
} }
void CefWindowDelegateView::InitContent() { void CefWindowDelegateView::InitContent() {
set_background(views::Background::CreateSolidBackground(background_color_)); SetBackground(views::CreateSolidBackground(background_color_));
SetLayoutManager(new views::FillLayout()); SetLayoutManager(new views::FillLayout());
AddChildView(web_view_); AddChildView(web_view_);
} }

View File

@ -27,10 +27,6 @@ const char kNetWMPing[] = "_NET_WM_PING";
const char kNetWMState[] = "_NET_WM_STATE"; const char kNetWMState[] = "_NET_WM_STATE";
const char kXdndProxy[] = "XdndProxy"; const char kXdndProxy[] = "XdndProxy";
const char* kAtomsToCache[] = {
kAtom, kWMDeleteWindow, kWMProtocols, kNetWMPid,
kNetWMPing, kNetWMState, kXdndProxy, NULL};
::Window FindEventTarget(const base::NativeEvent& xev) { ::Window FindEventTarget(const base::NativeEvent& xev) {
::Window target = xev->xany.window; ::Window target = xev->xany.window;
if (xev->type == GenericEvent) if (xev->type == GenericEvent)
@ -75,6 +71,7 @@ const char* kAtomsToCache[] = {
} }
return top_level_window; return top_level_window;
} }
} // namespace } // namespace
CEF_EXPORT XDisplay* cef_get_xdisplay() { CEF_EXPORT XDisplay* cef_get_xdisplay() {
@ -93,7 +90,6 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
window_mapped_(false), window_mapped_(false),
bounds_(bounds), bounds_(bounds),
focus_pending_(false), focus_pending_(false),
atom_cache_(xdisplay_, kAtomsToCache),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
if (parent_xwindow_ == None) if (parent_xwindow_ == None)
parent_xwindow_ = DefaultRootWindow(xdisplay_); parent_xwindow_ = DefaultRootWindow(xdisplay_);
@ -121,8 +117,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
// should listen for activation events and anything else that GTK+ listens // should listen for activation events and anything else that GTK+ listens
// for, and do something useful. // for, and do something useful.
::Atom protocols[2]; ::Atom protocols[2];
protocols[0] = atom_cache_.GetAtom(kWMDeleteWindow); protocols[0] = gfx::GetAtom(kWMDeleteWindow);
protocols[1] = atom_cache_.GetAtom(kNetWMPing); protocols[1] = gfx::GetAtom(kNetWMPing);
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@ -135,12 +131,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
static_assert(sizeof(long) >= sizeof(pid_t), static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long"); "pid_t should not be larger than long");
long pid = getpid(); long pid = getpid();
XChangeProperty(xdisplay_, xwindow_, atom_cache_.GetAtom(kNetWMPid), XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom(kNetWMPid), XA_CARDINAL, 32,
XA_CARDINAL, 32, PropModeReplace, PropModeReplace, reinterpret_cast<unsigned char*>(&pid), 1);
reinterpret_cast<unsigned char*>(&pid), 1);
// Allow subclasses to create and cache additional atoms.
atom_cache_.allow_uncached_atoms();
} }
CefWindowX11::~CefWindowX11() { CefWindowX11::~CefWindowX11() {
@ -153,9 +145,9 @@ void CefWindowX11::Close() {
XEvent ev = {0}; XEvent ev = {0};
ev.xclient.type = ClientMessage; ev.xclient.type = ClientMessage;
ev.xclient.window = xwindow_; ev.xclient.window = xwindow_;
ev.xclient.message_type = atom_cache_.GetAtom(kWMProtocols); ev.xclient.message_type = gfx::GetAtom(kWMProtocols);
ev.xclient.format = 32; ev.xclient.format = 32;
ev.xclient.data.l[0] = atom_cache_.GetAtom(kWMDeleteWindow); ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow);
ev.xclient.data.l[1] = CurrentTime; ev.xclient.data.l[1] = CurrentTime;
XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev); XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev);
} }
@ -200,13 +192,12 @@ void CefWindowX11::Show() {
if (proxy_target != child) { if (proxy_target != child) {
// Set the proxy target for the top-most window. // Set the proxy target for the top-most window.
XChangeProperty(xdisplay_, toplevel_window, XChangeProperty(xdisplay_, toplevel_window, gfx::GetAtom(kXdndProxy),
atom_cache_.GetAtom(kXdndProxy), XA_WINDOW, 32, XA_WINDOW, 32, PropModeReplace,
PropModeReplace,
reinterpret_cast<unsigned char*>(&child), 1); reinterpret_cast<unsigned char*>(&child), 1);
// Do the same for the proxy target per the spec. // Do the same for the proxy target per the spec.
XChangeProperty(xdisplay_, child, atom_cache_.GetAtom(kXdndProxy), XChangeProperty(xdisplay_, child, gfx::GetAtom(kXdndProxy), XA_WINDOW,
XA_WINDOW, 32, PropModeReplace, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&child), 1); reinterpret_cast<unsigned char*>(&child), 1);
} }
} }
@ -316,15 +307,15 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
} }
case ClientMessage: { case ClientMessage: {
Atom message_type = xev->xclient.message_type; Atom message_type = xev->xclient.message_type;
if (message_type == atom_cache_.GetAtom(kWMProtocols)) { if (message_type == gfx::GetAtom(kWMProtocols)) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
if (protocol == atom_cache_.GetAtom(kWMDeleteWindow)) { if (protocol == gfx::GetAtom(kWMDeleteWindow)) {
// We have received a close message from the window manager. // We have received a close message from the window manager.
if (!browser_ || browser_->TryCloseBrowser()) { if (!browser_ || browser_->TryCloseBrowser()) {
// Allow the close. // Allow the close.
XDestroyWindow(xdisplay_, xwindow_); XDestroyWindow(xdisplay_, xwindow_);
} }
} else if (protocol == atom_cache_.GetAtom(kNetWMPing)) { } else if (protocol == gfx::GetAtom(kNetWMPing)) {
XEvent reply_event = *xev; XEvent reply_event = *xev;
reply_event.xclient.window = parent_xwindow_; reply_event.xclient.window = parent_xwindow_;
@ -370,7 +361,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
break; break;
case PropertyNotify: { case PropertyNotify: {
::Atom changed_atom = xev->xproperty.atom; ::Atom changed_atom = xev->xproperty.atom;
if (changed_atom == atom_cache_.GetAtom(kNetWMState)) { if (changed_atom == gfx::GetAtom(kNetWMState)) {
// State change event like minimize/maximize. // State change event like minimize/maximize.
if (browser_.get()) { if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_); ::Window child = FindChild(xdisplay_, xwindow_);
@ -386,8 +377,8 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
// Set an empty list of property values to pass the check in // Set an empty list of property values to pass the check in
// DesktopWindowTreeHostX11::OnWMStateUpdated(). // DesktopWindowTreeHostX11::OnWMStateUpdated().
XChangeProperty(xdisplay_, child, XChangeProperty(xdisplay_, child,
atom_cache_.GetAtom(kNetWMState), // name gfx::GetAtom(kNetWMState), // name
atom_cache_.GetAtom(kAtom), // type gfx::GetAtom(kAtom), // type
32, // size in bits of items in 'value' 32, // size in bits of items in 'value'
PropModeReplace, NULL, PropModeReplace, NULL,
0); // num items 0); // num items

View File

@ -70,8 +70,6 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
bool focus_pending_; bool focus_pending_;
ui::X11AtomCache atom_cache_;
// Must always be the last member. // Must always be the last member.
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_; base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;

View File

@ -28,11 +28,11 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
const GURL& url, const GURL& url,
const std::string& cookie_line, const std::string& cookie_line,
const net::CookieOptions& options, const net::CookieOptions& options,
const SetCookiesCallback& callback) { SetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) { if (cookie_store) {
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options, cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
callback); std::move(callback));
} }
} }
@ -49,64 +49,78 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
bool http_only, bool http_only,
net::CookieSameSite same_site, net::CookieSameSite same_site,
net::CookiePriority priority, net::CookiePriority priority,
const SetCookiesCallback& callback) { SetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) { if (cookie_store) {
cookie_store->SetCookieWithDetailsAsync( cookie_store->SetCookieWithDetailsAsync(
url, name, value, domain, path, creation_time, expiration_time, url, name, value, domain, path, creation_time, expiration_time,
last_access_time, secure, http_only, same_site, priority, callback); last_access_time, secure, http_only, same_site, priority,
std::move(callback));
}
}
void CefCookieStoreProxy::SetCanonicalCookieAsync(
std::unique_ptr<net::CanonicalCookie> cookie,
bool secure_source,
bool modify_http_only,
SetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source,
modify_http_only,
std::move(callback));
} }
} }
void CefCookieStoreProxy::GetCookiesWithOptionsAsync( void CefCookieStoreProxy::GetCookiesWithOptionsAsync(
const GURL& url, const GURL& url,
const net::CookieOptions& options, const net::CookieOptions& options,
const GetCookiesCallback& callback) { GetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->GetCookiesWithOptionsAsync(url, options, callback); cookie_store->GetCookiesWithOptionsAsync(url, options, std::move(callback));
} }
void CefCookieStoreProxy::GetCookieListWithOptionsAsync( void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
const GURL& url, const GURL& url,
const net::CookieOptions& options, const net::CookieOptions& options,
const GetCookieListCallback& callback) { GetCookieListCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->GetCookieListWithOptionsAsync(url, options, callback); cookie_store->GetCookieListWithOptionsAsync(url, options,
std::move(callback));
} }
void CefCookieStoreProxy::GetAllCookiesAsync( void CefCookieStoreProxy::GetAllCookiesAsync(GetCookieListCallback callback) {
const GetCookieListCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->GetAllCookiesAsync(callback); cookie_store->GetAllCookiesAsync(std::move(callback));
} }
void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url, void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url,
const std::string& cookie_name, const std::string& cookie_name,
const base::Closure& callback) { base::OnceClosure callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->DeleteCookieAsync(url, cookie_name, callback); cookie_store->DeleteCookieAsync(url, cookie_name, std::move(callback));
} }
void CefCookieStoreProxy::DeleteCanonicalCookieAsync( void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
const net::CanonicalCookie& cookie, const net::CanonicalCookie& cookie,
const DeleteCallback& callback) { DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->DeleteCanonicalCookieAsync(cookie, callback); cookie_store->DeleteCanonicalCookieAsync(cookie, std::move(callback));
} }
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync( void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
const base::Time& delete_begin, const base::Time& delete_begin,
const base::Time& delete_end, const base::Time& delete_end,
const DeleteCallback& callback) { DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) { if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
callback); std::move(callback));
} }
} }
@ -114,25 +128,24 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin, const base::Time& delete_begin,
const base::Time& delete_end, const base::Time& delete_end,
const CookiePredicate& predicate, const CookiePredicate& predicate,
const DeleteCallback& callback) { DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) { if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync( cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
delete_begin, delete_end, predicate, callback); delete_begin, delete_end, predicate, std::move(callback));
} }
} }
void CefCookieStoreProxy::DeleteSessionCookiesAsync( void CefCookieStoreProxy::DeleteSessionCookiesAsync(DeleteCallback callback) {
const DeleteCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->DeleteSessionCookiesAsync(callback); cookie_store->DeleteSessionCookiesAsync(std::move(callback));
} }
void CefCookieStoreProxy::FlushStore(const base::Closure& callback) { void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
cookie_store->FlushStore(callback); cookie_store->FlushStore(std::move(callback));
} }
std::unique_ptr<net::CookieStore::CookieChangedSubscription> std::unique_ptr<net::CookieStore::CookieChangedSubscription>

View File

@ -25,7 +25,7 @@ class CefCookieStoreProxy : public net::CookieStore {
void SetCookieWithOptionsAsync(const GURL& url, void SetCookieWithOptionsAsync(const GURL& url,
const std::string& cookie_line, const std::string& cookie_line,
const net::CookieOptions& options, const net::CookieOptions& options,
const SetCookiesCallback& callback) override; SetCookiesCallback callback) override;
void SetCookieWithDetailsAsync(const GURL& url, void SetCookieWithDetailsAsync(const GURL& url,
const std::string& name, const std::string& name,
const std::string& value, const std::string& value,
@ -38,30 +38,33 @@ class CefCookieStoreProxy : public net::CookieStore {
bool http_only, bool http_only,
net::CookieSameSite same_site, net::CookieSameSite same_site,
net::CookiePriority priority, net::CookiePriority priority,
const SetCookiesCallback& callback) override; SetCookiesCallback callback) override;
void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
bool secure_source,
bool modify_http_only,
SetCookiesCallback callback) override;
void GetCookiesWithOptionsAsync(const GURL& url, void GetCookiesWithOptionsAsync(const GURL& url,
const net::CookieOptions& options, const net::CookieOptions& options,
const GetCookiesCallback& callback) override; GetCookiesCallback callback) override;
void GetCookieListWithOptionsAsync( void GetCookieListWithOptionsAsync(const GURL& url,
const GURL& url, const net::CookieOptions& options,
const net::CookieOptions& options, GetCookieListCallback callback) override;
const GetCookieListCallback& callback) override; void GetAllCookiesAsync(GetCookieListCallback callback) override;
void GetAllCookiesAsync(const GetCookieListCallback& callback) override;
void DeleteCookieAsync(const GURL& url, void DeleteCookieAsync(const GURL& url,
const std::string& cookie_name, const std::string& cookie_name,
const base::Closure& callback) override; base::OnceClosure callback) override;
void DeleteCanonicalCookieAsync(const net::CanonicalCookie& cookie, void DeleteCanonicalCookieAsync(const net::CanonicalCookie& cookie,
const DeleteCallback& callback) override; DeleteCallback callback) override;
void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
const base::Time& delete_end, const base::Time& delete_end,
const DeleteCallback& callback) override; DeleteCallback callback) override;
void DeleteAllCreatedBetweenWithPredicateAsync( void DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin, const base::Time& delete_begin,
const base::Time& delete_end, const base::Time& delete_end,
const CookiePredicate& predicate, const CookiePredicate& predicate,
const DeleteCallback& callback) override; DeleteCallback callback) override;
void DeleteSessionCookiesAsync(const DeleteCallback& callback) override; void DeleteSessionCookiesAsync(DeleteCallback callback) override;
void FlushStore(const base::Closure& callback) override; void FlushStore(base::OnceClosure callback) override;
std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
const GURL& url, const GURL& url,
const std::string& name, const std::string& name,

View File

@ -426,8 +426,10 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
return AUTH_REQUIRED_RESPONSE_NO_ACTION; return AUTH_REQUIRED_RESPONSE_NO_ACTION;
} }
bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, bool CefNetworkDelegate::OnCanAccessFile(
const base::FilePath& path) const { const net::URLRequest& request,
const base::FilePath& original_path,
const base::FilePath& absolute_path) const {
return true; return true;
} }

View File

@ -43,7 +43,8 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
net::AuthCredentials* credentials) override; net::AuthCredentials* credentials) override;
void OnCompleted(net::URLRequest* request, bool started) override; void OnCompleted(net::URLRequest* request, bool started) override;
bool OnCanAccessFile(const net::URLRequest& request, bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const override; const base::FilePath& original_path,
const base::FilePath& absolute_path) const override;
bool OnAreExperimentalCookieFeaturesEnabled() const override; bool OnAreExperimentalCookieFeaturesEnabled() const override;
// Weak, owned by our owner (CefURLRequestContextGetterImpl). // Weak, owned by our owner (CefURLRequestContextGetterImpl).

View File

@ -5,17 +5,17 @@
#include "libcef/browser/net/url_request_context.h" #include "libcef/browser/net/url_request_context.h"
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
base::AtomicRefCount CefURLRequestContext::DebugObjCt = 0; base::AtomicRefCount CefURLRequestContext::DebugObjCt;
#endif #endif
CefURLRequestContext::CefURLRequestContext() { CefURLRequestContext::CefURLRequestContext() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
base::AtomicRefCountInc(&DebugObjCt); DebugObjCt.Increment();
#endif #endif
} }
CefURLRequestContext::~CefURLRequestContext() { CefURLRequestContext::~CefURLRequestContext() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
base::AtomicRefCountDec(&DebugObjCt); DebugObjCt.Decrement();
#endif #endif
} }

View File

@ -26,7 +26,8 @@
#include "base/threading/worker_pool.h" #include "base/threading/worker_pool.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/net/proxy_service_factory.h" #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/net_log/chrome_net_log.h" #include "components/net_log/chrome_net_log.h"
#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_registry_simple.h"
@ -50,7 +51,10 @@
#include "net/http/http_server_properties_impl.h" #include "net/http/http_server_properties_impl.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/http/transport_security_state.h" #include "net/http/transport_security_state.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
#include "net/proxy/proxy_service.h" #include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_service_mojo.h"
#include "net/ssl/ssl_config_service_defaults.h" #include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/http_user_agent_settings.h" #include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
@ -105,13 +109,58 @@ class CefHttpUserAgentSettings : public net::HttpUserAgentSettings {
DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings); DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings);
}; };
// Based on ProxyServiceFactory::CreateProxyService which was deleted in
// http://crrev.com/1c261ff4.
std::unique_ptr<net::ProxyService> CreateProxyService(
net::NetLog* net_log,
net::URLRequestContext* context,
net::NetworkDelegate* network_delegate,
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
const base::CommandLine& command_line,
bool quick_check_enabled,
bool pac_https_url_stripping_enabled) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver);
// TODO(eroman): Figure out why this doesn't work in single-process mode.
// Should be possible now that a private isolate is used.
// http://crbug.com/474654
if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
use_v8 = false; // Fallback to non-v8 implementation.
}
std::unique_ptr<net::ProxyService> proxy_service;
if (use_v8) {
std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher;
net::DhcpProxyScriptFetcherFactory dhcp_factory;
dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
proxy_service = net::CreateProxyServiceUsingMojoFactory(
ChromeMojoProxyResolverFactory::GetInstance(),
std::move(proxy_config_service),
new net::ProxyScriptFetcherImpl(context),
std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log,
network_delegate);
} else {
proxy_service = net::ProxyService::CreateUsingSystemProxyResolver(
std::move(proxy_config_service), net_log);
}
proxy_service->set_quick_check_enabled(quick_check_enabled);
proxy_service->set_sanitize_url_policy(
pac_https_url_stripping_enabled
? net::ProxyService::SanitizeUrlPolicy::SAFE
: net::ProxyService::SanitizeUrlPolicy::UNSAFE);
return proxy_service;
}
} // namespace } // namespace
CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl( CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
const CefRequestContextSettings& settings, const CefRequestContextSettings& settings,
PrefService* pref_service, PrefService* pref_service,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
std::unique_ptr<net::ProxyConfigService> proxy_config_service, std::unique_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors) content::URLRequestInterceptorScopedVector request_interceptors)
@ -122,7 +171,6 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
io_state_->net_log_ = g_browser_process->net_log(), io_state_->net_log_ = g_browser_process->net_log(),
DCHECK(io_state_->net_log_); DCHECK(io_state_->net_log_);
io_state_->io_task_runner_ = std::move(io_task_runner); 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_->proxy_config_service_ = std::move(proxy_config_service);
io_state_->request_interceptors_ = std::move(request_interceptors); io_state_->request_interceptors_ = std::move(request_interceptors);
@ -266,12 +314,12 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
io_state_->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 = std::unique_ptr<net::ProxyService> system_proxy_service =
ProxyServiceFactory::CreateProxyService( CreateProxyService(io_state_->net_log_,
io_state_->net_log_, io_state_->url_request_context_.get(), io_state_->url_request_context_.get(),
io_state_->url_request_context_->network_delegate(), io_state_->url_request_context_->network_delegate(),
std::move(io_state_->proxy_config_service_), *command_line, std::move(io_state_->proxy_config_service_),
quick_check_enabled_.GetValue(), *command_line, quick_check_enabled_.GetValue(),
pac_https_url_stripping_enabled_.GetValue()); pac_https_url_stripping_enabled_.GetValue());
io_state_->storage_->set_proxy_service(std::move(system_proxy_service)); io_state_->storage_->set_proxy_service(std::move(system_proxy_service));
io_state_->storage_->set_ssl_config_service( io_state_->storage_->set_ssl_config_service(
@ -311,31 +359,34 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
net::CACHE_BACKEND_DEFAULT, http_cache_path, 0, net::CACHE_BACKEND_DEFAULT, http_cache_path, 0,
BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE))); BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)));
net::HttpNetworkSession::Params network_session_params; net::HttpNetworkSession::Context network_session_context;
network_session_params.host_resolver = network_session_context.host_resolver =
io_state_->url_request_context_->host_resolver(); io_state_->url_request_context_->host_resolver();
network_session_params.cert_verifier = network_session_context.cert_verifier =
io_state_->url_request_context_->cert_verifier(); io_state_->url_request_context_->cert_verifier();
network_session_params.transport_security_state = network_session_context.transport_security_state =
io_state_->url_request_context_->transport_security_state(); io_state_->url_request_context_->transport_security_state();
network_session_params.cert_transparency_verifier = network_session_context.cert_transparency_verifier =
io_state_->url_request_context_->cert_transparency_verifier(); io_state_->url_request_context_->cert_transparency_verifier();
network_session_params.ct_policy_enforcer = network_session_context.ct_policy_enforcer =
io_state_->url_request_context_->ct_policy_enforcer(); io_state_->url_request_context_->ct_policy_enforcer();
network_session_params.proxy_service = network_session_context.proxy_service =
io_state_->url_request_context_->proxy_service(); io_state_->url_request_context_->proxy_service();
network_session_params.ssl_config_service = network_session_context.ssl_config_service =
io_state_->url_request_context_->ssl_config_service(); io_state_->url_request_context_->ssl_config_service();
network_session_params.http_auth_handler_factory = network_session_context.http_auth_handler_factory =
io_state_->url_request_context_->http_auth_handler_factory(); io_state_->url_request_context_->http_auth_handler_factory();
network_session_params.http_server_properties = network_session_context.http_server_properties =
io_state_->url_request_context_->http_server_properties(); io_state_->url_request_context_->http_server_properties();
network_session_context.net_log = io_state_->net_log_;
net::HttpNetworkSession::Params network_session_params;
network_session_params.ignore_certificate_errors = network_session_params.ignore_certificate_errors =
settings_.ignore_certificate_errors ? true : false; settings_.ignore_certificate_errors ? true : false;
network_session_params.net_log = io_state_->net_log_;
io_state_->storage_->set_http_network_session( io_state_->storage_->set_http_network_session(
base::WrapUnique(new net::HttpNetworkSession(network_session_params))); base::WrapUnique(new net::HttpNetworkSession(network_session_params,
network_session_context)));
io_state_->storage_->set_http_transaction_factory( io_state_->storage_->set_http_transaction_factory(
base::WrapUnique(new net::HttpCache( base::WrapUnique(new net::HttpCache(
io_state_->storage_->http_network_session(), io_state_->storage_->http_network_session(),
@ -349,7 +400,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
// Install internal scheme handlers that cannot be overridden. // Install internal scheme handlers that cannot be overridden.
scheme::InstallInternalProtectedHandlers( scheme::InstallInternalProtectedHandlers(
job_factory.get(), io_state_->url_request_manager_.get(), job_factory.get(), io_state_->url_request_manager_.get(),
&io_state_->protocol_handlers_, network_session_params.host_resolver); &io_state_->protocol_handlers_, network_session_context.host_resolver);
io_state_->protocol_handlers_.clear(); io_state_->protocol_handlers_.clear();
// Register internal scheme handlers that can be overridden. // Register internal scheme handlers that can be overridden.
@ -476,7 +527,7 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
io_state_->proxy_config_service_ = io_state_->proxy_config_service_ =
net::ProxyService::CreateSystemProxyConfigService( net::ProxyService::CreateSystemProxyConfigService(
io_state_->io_task_runner_, io_state_->file_task_runner_); io_state_->io_task_runner_);
} }
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() { void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {

View File

@ -36,7 +36,7 @@ class ProxyConfigService;
class URLRequestContextStorage; class URLRequestContextStorage;
class URLRequestJobFactory; class URLRequestJobFactory;
class URLRequestJobFactoryImpl; class URLRequestJobFactoryImpl;
} } // namespace net
// Isolated URLRequestContextGetter implementation. Life span is primarily // Isolated URLRequestContextGetter implementation. Life span is primarily
// controlled by CefResourceContext and (for the global context) // controlled by CefResourceContext and (for the global context)
@ -48,7 +48,6 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
const CefRequestContextSettings& settings, const CefRequestContextSettings& settings,
PrefService* pref_service, PrefService* pref_service,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
std::unique_ptr<net::ProxyConfigService> proxy_config_service, std::unique_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors); content::URLRequestInterceptorScopedVector request_interceptors);
@ -101,7 +100,6 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
net::NetLog* net_log_ = nullptr; // Guaranteed to outlive this object. net::NetLog* net_log_ = nullptr; // Guaranteed to outlive this object.
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
#if defined(OS_POSIX) && !defined(OS_ANDROID) #if defined(OS_POSIX) && !defined(OS_ANDROID)
std::string gsapi_library_name_; std::string gsapi_library_name_;

View File

@ -99,6 +99,7 @@ struct PopulateAxNodeAttributes {
case ui::AX_ATTR_ACTIVEDESCENDANT_ID: case ui::AX_ATTR_ACTIVEDESCENDANT_ID:
case ui::AX_ATTR_IN_PAGE_LINK_TARGET_ID: case ui::AX_ATTR_IN_PAGE_LINK_TARGET_ID:
case ui::AX_ATTR_ERRORMESSAGE_ID: case ui::AX_ATTR_ERRORMESSAGE_ID:
case ui::AX_ATTR_DETAILS_ID:
case ui::AX_ATTR_MEMBER_OF_ID: case ui::AX_ATTR_MEMBER_OF_ID:
case ui::AX_ATTR_NEXT_ON_LINE_ID: case ui::AX_ATTR_NEXT_ON_LINE_ID:
case ui::AX_ATTR_PREVIOUS_ON_LINE_ID: case ui::AX_ATTR_PREVIOUS_ON_LINE_ID:
@ -127,6 +128,11 @@ struct PopulateAxNodeAttributes {
ToString(static_cast<ui::AXCheckedState>(attr.second))); ToString(static_cast<ui::AXCheckedState>(attr.second)));
} }
break; break;
case ui::AX_ATTR_RESTRICTION:
attributes->SetString(
ToString(attr.first),
ToString(static_cast<ui::AXRestriction>(attr.second)));
break;
case ui::AX_ATTR_SORT_DIRECTION: case ui::AX_ATTR_SORT_DIRECTION:
if (ui::AX_SORT_DIRECTION_NONE != attr.second) { if (ui::AX_SORT_DIRECTION_NONE != attr.second) {
attributes->SetString( attributes->SetString(

View File

@ -12,7 +12,7 @@
namespace content { namespace content {
struct AXEventNotificationDetails; struct AXEventNotificationDetails;
struct AXLocationChangeNotificationDetails; struct AXLocationChangeNotificationDetails;
} } // namespace content
namespace osr_accessibility_util { namespace osr_accessibility_util {

View File

@ -20,7 +20,7 @@
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "cc/output/copy_output_request.h" #include "cc/output/copy_output_request.h"
#include "cc/scheduler/delay_based_time_source.h" #include "cc/scheduler/delay_based_time_source.h"
#include "components/viz/display_compositor/gl_helper.h" #include "components/viz/common/gl_helper.h"
#include "content/browser/bad_message.h" #include "content/browser/bad_message.h"
#include "content/browser/compositor/image_transport_factory.h" #include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/frame_host/render_widget_host_view_guest.h"
@ -187,7 +187,7 @@ class CefCopyFrameGenerator {
uint8_t* pixels = static_cast<uint8_t*>(bitmap_->getPixels()); uint8_t* pixels = static_cast<uint8_t*>(bitmap_->getPixels());
cc::TextureMailbox texture_mailbox; viz::TextureMailbox texture_mailbox;
std::unique_ptr<cc::SingleReleaseCallback> release_callback; std::unique_ptr<cc::SingleReleaseCallback> release_callback;
result->TakeTexture(&texture_mailbox, &release_callback); result->TakeTexture(&texture_mailbox, &release_callback);
DCHECK(texture_mailbox.IsTexture()); DCHECK(texture_mailbox.IsTexture());
@ -398,7 +398,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
compositor_.reset( compositor_.reset(
new ui::Compositor(context_factory_private->AllocateFrameSinkId(), new ui::Compositor(context_factory_private->AllocateFrameSinkId(),
content::GetContextFactory(), context_factory_private, content::GetContextFactory(), context_factory_private,
base::ThreadTaskRunnerHandle::Get())); base::ThreadTaskRunnerHandle::Get(),
false /* enable_surface_synchronization */));
compositor_->SetAcceleratedWidget(compositor_widget_); compositor_->SetAcceleratedWidget(compositor_widget_);
compositor_->SetDelegate(this); compositor_->SetDelegate(this);
compositor_->SetRootLayer(root_layer_.get()); compositor_->SetRootLayer(root_layer_.get());
@ -571,7 +572,7 @@ bool CefRenderWidgetHostViewOSR::LockMouse() {
void CefRenderWidgetHostViewOSR::UnlockMouse() {} void CefRenderWidgetHostViewOSR::UnlockMouse() {}
void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink( void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {
renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
if (GetDelegatedFrameHost()) { if (GetDelegatedFrameHost()) {
GetDelegatedFrameHost()->DidCreateNewRendererCompositorFrameSink( GetDelegatedFrameHost()->DidCreateNewRendererCompositorFrameSink(
@ -580,7 +581,7 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
} }
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
const cc::LocalSurfaceId& local_surface_id, const viz::LocalSurfaceId& local_surface_id,
cc::CompositorFrame frame) { cc::CompositorFrame frame) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame"); TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
@ -842,7 +843,7 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
browser_impl_->client()->GetRenderHandler(); browser_impl_->client()->GetRenderHandler();
if (handler.get() && handler->GetRootScreenRect(browser_impl_.get(), rc)) if (handler.get() && handler->GetRootScreenRect(browser_impl_.get(), rc))
return gfx::Rect(rc.x, rc.y, rc.width, rc.height); return gfx::Rect(rc.x, rc.y, rc.width, rc.height);
return gfx::Rect(); return GetViewBounds();
} }
content::BrowserAccessibilityManager* content::BrowserAccessibilityManager*
@ -867,10 +868,10 @@ void CefRenderWidgetHostViewOSR::ImeSetComposition(
if (!render_widget_host_) if (!render_widget_host_)
return; return;
std::vector<blink::WebCompositionUnderline> web_underlines; std::vector<ui::CompositionUnderline> web_underlines;
web_underlines.reserve(underlines.size()); web_underlines.reserve(underlines.size());
for (const CefCompositionUnderline& line : underlines) { for (const CefCompositionUnderline& line : underlines) {
web_underlines.push_back(blink::WebCompositionUnderline( web_underlines.push_back(ui::CompositionUnderline(
line.range.from, line.range.to, line.color, line.thick ? true : false, line.range.from, line.range.to, line.color, line.thick ? true : false,
line.background_color)); line.background_color));
} }
@ -892,9 +893,9 @@ void CefRenderWidgetHostViewOSR::ImeCommitText(
return; return;
gfx::Range range(replacement_range.from, replacement_range.to); gfx::Range range(replacement_range.from, replacement_range.to);
render_widget_host_->ImeCommitText( render_widget_host_->ImeCommitText(text,
text, std::vector<blink::WebCompositionUnderline>(), range, std::vector<ui::CompositionUnderline>(),
relative_cursor_pos); range, relative_cursor_pos);
// Stop Monitoring for composition updates after we are done. // Stop Monitoring for composition updates after we are done.
RequestImeCompositionUpdate(false); RequestImeCompositionUpdate(false);
@ -967,7 +968,7 @@ void CefRenderWidgetHostViewOSR::ProcessGestureEvent(
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace( bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
const gfx::Point& point, const gfx::Point& point,
const cc::SurfaceId& original_surface, const viz::SurfaceId& original_surface,
gfx::Point* transformed_point) { gfx::Point* transformed_point) {
// Transformations use physical pixels rather than DIP, so conversion // Transformations use physical pixels rather than DIP, so conversion
// is necessary. // is necessary.
@ -1051,7 +1052,7 @@ CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() {
return base::MakeUnique<content::CompositorResizeLock>(this, desired_size); return base::MakeUnique<content::CompositorResizeLock>(this, desired_size);
} }
void CefRenderWidgetHostViewOSR::OnBeginFrame(const cc::BeginFrameArgs& args) { void CefRenderWidgetHostViewOSR::OnBeginFrame() {
// TODO(cef): Maybe we can use this method in combination with // TODO(cef): Maybe we can use this method in combination with
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer. // OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
// See https://codereview.chromium.org/1841083007. // See https://codereview.chromium.org/1841083007.
@ -1302,7 +1303,7 @@ void CefRenderWidgetHostViewOSR::SendFocusEvent(bool focus) {
browser_impl_->CancelContextMenu(); browser_impl_->CancelContextMenu();
widget->SetActive(false); widget->SetActive(false);
widget->Blur(); widget->LostFocus();
} }
} }
@ -1498,8 +1499,8 @@ void CefRenderWidgetHostViewOSR::SendBeginFrame(base::TimeTicks frame_time,
DCHECK(begin_frame_args.IsValid()); DCHECK(begin_frame_args.IsValid());
begin_frame_number_++; begin_frame_number_++;
render_widget_host_->Send(new ViewMsg_BeginFrame( if (renderer_compositor_frame_sink_)
render_widget_host_->GetRoutingID(), begin_frame_args)); renderer_compositor_frame_sink_->OnBeginFrame(begin_frame_args);
} }
void CefRenderWidgetHostViewOSR::CancelWidget() { void CefRenderWidgetHostViewOSR::CancelWidget() {
@ -1621,7 +1622,7 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
} }
} }
cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId( viz::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
bool is_guest_view_hack) { bool is_guest_view_hack) {
// GuestViews have two RenderWidgetHostViews and so we need to make sure // GuestViews have two RenderWidgetHostViews and so we need to make sure
// we don't have FrameSinkId collisions. // we don't have FrameSinkId collisions.
@ -1631,10 +1632,10 @@ cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
content::ImageTransportFactory::GetInstance(); content::ImageTransportFactory::GetInstance();
return is_guest_view_hack return is_guest_view_hack
? factory->GetContextFactoryPrivate()->AllocateFrameSinkId() ? factory->GetContextFactoryPrivate()->AllocateFrameSinkId()
: cc::FrameSinkId(base::checked_cast<uint32_t>( : viz::FrameSinkId(base::checked_cast<uint32_t>(
render_widget_host_->GetProcess()->GetID()), render_widget_host_->GetProcess()->GetID()),
base::checked_cast<uint32_t>( base::checked_cast<uint32_t>(
render_widget_host_->GetRoutingID())); render_widget_host_->GetRoutingID()));
} }
void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer( void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer(

View File

@ -38,7 +38,7 @@ class RenderWidgetHost;
class RenderWidgetHostImpl; class RenderWidgetHostImpl;
class RenderWidgetHostViewGuest; class RenderWidgetHostViewGuest;
class BackingStore; class BackingStore;
} } // namespace content
class CefBeginFrameTimer; class CefBeginFrameTimer;
class CefBrowserHostImpl; class CefBrowserHostImpl;
@ -85,7 +85,7 @@ class MacHelper;
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate public ui::CompositorDelegate
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
, ,
public content::DelegatedFrameHostClient, public content::DelegatedFrameHostClient,
public content::CompositorResizeLockClient public content::CompositorResizeLockClient
#endif #endif
@ -129,9 +129,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
// RenderWidgetHostViewBase implementation. // RenderWidgetHostViewBase implementation.
void DidCreateNewRendererCompositorFrameSink( void DidCreateNewRendererCompositorFrameSink(
cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
override; override;
void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id,
cc::CompositorFrame frame) override; cc::CompositorFrame frame) override;
void ClearCompositorFrame() override; void ClearCompositorFrame() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view, void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
@ -146,7 +146,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
int error_code) override; int error_code) override;
void Destroy() override; void Destroy() override;
void SetTooltipText(const base::string16& tooltip_text) override; void SetTooltipText(const base::string16& tooltip_text) override;
void OnSetNeedsFlushInput() override {}
gfx::Size GetRequestedRendererSize() const override; gfx::Size GetRequestedRendererSize() const override;
gfx::Size GetPhysicalBackingSize() const override; gfx::Size GetPhysicalBackingSize() const override;
@ -189,7 +188,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void ProcessGestureEvent(const blink::WebGestureEvent& event, void ProcessGestureEvent(const blink::WebGestureEvent& event,
const ui::LatencyInfo& latency) override; const ui::LatencyInfo& latency) override;
bool TransformPointToLocalCoordSpace(const gfx::Point& point, bool TransformPointToLocalCoordSpace(const gfx::Point& point,
const cc::SurfaceId& original_surface, const viz::SurfaceId& original_surface,
gfx::Point* transformed_point) override; gfx::Point* transformed_point) override;
bool TransformPointToCoordSpaceForView( bool TransformPointToCoordSpaceForView(
const gfx::Point& point, const gfx::Point& point,
@ -209,7 +208,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
bool DelegatedFrameCanCreateResizeLock() const override; bool DelegatedFrameCanCreateResizeLock() const override;
std::unique_ptr<content::CompositorResizeLock> std::unique_ptr<content::CompositorResizeLock>
DelegatedFrameHostCreateResizeLock() override; DelegatedFrameHostCreateResizeLock() override;
void OnBeginFrame(const cc::BeginFrameArgs& args) override; void OnBeginFrame() override;
bool IsAutoResizeEnabled() const override; bool IsAutoResizeEnabled() const override;
// CompositorResizeLockClient implementation. // CompositorResizeLockClient implementation.
@ -298,7 +297,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void RequestImeCompositionUpdate(bool start_monitoring); void RequestImeCompositionUpdate(bool start_monitoring);
cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack); viz::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
// Applies background color without notifying the RenderWidget about // Applies background color without notifying the RenderWidget about
// opaqueness changes. // opaqueness changes.
@ -378,7 +377,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
gfx::Vector2dF last_scroll_offset_; gfx::Vector2dF last_scroll_offset_;
bool is_scroll_offset_changed_pending_; bool is_scroll_offset_changed_pending_;
cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
nullptr; nullptr;
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_; base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;

View File

@ -44,11 +44,7 @@ class MacHelper : public content::BrowserCompositorMacClient,
return color; return color;
} }
void BrowserCompositorMacSendBeginFrame( void BrowserCompositorMacOnBeginFrame() override {}
const cc::BeginFrameArgs& args) override {
view_->render_widget_host()->Send(new ViewMsg_BeginFrame(
view_->render_widget_host()->GetRoutingID(), args));
}
// AcceleratedWidgetMacNSView methods: // AcceleratedWidgetMacNSView methods:

View File

@ -63,12 +63,23 @@ void CefWebContentsViewOSR::StoreFocus() {}
void CefWebContentsViewOSR::RestoreFocus() {} void CefWebContentsViewOSR::RestoreFocus() {}
void CefWebContentsViewOSR::GotFocus() { void CefWebContentsViewOSR::GotFocus(
content::RenderWidgetHostImpl* render_widget_host) {
if (web_contents_) { if (web_contents_) {
content::WebContentsImpl* web_contents_impl = content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_); static_cast<content::WebContentsImpl*>(web_contents_);
if (web_contents_impl) if (web_contents_impl)
web_contents_impl->NotifyWebContentsFocused(); web_contents_impl->NotifyWebContentsFocused(render_widget_host);
}
}
void CefWebContentsViewOSR::LostFocus(
content::RenderWidgetHostImpl* render_widget_host) {
if (web_contents_) {
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);
if (web_contents_impl)
web_contents_impl->NotifyWebContentsLostFocus(render_widget_host);
} }
} }

View File

@ -14,7 +14,7 @@ namespace content {
class BrowserPluginGuest; class BrowserPluginGuest;
class WebContents; class WebContents;
class WebContentsViewDelegate; class WebContentsViewDelegate;
} } // namespace content
class CefBrowserHostImpl; class CefBrowserHostImpl;
class CefRenderWidgetHostViewOSR; class CefRenderWidgetHostViewOSR;
@ -69,7 +69,10 @@ class CefWebContentsViewOSR : public content::WebContentsView,
const content::DragEventSourceInfo& event_info, const content::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override; content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::WebDragOperation operation) override; void UpdateDragCursor(blink::WebDragOperation operation) override;
virtual void GotFocus() override; virtual void GotFocus(
content::RenderWidgetHostImpl* render_widget_host) override;
virtual void LostFocus(
content::RenderWidgetHostImpl* render_widget_host) override;
virtual void TakeFocus(bool reverse) override; virtual void TakeFocus(bool reverse) override;
private: private:

View File

@ -22,7 +22,7 @@
#include "chrome/browser/plugins/plugins_field_trial.h" #include "chrome/browser/plugins/plugins_field_trial.h"
#include "chrome/common/features.h" #include "chrome/common/features.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/content_settings/core/browser/content_settings_utils.h" #include "components/content_settings/core/common/content_settings_utils.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"

View File

@ -94,8 +94,9 @@ void CefPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) {
NotifyInitializationCompleted(); NotifyInitializationCompleted();
} }
void CefPrefStore::CommitPendingWrite() { void CefPrefStore::CommitPendingWrite(base::OnceClosure done_callback) {
committed_ = true; committed_ = true;
PersistentPrefStore::CommitPendingWrite(std::move(done_callback));
} }
void CefPrefStore::SchedulePendingLossyWrites() {} void CefPrefStore::SchedulePendingLossyWrites() {}

View File

@ -45,7 +45,7 @@ class CefPrefStore : public PersistentPrefStore {
PrefReadError GetReadError() const override; PrefReadError GetReadError() const override;
PersistentPrefStore::PrefReadError ReadPrefs() override; PersistentPrefStore::PrefReadError ReadPrefs() override;
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
void CommitPendingWrite() override; virtual void CommitPendingWrite(base::OnceClosure done_callback) override;
void SchedulePendingLossyWrites() override; void SchedulePendingLossyWrites() override;
// Marks the store as having completed initialization. // Marks the store as having completed initialization.

View File

@ -173,8 +173,11 @@ void CefPrintViewManagerBase::OnDidPrintPage(
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
const auto& settings = document->settings(); const auto& settings = document->settings();
if ((settings.printer_is_ps2() || settings.printer_is_ps3()) && if (settings.printer_is_textonly()) {
!base::FeatureList::IsEnabled(features::kDisablePostScriptPrinting)) { print_job_->StartPdfToTextConversion(bytes, params.page_size);
} else if ((settings.printer_is_ps2() || settings.printer_is_ps3()) &&
!base::FeatureList::IsEnabled(
features::kDisablePostScriptPrinting)) {
print_job_->StartPdfToPostScriptConversion(bytes, params.content_area, print_job_->StartPdfToPostScriptConversion(bytes, params.content_area,
params.physical_offsets, params.physical_offsets,
settings.printer_is_ps2()); settings.printer_is_ps2());

View File

@ -16,7 +16,6 @@
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "base/guid.h" #include "base/guid.h"
#include "base/memory/scoped_vector.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "content/public/browser/plugin_service.h" #include "content/public/browser/plugin_service.h"

View File

@ -191,7 +191,7 @@ void CefSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {}
void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed( void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
int session_id, int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) { base::OnceCallback<void(bool ask_user, bool is_allowed)> callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
const content::SpeechRecognitionSessionContext& context = const content::SpeechRecognitionSessionContext& context =
@ -200,7 +200,8 @@ void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
// Make sure that initiators properly set the |render_process_id| field. // Make sure that initiators properly set the |render_process_id| field.
DCHECK_NE(context.render_process_id, 0); DCHECK_NE(context.render_process_id, 0);
callback.Run(false, true); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::BindOnce(std::move(callback), false, true));
} }
content::SpeechRecognitionEventListener* content::SpeechRecognitionEventListener*

View File

@ -42,7 +42,8 @@ class CefSpeechRecognitionManagerDelegate
// SpeechRecognitionManagerDelegate methods. // SpeechRecognitionManagerDelegate methods.
void CheckRecognitionIsAllowed( void CheckRecognitionIsAllowed(
int session_id, int session_id,
base::Callback<void(bool ask_user, bool is_allowed)> callback) override; base::OnceCallback<void(bool ask_user, bool is_allowed)> callback)
override;
content::SpeechRecognitionEventListener* GetEventListener() override; content::SpeechRecognitionEventListener* GetEventListener() override;
bool FilterProfanities(int render_process_id) override; bool FilterProfanities(int render_process_id) override;

View File

@ -103,6 +103,15 @@ CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() {
return parent_->GetBluetoothAllowedDevicesMap(); return parent_->GetBluetoothAllowedDevicesMap();
} }
content::BlobURLLoaderFactory*
CefStoragePartitionProxy::GetBlobURLLoaderFactory() {
return parent_->GetBlobURLLoaderFactory();
}
content::BlobRegistryWrapper* CefStoragePartitionProxy::GetBlobRegistry() {
return parent_->GetBlobRegistry();
}
void CefStoragePartitionProxy::ClearDataForOrigin( void CefStoragePartitionProxy::ClearDataForOrigin(
uint32_t remove_mask, uint32_t remove_mask,
uint32_t quota_storage_remove_mask, uint32_t quota_storage_remove_mask,

View File

@ -42,6 +42,8 @@ class CefStoragePartitionProxy : public content::StoragePartition {
content::PaymentAppContextImpl* GetPaymentAppContext() override; content::PaymentAppContextImpl* GetPaymentAppContext() override;
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override; content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
content::BlobURLLoaderFactory* GetBlobURLLoaderFactory() override;
content::BlobRegistryWrapper* GetBlobRegistry() override;
void ClearDataForOrigin(uint32_t remove_mask, void ClearDataForOrigin(uint32_t remove_mask,
uint32_t quota_storage_remove_mask, uint32_t quota_storage_remove_mask,
const GURL& storage_origin, const GURL& storage_origin,

View File

@ -53,12 +53,12 @@ CefBoxLayoutImpl::CefBoxLayoutImpl(const CefBoxLayoutSettings& settings)
: settings_(settings) {} : settings_(settings) {}
views::BoxLayout* CefBoxLayoutImpl::CreateLayout() { views::BoxLayout* CefBoxLayoutImpl::CreateLayout() {
views::BoxLayout* layout = views::BoxLayout* layout = new views::BoxLayout(
new views::BoxLayout(settings_.horizontal ? views::BoxLayout::kHorizontal settings_.horizontal ? views::BoxLayout::kHorizontal
: views::BoxLayout::kVertical, : views::BoxLayout::kVertical,
settings_.inside_border_horizontal_spacing, gfx::Insets(settings_.inside_border_vertical_spacing,
settings_.inside_border_vertical_spacing, settings_.inside_border_horizontal_spacing),
settings_.between_child_spacing); settings_.between_child_spacing);
layout->set_main_axis_alignment( layout->set_main_axis_alignment(
static_cast<views::BoxLayout::MainAxisAlignment>( static_cast<views::BoxLayout::MainAxisAlignment>(
settings_.main_axis_alignment)); settings_.main_axis_alignment));

View File

@ -653,8 +653,7 @@ CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::RequestFocus() {
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetBackgroundColor(cef_color_t color) { CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetBackgroundColor(cef_color_t color) {
CEF_REQUIRE_VALID_RETURN_VOID(); CEF_REQUIRE_VALID_RETURN_VOID();
content_view()->set_background( content_view()->SetBackground(views::CreateSolidBackground(color));
views::Background::CreateSolidBackground(color));
} }
CEF_VIEW_IMPL_T cef_color_t CEF_VIEW_IMPL_D::GetBackgroundColor() { CEF_VIEW_IMPL_T cef_color_t CEF_VIEW_IMPL_D::GetBackgroundColor() {

View File

@ -43,8 +43,8 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
// views::View-derived methods here. // views::View-derived methods here.
virtual void Initialize() { virtual void Initialize() {
// Use our defaults instead of the Views framework defaults. // Use our defaults instead of the Views framework defaults.
ParentClass::set_background(views::Background::CreateSolidBackground( ParentClass::SetBackground(
view_util::kDefaultBackgroundColor)); views::CreateSolidBackground(view_util::kDefaultBackgroundColor));
} }
// Returns the CefViewDelegate-derived delegate associated with this view. // Returns the CefViewDelegate-derived delegate associated with this view.
@ -63,7 +63,7 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
} }
// views::View methods: // views::View methods:
gfx::Size GetPreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
gfx::Size GetMinimumSize() const override; gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override; gfx::Size GetMaximumSize() const override;
int GetHeightForWidth(int w) const override; int GetHeightForWidth(int w) const override;
@ -87,7 +87,7 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
CefViewDelegateClass* cef_delegate_; CefViewDelegateClass* cef_delegate_;
}; };
CEF_VIEW_VIEW_T gfx::Size CEF_VIEW_VIEW_D::GetPreferredSize() const { CEF_VIEW_VIEW_T gfx::Size CEF_VIEW_VIEW_D::CalculatePreferredSize() const {
gfx::Size result; gfx::Size result;
if (cef_delegate()) { if (cef_delegate()) {
CefSize cef_size = cef_delegate()->GetPreferredSize(GetCefView()); CefSize cef_size = cef_delegate()->GetPreferredSize(GetCefView());
@ -95,7 +95,7 @@ CEF_VIEW_VIEW_T gfx::Size CEF_VIEW_VIEW_D::GetPreferredSize() const {
result = gfx::Size(cef_size.width, cef_size.height); result = gfx::Size(cef_size.width, cef_size.height);
} }
if (result.IsEmpty()) if (result.IsEmpty())
result = ParentClass::GetPreferredSize(); result = ParentClass::CalculatePreferredSize();
if (result.IsEmpty()) { if (result.IsEmpty()) {
// Some layouts like BoxLayout expect the preferred size to be non-empty. // Some layouts like BoxLayout expect the preferred size to be non-empty.
// The user may have set the size explicitly. Therefore return the current // The user may have set the size explicitly. Therefore return the current
@ -142,7 +142,7 @@ CEF_VIEW_VIEW_T int CEF_VIEW_VIEW_D::GetHeightForWidth(int w) const {
// Some layouts like FillLayout will ignore the preferred size if this view // Some layouts like FillLayout will ignore the preferred size if this view
// has no children. We want to use the preferred size if not otherwise // has no children. We want to use the preferred size if not otherwise
// specified. // specified.
result = GetPreferredSize().height(); result = ParentClass::GetPreferredSize().height();
} }
return result; return result;
} }

View File

@ -176,7 +176,7 @@ class CaptionlessFrameView : public views::NonClientFrameView {
client_view_bounds_.SetRect(0, 0, width(), height()); client_view_bounds_.SetRect(0, 0, width(), height());
} }
gfx::Size GetPreferredSize() const override { gfx::Size CalculatePreferredSize() const override {
return widget_->non_client_view() return widget_->non_client_view()
->GetWindowBoundsForClientBounds( ->GetWindowBoundsForClientBounds(
gfx::Rect(widget_->client_view()->GetPreferredSize())) gfx::Rect(widget_->client_view()->GetPreferredSize()))

View File

@ -3,9 +3,12 @@
// can be found in the LICENSE file. // can be found in the LICENSE file.
#include "libcef/browser/x509_certificate_impl.h" #include "libcef/browser/x509_certificate_impl.h"
#include "libcef/browser/x509_cert_principal_impl.h" #include "libcef/browser/x509_cert_principal_impl.h"
#include "libcef/common/time_util.h" #include "libcef/common/time_util.h"
#include "net/ssl/ssl_private_key.h"
namespace { namespace {
CefRefPtr<CefBinaryValue> EncodeCertificate( CefRefPtr<CefBinaryValue> EncodeCertificate(
@ -24,6 +27,10 @@ CefRefPtr<CefBinaryValue> EncodeCertificate(
} // namespace } // namespace
CefX509CertificateImpl::CefX509CertificateImpl(
std::unique_ptr<net::ClientCertIdentity> identity)
: identity_(std::move(identity)), cert_(identity_->certificate()) {}
CefX509CertificateImpl::CefX509CertificateImpl( CefX509CertificateImpl::CefX509CertificateImpl(
scoped_refptr<net::X509Certificate> cert) scoped_refptr<net::X509Certificate> cert)
: cert_(cert) {} : cert_(cert) {}
@ -92,6 +99,15 @@ size_t CefX509CertificateImpl::GetIssuerChainSize() {
return 0; return 0;
} }
void CefX509CertificateImpl::AcquirePrivateKey(
const base::Callback<void(scoped_refptr<net::SSLPrivateKey>)>&
private_key_callback) {
if (identity_)
identity_->AcquirePrivateKey(private_key_callback);
else
private_key_callback.Run(nullptr);
}
void CefX509CertificateImpl::GetEncodedIssuerChain( void CefX509CertificateImpl::GetEncodedIssuerChain(
CefX509Certificate::IssuerChainBinaryList& chain, CefX509Certificate::IssuerChainBinaryList& chain,
bool der) { bool der) {

View File

@ -8,13 +8,19 @@
#include "include/cef_x509_certificate.h" #include "include/cef_x509_certificate.h"
#include "net/cert/x509_certificate.h" #include <memory>
#include "net/ssl/client_cert_identity.h"
// CefX509Certificate implementation // CefX509Certificate implementation
class CefX509CertificateImpl : public CefX509Certificate { class CefX509CertificateImpl : public CefX509Certificate {
public: public:
explicit CefX509CertificateImpl(scoped_refptr<net::X509Certificate> cert); explicit CefX509CertificateImpl(scoped_refptr<net::X509Certificate> cert);
// Used with CefContentBrowserClient::SelectClientCertificate only.
explicit CefX509CertificateImpl(
std::unique_ptr<net::ClientCertIdentity> identity);
// CefX509Certificate methods. // CefX509Certificate methods.
CefRefPtr<CefX509CertPrincipal> GetSubject() override; CefRefPtr<CefX509CertPrincipal> GetSubject() override;
CefRefPtr<CefX509CertPrincipal> GetIssuer() override; CefRefPtr<CefX509CertPrincipal> GetIssuer() override;
@ -28,10 +34,14 @@ class CefX509CertificateImpl : public CefX509Certificate {
void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override; void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) override;
scoped_refptr<net::X509Certificate> GetInternalCertObject() { return cert_; } scoped_refptr<net::X509Certificate> GetInternalCertObject() { return cert_; }
void AcquirePrivateKey(
const base::Callback<void(scoped_refptr<net::SSLPrivateKey>)>&
private_key_callback);
private: private:
void GetEncodedIssuerChain(IssuerChainBinaryList& chain, bool der); void GetEncodedIssuerChain(IssuerChainBinaryList& chain, bool der);
std::unique_ptr<net::ClientCertIdentity> identity_;
scoped_refptr<net::X509Certificate> cert_; scoped_refptr<net::X509Certificate> cert_;
IssuerChainBinaryList pem_encoded_issuer_chain_; IssuerChainBinaryList pem_encoded_issuer_chain_;
IssuerChainBinaryList der_encoded_issuer_chain_; IssuerChainBinaryList der_encoded_issuer_chain_;

View File

@ -123,7 +123,7 @@ IPC_STRUCT_BEGIN(CefMsg_LoadRequest_Params)
// The URL to send in the "Referer" header field. Can be empty if there is // The URL to send in the "Referer" header field. Can be empty if there is
// no referrer. // no referrer.
IPC_STRUCT_MEMBER(GURL, referrer) IPC_STRUCT_MEMBER(GURL, referrer)
// One of the blink::WebReferrerPolicy values. // One of the cef_referrer_policy_t values.
IPC_STRUCT_MEMBER(int, referrer_policy) IPC_STRUCT_MEMBER(int, referrer_policy)
// Identifies the frame within the RenderView that sent the request. // Identifies the frame within the RenderView that sent the request.

View File

@ -2,9 +2,21 @@
"name": "content_browser", "name": "content_browser",
"display_name": "CEF", "display_name": "CEF",
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": {
"provides": {
"renderer": [
"blink::mojom::BudgetService",
"metrics::mojom::LeakDetector",
"mojom::ModuleEventSink",
"spellcheck::mojom::SpellCheckHost",
"startup_metric_utils::mojom::StartupMetricHost"
]
}
},
"navigation:frame": { "navigation:frame": {
"provides": { "provides": {
"renderer": [ "renderer": [
"blink::mojom::BudgetService",
"extensions::KeepAlive", "extensions::KeepAlive",
"extensions::mime_handler::MimeHandlerService" "extensions::mime_handler::MimeHandlerService"
] ]

View File

@ -90,42 +90,6 @@ class FileElementReader : public net::UploadFileElementReader {
DISALLOW_COPY_AND_ASSIGN(FileElementReader); DISALLOW_COPY_AND_ASSIGN(FileElementReader);
}; };
// GetURLRequestReferrerPolicy() and GetURLRequestReferrer() are based on
// SetReferrerForRequest() from
// content/browser/loader/resource_dispatcher_host_impl.cc
net::URLRequest::ReferrerPolicy GetURLRequestReferrerPolicy(
cef_referrer_policy_t policy) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
net::URLRequest::ReferrerPolicy net_referrer_policy =
net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
switch (static_cast<blink::WebReferrerPolicy>(policy)) {
case blink::kWebReferrerPolicyAlways:
case blink::kWebReferrerPolicyNever:
case blink::kWebReferrerPolicyOrigin:
net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER;
break;
case blink::kWebReferrerPolicyNoReferrerWhenDowngrade:
net_referrer_policy =
net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
break;
case blink::kWebReferrerPolicyOriginWhenCrossOrigin:
net_referrer_policy =
net::URLRequest::ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN;
break;
case blink::kWebReferrerPolicyDefault:
default:
net_referrer_policy =
command_line->HasSwitch(switches::kReducedReferrerGranularity)
? net::URLRequest::
REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN
: net::URLRequest::
CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
break;
}
return net_referrer_policy;
}
std::string GetURLRequestReferrer(const GURL& referrer_url) { std::string GetURLRequestReferrer(const GURL& referrer_url) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!referrer_url.is_valid() || if (!referrer_url.is_valid() ||
@ -251,6 +215,11 @@ CefRefPtr<CefRequest> CefRequest::Create() {
// CefRequestImpl ------------------------------------------------------------- // CefRequestImpl -------------------------------------------------------------
CefRequestImpl::CefRequestImpl() : read_only_(false), track_changes_(false) { CefRequestImpl::CefRequestImpl() : read_only_(false), track_changes_(false) {
// Verify that our enum matches Chromium's values.
static_assert(
REFERRER_POLICY_LAST_VALUE == net::URLRequest::MAX_REFERRER_POLICY,
"enum mismatch");
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
Reset(); Reset();
} }
@ -422,30 +391,8 @@ void CefRequestImpl::Set(net::URLRequest* request) {
// instance WebCore::FrameLoader::HideReferrer. // instance WebCore::FrameLoader::HideReferrer.
if (referrer.is_valid()) { if (referrer.is_valid()) {
referrer_url_ = referrer; referrer_url_ = referrer;
switch (request->referrer_policy()) { referrer_policy_ =
case net::URLRequest:: static_cast<cef_referrer_policy_t>(request->referrer_policy());
CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
referrer_policy_ = REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE;
break;
case net::URLRequest::
REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN:
referrer_policy_ = REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN;
break;
case net::URLRequest::ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN:
referrer_policy_ = REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN;
break;
case net::URLRequest::NEVER_CLEAR_REFERRER:
referrer_policy_ = REFERRER_POLICY_ALWAYS;
break;
case net::URLRequest::ORIGIN:
referrer_policy_ = REFERRER_POLICY_ORIGIN;
break;
case net::URLRequest::NO_REFERRER:
referrer_policy_ = REFERRER_POLICY_NEVER;
break;
case net::URLRequest::MAX_REFERRER_POLICY:
break;
}
} }
// Transfer request headers. // Transfer request headers.
@ -477,7 +424,8 @@ void CefRequestImpl::Get(net::URLRequest* request, bool changed_only) const {
if (ShouldSet(kChangedReferrer, changed_only)) { if (ShouldSet(kChangedReferrer, changed_only)) {
request->SetReferrer(GetURLRequestReferrer(referrer_url_)); request->SetReferrer(GetURLRequestReferrer(referrer_url_));
request->set_referrer_policy(GetURLRequestReferrerPolicy(referrer_policy_)); request->set_referrer_policy(
static_cast<net::URLRequest::ReferrerPolicy>(referrer_policy_));
} }
if (ShouldSet(kChangedHeaderMap, changed_only)) { if (ShouldSet(kChangedHeaderMap, changed_only)) {
@ -516,7 +464,7 @@ void CefRequestImpl::Set(
content::Referrer::SanitizeForRequest(params.url(), params.referrer()); content::Referrer::SanitizeForRequest(params.url(), params.referrer());
referrer_url_ = sanitized_referrer.url; referrer_url_ = sanitized_referrer.url;
referrer_policy_ = referrer_policy_ =
static_cast<cef_referrer_policy_t>(sanitized_referrer.policy); BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer.policy);
resource_type_ = is_main_frame ? RT_MAIN_FRAME : RT_SUB_FRAME; resource_type_ = is_main_frame ? RT_MAIN_FRAME : RT_SUB_FRAME;
transition_type_ = transition_type_ =
@ -536,7 +484,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
::GetHeaderMap(request, headermap_, referrer_url_); ::GetHeaderMap(request, headermap_, referrer_url_);
referrer_policy_ = referrer_policy_ =
static_cast<cef_referrer_policy_t>(request.GetReferrerPolicy()); BlinkReferrerPolicyToNetReferrerPolicy(request.GetReferrerPolicy());
const blink::WebHTTPBody& body = request.HttpBody(); const blink::WebHTTPBody& body = request.HttpBody();
if (!body.IsNull()) { if (!body.IsNull()) {
@ -565,11 +513,11 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
if (!referrer_url_.is_empty()) { if (!referrer_url_.is_empty()) {
const blink::WebString& referrer = const blink::WebString& referrer =
blink::WebSecurityPolicy::GenerateReferrerHeader( blink::WebSecurityPolicy::GenerateReferrerHeader(
static_cast<blink::WebReferrerPolicy>(referrer_policy_), url_, NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_), url_,
blink::WebString::FromUTF8(referrer_url_.spec())); blink::WebString::FromUTF8(referrer_url_.spec()));
if (!referrer.IsEmpty()) { if (!referrer.IsEmpty()) {
request.SetHTTPReferrer( request.SetHTTPReferrer(
referrer, static_cast<blink::WebReferrerPolicy>(referrer_policy_)); referrer, NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_));
} }
} }
@ -616,11 +564,14 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
if (params.referrer.is_valid()) { if (params.referrer.is_valid()) {
const blink::WebString& referrer = const blink::WebString& referrer =
blink::WebSecurityPolicy::GenerateReferrerHeader( blink::WebSecurityPolicy::GenerateReferrerHeader(
static_cast<blink::WebReferrerPolicy>(params.referrer_policy), NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(params.referrer_policy)),
params.url, blink::WebString::FromUTF8(params.referrer.spec())); params.url, blink::WebString::FromUTF8(params.referrer.spec()));
if (!referrer.IsEmpty()) { if (!referrer.IsEmpty()) {
request.SetHTTPReferrer(referrer, static_cast<blink::WebReferrerPolicy>( request.SetHTTPReferrer(
params.referrer_policy)); referrer,
NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(params.referrer_policy)));
} }
} }
@ -691,7 +642,7 @@ void CefRequestImpl::Get(CefNavigateParams& params) const {
// Referrer policy will be applied later in the request pipeline. // Referrer policy will be applied later in the request pipeline.
params.referrer.url = referrer_url_; params.referrer.url = referrer_url_;
params.referrer.policy = params.referrer.policy =
static_cast<blink::WebReferrerPolicy>(referrer_policy_); NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_);
if (!headermap_.empty()) if (!headermap_.empty())
params.headers = HttpHeaderUtils::GenerateHeaders(headermap_); params.headers = HttpHeaderUtils::GenerateHeaders(headermap_);
@ -712,7 +663,8 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
if (!referrer_url_.is_empty()) { if (!referrer_url_.is_empty()) {
fetcher.SetReferrer(GetURLRequestReferrer(referrer_url_)); fetcher.SetReferrer(GetURLRequestReferrer(referrer_url_));
fetcher.SetReferrerPolicy(GetURLRequestReferrerPolicy(referrer_policy_)); fetcher.SetReferrerPolicy(
static_cast<net::URLRequest::ReferrerPolicy>(referrer_policy_));
} }
CefRequest::HeaderMap headerMap = headermap_; CefRequest::HeaderMap headerMap = headermap_;
@ -826,6 +778,63 @@ uint8_t CefRequestImpl::GetChanges() const {
return changes; return changes;
} }
// From content/child/web_url_loader_impl.cc
// static
blink::WebReferrerPolicy CefRequestImpl::NetReferrerPolicyToBlinkReferrerPolicy(
cef_referrer_policy_t net_policy) {
switch (net_policy) {
case REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
return blink::kWebReferrerPolicyNoReferrerWhenDowngrade;
case REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN:
return blink::
kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin;
case REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN:
return blink::kWebReferrerPolicyOriginWhenCrossOrigin;
case REFERRER_POLICY_NEVER_CLEAR_REFERRER:
return blink::kWebReferrerPolicyAlways;
case REFERRER_POLICY_ORIGIN:
return blink::kWebReferrerPolicyOrigin;
case REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_CROSS_ORIGIN:
return blink::kWebReferrerPolicySameOrigin;
case REFERRER_POLICY_ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
return blink::kWebReferrerPolicyStrictOrigin;
case REFERRER_POLICY_NO_REFERRER:
return blink::kWebReferrerPolicyNever;
case REFERRER_POLICY_LAST_VALUE:
NOTREACHED();
return blink::kWebReferrerPolicyDefault;
}
NOTREACHED();
return blink::kWebReferrerPolicyDefault;
}
// static
cef_referrer_policy_t CefRequestImpl::BlinkReferrerPolicyToNetReferrerPolicy(
blink::WebReferrerPolicy blink_policy) {
switch (blink_policy) {
case blink::kWebReferrerPolicyNoReferrerWhenDowngrade:
return REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
case blink::kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin:
return REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN;
case blink::kWebReferrerPolicyOriginWhenCrossOrigin:
return REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN;
case blink::kWebReferrerPolicyAlways:
return REFERRER_POLICY_NEVER_CLEAR_REFERRER;
case blink::kWebReferrerPolicyOrigin:
return REFERRER_POLICY_ORIGIN;
case blink::kWebReferrerPolicySameOrigin:
return REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_CROSS_ORIGIN;
case blink::kWebReferrerPolicyStrictOrigin:
return REFERRER_POLICY_ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
case blink::kWebReferrerPolicyNever:
return REFERRER_POLICY_NO_REFERRER;
case blink::kWebReferrerPolicyDefault:
return REFERRER_POLICY_DEFAULT;
}
NOTREACHED();
return REFERRER_POLICY_DEFAULT;
}
void CefRequestImpl::Changed(uint8_t changes) { void CefRequestImpl::Changed(uint8_t changes) {
lock_.AssertAcquired(); lock_.AssertAcquired();
if (track_changes_) if (track_changes_)

View File

@ -14,6 +14,7 @@
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "third_party/WebKit/public/platform/WebHTTPBody.h" #include "third_party/WebKit/public/platform/WebHTTPBody.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace navigation_interception { namespace navigation_interception {
@ -28,11 +29,11 @@ class UploadElement;
class UploadElementReader; class UploadElementReader;
class URLFetcher; class URLFetcher;
class URLRequest; class URLRequest;
}; }; // namespace net
namespace blink { namespace blink {
class WebURLRequest; class WebURLRequest;
} } // namespace blink
struct CefMsg_LoadRequest_Params; struct CefMsg_LoadRequest_Params;
struct CefNavigateParams; struct CefNavigateParams;
@ -118,6 +119,11 @@ class CefRequestImpl : public CefRequest {
void SetTrackChanges(bool track_changes); void SetTrackChanges(bool track_changes);
uint8_t GetChanges() const; uint8_t GetChanges() const;
static blink::WebReferrerPolicy NetReferrerPolicyToBlinkReferrerPolicy(
cef_referrer_policy_t net_policy);
static cef_referrer_policy_t BlinkReferrerPolicyToNetReferrerPolicy(
blink::WebReferrerPolicy blink_policy);
private: private:
void Changed(uint8_t changes); void Changed(uint8_t changes);
bool ShouldSet(uint8_t changes, bool changed_only) const; bool ShouldSet(uint8_t changes, bool changed_only) const;

View File

@ -10,12 +10,12 @@
CefResponseManager::CefResponseManager() : next_request_id_(0) {} CefResponseManager::CefResponseManager() : next_request_id_(0) {}
int CefResponseManager::GetNextRequestId() { int CefResponseManager::GetNextRequestId() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return ++next_request_id_; return ++next_request_id_;
} }
int CefResponseManager::RegisterHandler(CefRefPtr<Handler> handler) { int CefResponseManager::RegisterHandler(CefRefPtr<Handler> handler) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
int request_id = GetNextRequestId(); int request_id = GetNextRequestId();
TRACE_EVENT_ASYNC_BEGIN1("libcef", "CefResponseManager::Handler", request_id, TRACE_EVENT_ASYNC_BEGIN1("libcef", "CefResponseManager::Handler", request_id,
"request_id", request_id); "request_id", request_id);
@ -24,7 +24,7 @@ int CefResponseManager::RegisterHandler(CefRefPtr<Handler> handler) {
} }
bool CefResponseManager::RunHandler(const Cef_Response_Params& params) { bool CefResponseManager::RunHandler(const Cef_Response_Params& params) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_GT(params.request_id, 0); DCHECK_GT(params.request_id, 0);
HandlerMap::iterator it = handlers_.find(params.request_id); HandlerMap::iterator it = handlers_.find(params.request_id);
if (it != handlers_.end()) { if (it != handlers_.end()) {
@ -42,12 +42,12 @@ bool CefResponseManager::RunHandler(const Cef_Response_Params& params) {
void CefResponseManager::RegisterAckHandler(int request_id, void CefResponseManager::RegisterAckHandler(int request_id,
CefRefPtr<AckHandler> handler) { CefRefPtr<AckHandler> handler) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
ack_handlers_.insert(std::make_pair(request_id, handler)); ack_handlers_.insert(std::make_pair(request_id, handler));
} }
bool CefResponseManager::RunAckHandler(int request_id) { bool CefResponseManager::RunAckHandler(int request_id) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_GT(request_id, 0); DCHECK_GT(request_id, 0);
AckHandlerMap::iterator it = ack_handlers_.find(request_id); AckHandlerMap::iterator it = ack_handlers_.find(request_id);
if (it != ack_handlers_.end()) { if (it != ack_handlers_.end()) {

View File

@ -10,12 +10,12 @@
#include "include/cef_base.h" #include "include/cef_base.h"
#include "base/threading/non_thread_safe.h" #include "base/sequence_checker.h"
struct Cef_Response_Params; struct Cef_Response_Params;
// This class is not thread-safe. // This class is not thread-safe.
class CefResponseManager : base::NonThreadSafe { class CefResponseManager {
public: public:
// Used for handling response messages. // Used for handling response messages.
class Handler : public virtual CefBaseRefCounted { class Handler : public virtual CefBaseRefCounted {
@ -59,6 +59,8 @@ class CefResponseManager : base::NonThreadSafe {
// Map of unique request ids to AckHandler references. // Map of unique request ids to AckHandler references.
typedef std::map<int, CefRefPtr<AckHandler>> AckHandlerMap; typedef std::map<int, CefRefPtr<AckHandler>> AckHandlerMap;
AckHandlerMap ack_handlers_; AckHandlerMap ack_handlers_;
SEQUENCE_CHECKER(sequence_checker_);
}; };
#endif // CEF_LIBCEF_COMMON_RESPONSE_MANAGER_H_ #endif // CEF_LIBCEF_COMMON_RESPONSE_MANAGER_H_

View File

@ -28,7 +28,7 @@ CefRefPtr<CefThread> CefThread::CreateThread(
cef_message_loop_type_t message_loop_type, cef_message_loop_type_t message_loop_type,
bool stoppable, bool stoppable,
cef_com_init_mode_t com_init_mode) { cef_com_init_mode_t com_init_mode) {
if (!base::MessageLoop::current()) { if (!CefTaskRunnerImpl::GetCurrentTaskRunner()) {
NOTREACHED() << "called on invalid thread"; NOTREACHED() << "called on invalid thread";
return nullptr; return nullptr;
} }

View File

@ -42,6 +42,7 @@
#include "third_party/WebKit/public/web/WebView.h" #include "third_party/WebKit/public/web/WebView.h"
using blink::WebFrame; using blink::WebFrame;
using blink::WebLocalFrame;
using blink::WebScriptSource; using blink::WebScriptSource;
using blink::WebString; using blink::WebString;
using blink::WebURL; using blink::WebURL;
@ -108,26 +109,35 @@ bool CefBrowserImpl::IsLoading() {
void CefBrowserImpl::Reload() { void CefBrowserImpl::Reload() {
CEF_REQUIRE_RT_RETURN_VOID(); CEF_REQUIRE_RT_RETURN_VOID();
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) { if (render_view()->GetWebView()) {
render_view()->GetWebView()->MainFrame()->Reload( WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
blink::WebFrameLoadType::kReload); if (main_frame && main_frame->IsWebLocalFrame()) {
main_frame->ToWebLocalFrame()->Reload(blink::WebFrameLoadType::kReload);
}
} }
} }
void CefBrowserImpl::ReloadIgnoreCache() { void CefBrowserImpl::ReloadIgnoreCache() {
CEF_REQUIRE_RT_RETURN_VOID(); CEF_REQUIRE_RT_RETURN_VOID();
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) { if (render_view()->GetWebView()) {
render_view()->GetWebView()->MainFrame()->Reload( WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
blink::WebFrameLoadType::kReloadBypassingCache); if (main_frame && main_frame->IsWebLocalFrame()) {
main_frame->ToWebLocalFrame()->Reload(
blink::WebFrameLoadType::kReloadBypassingCache);
}
} }
} }
void CefBrowserImpl::StopLoad() { void CefBrowserImpl::StopLoad() {
CEF_REQUIRE_RT_RETURN_VOID(); CEF_REQUIRE_RT_RETURN_VOID();
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) if (render_view()->GetWebView()) {
render_view()->GetWebView()->MainFrame()->StopLoading(); WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
if (main_frame && main_frame->IsWebLocalFrame()) {
main_frame->ToWebLocalFrame()->StopLoading();
}
}
} }
int CefBrowserImpl::GetIdentifier() { int CefBrowserImpl::GetIdentifier() {
@ -152,16 +162,24 @@ bool CefBrowserImpl::IsPopup() {
bool CefBrowserImpl::HasDocument() { bool CefBrowserImpl::HasDocument() {
CEF_REQUIRE_RT_RETURN(false); CEF_REQUIRE_RT_RETURN(false);
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) if (render_view()->GetWebView()) {
return !render_view()->GetWebView()->MainFrame()->GetDocument().IsNull(); WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
if (main_frame && main_frame->IsWebLocalFrame()) {
return !main_frame->ToWebLocalFrame()->GetDocument().IsNull();
}
}
return false; return false;
} }
CefRefPtr<CefFrame> CefBrowserImpl::GetMainFrame() { CefRefPtr<CefFrame> CefBrowserImpl::GetMainFrame() {
CEF_REQUIRE_RT_RETURN(nullptr); CEF_REQUIRE_RT_RETURN(nullptr);
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) if (render_view()->GetWebView()) {
return GetWebFrameImpl(render_view()->GetWebView()->MainFrame()).get(); WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
if (main_frame && main_frame->IsWebLocalFrame()) {
return GetWebFrameImpl(main_frame->ToWebLocalFrame()).get();
}
}
return nullptr; return nullptr;
} }
@ -188,21 +206,24 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
if (web_view) { 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). // Search by assigned frame name (Frame::name).
WebFrame* frame = WebFrame* frame = web_view->MainFrame();
web_view->FindFrameByName(frame_name, web_view->MainFrame()); if (frame && frame->IsWebLocalFrame())
frame = frame->ToWebLocalFrame()->FindFrameByName(frame_name);
if (!frame) { if (!frame) {
// Search by unique frame name (Frame::uniqueName). // Search by unique frame name (Frame::uniqueName).
const std::string& searchname = name; const std::string& searchname = name;
for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame; for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame;
cur_frame = cur_frame->TraverseNext()) { cur_frame = cur_frame->TraverseNext()) {
if (render_frame_util::GetUniqueName(cur_frame) == searchname) { if (cur_frame->IsWebLocalFrame() &&
render_frame_util::GetUniqueName(cur_frame->ToWebLocalFrame()) ==
searchname) {
frame = cur_frame; frame = cur_frame;
break; break;
} }
} }
} }
if (frame) if (frame && frame->IsWebLocalFrame())
return GetWebFrameImpl(frame).get(); return GetWebFrameImpl(frame->ToWebLocalFrame()).get();
} }
return nullptr; return nullptr;
@ -232,7 +253,9 @@ void CefBrowserImpl::GetFrameIdentifiers(std::vector<int64>& identifiers) {
if (render_view()->GetWebView()) { if (render_view()->GetWebView()) {
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
frame = frame->TraverseNext()) { frame = frame->TraverseNext()) {
identifiers.push_back(render_frame_util::GetIdentifier(frame)); if (frame->IsWebLocalFrame())
identifiers.push_back(
render_frame_util::GetIdentifier(frame->ToWebLocalFrame()));
} }
} }
} }
@ -246,7 +269,9 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
if (render_view()->GetWebView()) { if (render_view()->GetWebView()) {
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
frame = frame->TraverseNext()) { frame = frame->TraverseNext()) {
names.push_back(render_frame_util::GetUniqueName(frame)); if (frame->IsWebLocalFrame())
names.push_back(
render_frame_util::GetUniqueName(frame->ToWebLocalFrame()));
} }
} }
} }
@ -285,7 +310,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
if (!framePtr.get()) if (!framePtr.get())
return; return;
WebFrame* web_frame = framePtr->web_frame(); WebLocalFrame* web_frame = framePtr->web_frame();
blink::WebURLRequest request; blink::WebURLRequest request;
CefRequestImpl::Get(params, request); CefRequestImpl::Get(params, request);
@ -313,7 +338,7 @@ bool CefBrowserImpl::SendProcessMessage(CefProcessId target_process,
} }
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl( CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
blink::WebFrame* frame) { blink::WebLocalFrame* frame) {
DCHECK(frame); DCHECK(frame);
int64_t frame_id = render_frame_util::GetIdentifier(frame); int64_t frame_id = render_frame_util::GetIdentifier(frame);
@ -325,10 +350,12 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
CefRefPtr<CefFrameImpl> framePtr(new CefFrameImpl(this, frame)); CefRefPtr<CefFrameImpl> framePtr(new CefFrameImpl(this, frame));
frames_.insert(std::make_pair(frame_id, framePtr)); frames_.insert(std::make_pair(frame_id, framePtr));
const int64_t parent_id = const int64_t parent_id = frame->Parent() == NULL
frame->Parent() == NULL ? webkit_glue::kInvalidFrameId
? webkit_glue::kInvalidFrameId : frame->Parent()->IsWebLocalFrame()
: render_frame_util::GetIdentifier(frame->Parent()); ? render_frame_util::GetIdentifier(
frame->Parent()->ToWebLocalFrame())
: webkit_glue::kInvalidFrameId;
const base::string16& name = const base::string16& name =
base::UTF8ToUTF16(render_frame_util::GetUniqueName(frame)); base::UTF8ToUTF16(render_frame_util::GetUniqueName(frame));
@ -340,8 +367,12 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) { CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
if (frame_id == webkit_glue::kInvalidFrameId) { if (frame_id == webkit_glue::kInvalidFrameId) {
if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) if (render_view()->GetWebView()) {
return GetWebFrameImpl(render_view()->GetWebView()->MainFrame()); WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
if (main_frame && main_frame->IsWebLocalFrame()) {
return GetWebFrameImpl(main_frame->ToWebLocalFrame());
}
}
return nullptr; return nullptr;
} }
@ -354,8 +385,11 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
// Check if the frame exists but we don't know about it yet. // Check if the frame exists but we don't know about it yet.
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
frame = frame->TraverseNext()) { frame = frame->TraverseNext()) {
if (render_frame_util::GetIdentifier(frame) == frame_id) if (frame->IsWebLocalFrame() &&
return GetWebFrameImpl(frame); render_frame_util::GetIdentifier(frame->ToWebLocalFrame()) ==
frame_id) {
return GetWebFrameImpl(frame->ToWebLocalFrame());
}
} }
} }
@ -435,7 +469,7 @@ void CefBrowserImpl::DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
OnLoadStart(frame); OnLoadStart(frame);
} }
void CefBrowserImpl::FrameDetached(WebFrame* frame) { void CefBrowserImpl::FrameDetached(WebLocalFrame* frame) {
int64_t frame_id = render_frame_util::GetIdentifier(frame); int64_t frame_id = render_frame_util::GetIdentifier(frame);
if (!frames_.empty()) { if (!frames_.empty()) {
@ -467,10 +501,13 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) {
const blink::WebDocument& document = node.GetDocument(); const blink::WebDocument& document = node.GetDocument();
if (!document.IsNull()) { if (!document.IsNull()) {
blink::WebFrame* frame = document.GetFrame(); blink::WebFrame* frame = document.GetFrame();
if (!frame->IsWebLocalFrame())
return;
CefRefPtr<CefDOMDocumentImpl> documentImpl = CefRefPtr<CefDOMDocumentImpl> documentImpl =
new CefDOMDocumentImpl(this, frame); new CefDOMDocumentImpl(this, frame->ToWebLocalFrame());
handler->OnFocusedNodeChanged(this, GetWebFrameImpl(frame).get(), handler->OnFocusedNodeChanged(
documentImpl->GetOrCreateNode(node)); this, GetWebFrameImpl(frame->ToWebLocalFrame()).get(),
documentImpl->GetOrCreateNode(node));
documentImpl->Detach(); documentImpl->Detach();
} }
} }
@ -479,7 +516,7 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) {
} }
// Based on ExtensionHelper::DraggableRegionsChanged. // Based on ExtensionHelper::DraggableRegionsChanged.
void CefBrowserImpl::DraggableRegionsChanged(blink::WebFrame* frame) { void CefBrowserImpl::DraggableRegionsChanged(blink::WebLocalFrame* frame) {
blink::WebVector<blink::WebDraggableRegion> webregions = blink::WebVector<blink::WebDraggableRegion> webregions =
frame->GetDocument().DraggableRegions(); frame->GetDocument().DraggableRegions();
std::vector<Cef_DraggableRegion_Params> regions; std::vector<Cef_DraggableRegion_Params> regions;
@ -535,7 +572,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
// Execute code. // Execute code.
CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id); CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id);
if (framePtr.get()) { if (framePtr.get()) {
WebFrame* web_frame = framePtr->web_frame(); WebLocalFrame* web_frame = framePtr->web_frame();
if (web_frame) { if (web_frame) {
DCHECK_EQ(params.arguments.GetSize(), (size_t)4); DCHECK_EQ(params.arguments.GetSize(), (size_t)4);
@ -565,7 +602,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
// Execute command. // Execute command.
CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id); CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id);
if (framePtr.get()) { if (framePtr.get()) {
WebFrame* web_frame = framePtr->web_frame(); WebLocalFrame* web_frame = framePtr->web_frame();
if (web_frame) { if (web_frame) {
DCHECK_EQ(params.arguments.GetSize(), (size_t)1); DCHECK_EQ(params.arguments.GetSize(), (size_t)1);
@ -575,17 +612,13 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
DCHECK(!command.empty()); DCHECK(!command.empty());
if (base::LowerCaseEqualsASCII(command, "getsource")) { if (base::LowerCaseEqualsASCII(command, "getsource")) {
if (web_frame->IsWebLocalFrame()) { response =
response = blink::WebFrameContentDumper::DumpAsMarkup( blink::WebFrameContentDumper::DumpAsMarkup(web_frame).Utf8();
web_frame->ToWebLocalFrame()) success = true;
.Utf8();
success = true;
}
} else if (base::LowerCaseEqualsASCII(command, "gettext")) { } else if (base::LowerCaseEqualsASCII(command, "gettext")) {
response = webkit_glue::DumpDocumentText(web_frame); response = webkit_glue::DumpDocumentText(web_frame);
success = true; success = true;
} else if (web_frame->IsWebLocalFrame() && } else if (web_frame->ExecuteCommand(
web_frame->ToWebLocalFrame()->ExecuteCommand(
blink::WebString::FromUTF8(command))) { blink::WebString::FromUTF8(command))) {
success = true; success = true;
} }
@ -595,7 +628,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
// Load a string. // Load a string.
CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id); CefRefPtr<CefFrameImpl> framePtr = GetWebFrameImpl(params.frame_id);
if (framePtr.get()) { if (framePtr.get()) {
WebFrame* web_frame = framePtr->web_frame(); WebLocalFrame* web_frame = framePtr->web_frame();
if (web_frame) { if (web_frame) {
DCHECK_EQ(params.arguments.GetSize(), (size_t)2); DCHECK_EQ(params.arguments.GetSize(), (size_t)2);

View File

@ -32,8 +32,9 @@ class ListValue;
} }
namespace blink { namespace blink {
class WebFrame;
class WebNode; class WebNode;
} } // namespace blink
// Renderer plumbing for CEF features. There is a one-to-one relationship // Renderer plumbing for CEF features. There is a one-to-one relationship
// between RenderView on the renderer side and RenderViewHost on the browser // between RenderView on the renderer side and RenderViewHost on the browser
@ -91,7 +92,7 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
bool user_initiated); bool user_initiated);
// Returns the matching CefFrameImpl reference or creates a new one. // Returns the matching CefFrameImpl reference or creates a new one.
CefRefPtr<CefFrameImpl> GetWebFrameImpl(blink::WebFrame* frame); CefRefPtr<CefFrameImpl> GetWebFrameImpl(blink::WebLocalFrame* frame);
CefRefPtr<CefFrameImpl> GetWebFrameImpl(int64_t frame_id); CefRefPtr<CefFrameImpl> GetWebFrameImpl(int64_t frame_id);
// Frame objects will be deleted immediately before the frame is closed. // Frame objects will be deleted immediately before the frame is closed.
@ -114,14 +115,14 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
const blink::WebURLError& error) override; const blink::WebURLError& error) override;
void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
bool is_new_navigation) override; bool is_new_navigation) override;
void DraggableRegionsChanged(blink::WebFrame* frame) override;
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
// Forwarded from CefRenderFrameObserver. // Forwarded from CefRenderFrameObserver.
void DidFinishLoad(blink::WebLocalFrame* frame); void DidFinishLoad(blink::WebLocalFrame* frame);
void DidStartProvisionalLoad(blink::WebLocalFrame* frame); void DidStartProvisionalLoad(blink::WebLocalFrame* frame);
void FrameDetached(blink::WebFrame* frame); void FrameDetached(blink::WebLocalFrame* frame);
void FocusedNodeChanged(const blink::WebNode& node); void FocusedNodeChanged(const blink::WebNode& node);
void DraggableRegionsChanged(blink::WebLocalFrame* frame);
private: private:
// RenderViewObserver::OnMessageReceived message handlers. // RenderViewObserver::OnMessageReceived message handlers.

View File

@ -282,8 +282,6 @@ void CefContentRendererClient::WebKitInitialized() {
blink::WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(scheme); blink::WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(scheme);
if (info.is_secure) if (info.is_secure)
webkit_glue::RegisterURLSchemeAsSecure(scheme); webkit_glue::RegisterURLSchemeAsSecure(scheme);
if (info.is_cors_enabled)
webkit_glue::RegisterURLSchemeAsCORSEnabled(scheme);
} }
} }
@ -535,6 +533,9 @@ bool CefContentRendererClient::HandleNavigation(
blink::WebNavigationType type, blink::WebNavigationType type,
blink::WebNavigationPolicy default_policy, blink::WebNavigationPolicy default_policy,
bool is_redirect) { bool is_redirect) {
if (!frame->IsWebLocalFrame())
return false;
CefRefPtr<CefApp> application = CefContentClient::Get()->application(); CefRefPtr<CefApp> application = CefContentClient::Get()->application();
if (application.get()) { if (application.get()) {
CefRefPtr<CefRenderProcessHandler> handler = CefRefPtr<CefRenderProcessHandler> handler =
@ -543,7 +544,8 @@ bool CefContentRendererClient::HandleNavigation(
CefRefPtr<CefBrowserImpl> browserPtr = CefRefPtr<CefBrowserImpl> browserPtr =
CefBrowserImpl::GetBrowserForMainFrame(frame->Top()); CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
if (browserPtr.get()) { if (browserPtr.get()) {
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame); CefRefPtr<CefFrameImpl> framePtr =
browserPtr->GetWebFrameImpl(frame->ToWebLocalFrame());
CefRefPtr<CefRequest> requestPtr(CefRequest::Create()); CefRefPtr<CefRequest> requestPtr(CefRequest::Create());
CefRequestImpl* requestImpl = CefRequestImpl* requestImpl =
static_cast<CefRequestImpl*>(requestPtr.get()); static_cast<CefRequestImpl*>(requestPtr.get());
@ -611,6 +613,7 @@ bool CefContentRendererClient::WillSendRequest(
blink::WebLocalFrame* frame, blink::WebLocalFrame* frame,
ui::PageTransition transition_type, ui::PageTransition transition_type,
const blink::WebURL& url, const blink::WebURL& url,
std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles,
GURL* new_url) { GURL* new_url) {
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
return extensions_renderer_client_->WillSendRequest(frame, transition_type, return extensions_renderer_client_->WillSendRequest(frame, transition_type,

View File

@ -28,7 +28,7 @@ class ExtensionsClient;
class ExtensionsGuestViewContainerDispatcher; class ExtensionsGuestViewContainerDispatcher;
class ExtensionsRendererClient; class ExtensionsRendererClient;
class ResourceRequestPolicy; class ResourceRequestPolicy;
} } // namespace extensions
namespace web_cache { namespace web_cache {
class WebCacheImpl; class WebCacheImpl;
@ -110,10 +110,12 @@ class CefContentRendererClient : public content::ContentRendererClient,
bool is_initial_navigation, bool is_initial_navigation,
bool is_server_redirect, bool is_server_redirect,
bool* send_referrer) override; bool* send_referrer) override;
bool WillSendRequest(blink::WebLocalFrame* frame, bool WillSendRequest(
ui::PageTransition transition_type, blink::WebLocalFrame* frame,
const blink::WebURL& url, ui::PageTransition transition_type,
GURL* new_url) override; const blink::WebURL& url,
std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles,
GURL* new_url) override;
unsigned long long VisitedLinkHash(const char* canonical_url, unsigned long long VisitedLinkHash(const char* canonical_url,
size_t length) override; size_t length) override;
bool IsLinkVisited(unsigned long long link_hash) override; bool IsLinkVisited(unsigned long long link_hash) override;

View File

@ -11,20 +11,20 @@
#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h" #include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebRange.h" #include "third_party/WebKit/public/web/WebRange.h"
using blink::WebDocument; using blink::WebDocument;
using blink::WebElement; using blink::WebElement;
using blink::WebFrame; using blink::WebLocalFrame;
using blink::WebNode; using blink::WebNode;
using blink::WebRange; using blink::WebRange;
using blink::WebString; using blink::WebString;
using blink::WebURL; using blink::WebURL;
CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser, WebFrame* frame) CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser,
WebLocalFrame* frame)
: browser_(browser), frame_(frame) { : browser_(browser), frame_(frame) {
const WebDocument& document = frame_->GetDocument(); const WebDocument& document = frame_->GetDocument();
DCHECK(!document.IsNull()); DCHECK(!document.IsNull());
@ -90,21 +90,20 @@ CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
} }
bool CefDOMDocumentImpl::HasSelection() { bool CefDOMDocumentImpl::HasSelection() {
if (!VerifyContext() || !frame_->IsWebLocalFrame()) if (!VerifyContext())
return false; return false;
return frame_->ToWebLocalFrame()->HasSelection(); return frame_->HasSelection();
} }
int CefDOMDocumentImpl::GetSelectionStartOffset() { int CefDOMDocumentImpl::GetSelectionStartOffset() {
if (!VerifyContext() || !frame_->IsWebLocalFrame()) if (!VerifyContext())
return 0; return 0;
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); if (!frame_->HasSelection())
if (!!local_frame->HasSelection())
return 0; return 0;
const WebRange& range = local_frame->SelectionRange(); const WebRange& range = frame_->SelectionRange();
if (range.IsNull()) if (range.IsNull())
return 0; return 0;
@ -112,14 +111,13 @@ int CefDOMDocumentImpl::GetSelectionStartOffset() {
} }
int CefDOMDocumentImpl::GetSelectionEndOffset() { int CefDOMDocumentImpl::GetSelectionEndOffset() {
if (!VerifyContext() || !frame_->IsWebLocalFrame()) if (!VerifyContext())
return 0; return 0;
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); if (!frame_->HasSelection())
if (!!local_frame->HasSelection())
return 0; return 0;
const WebRange& range = local_frame->SelectionRange(); const WebRange& range = frame_->SelectionRange();
if (range.IsNull()) if (range.IsNull())
return 0; return 0;
@ -128,14 +126,13 @@ int CefDOMDocumentImpl::GetSelectionEndOffset() {
CefString CefDOMDocumentImpl::GetSelectionAsMarkup() { CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
CefString str; CefString str;
if (!VerifyContext() || !frame_->IsWebLocalFrame()) if (!VerifyContext())
return str; return str;
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); if (!frame_->HasSelection())
if (!!local_frame->HasSelection())
return str; return str;
const WebString& markup = local_frame->SelectionAsMarkup(); const WebString& markup = frame_->SelectionAsMarkup();
if (!markup.IsNull()) if (!markup.IsNull())
str = markup.Utf16(); str = markup.Utf16();
@ -144,14 +141,13 @@ CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
CefString CefDOMDocumentImpl::GetSelectionAsText() { CefString CefDOMDocumentImpl::GetSelectionAsText() {
CefString str; CefString str;
if (!VerifyContext() || !frame_->IsWebLocalFrame()) if (!VerifyContext())
return str; return str;
blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); if (!frame_->HasSelection())
if (!!local_frame->HasSelection())
return str; return str;
const WebString& text = local_frame->SelectionAsText(); const WebString& text = frame_->SelectionAsText();
if (!text.IsNull()) if (!text.IsNull())
str = text.Utf16(); str = text.Utf16();

View File

@ -10,15 +10,15 @@
#include "include/cef_dom.h" #include "include/cef_dom.h"
namespace blink { namespace blink {
class WebFrame; class WebLocalFrame;
class WebNode; class WebNode;
}; }; // namespace blink
class CefBrowserImpl; class CefBrowserImpl;
class CefDOMDocumentImpl : public CefDOMDocument { class CefDOMDocumentImpl : public CefDOMDocument {
public: public:
CefDOMDocumentImpl(CefBrowserImpl* browser, blink::WebFrame* frame); CefDOMDocumentImpl(CefBrowserImpl* browser, blink::WebLocalFrame* frame);
~CefDOMDocumentImpl() override; ~CefDOMDocumentImpl() override;
// CefDOMDocument methods. // CefDOMDocument methods.
@ -38,7 +38,7 @@ class CefDOMDocumentImpl : public CefDOMDocument {
CefString GetCompleteURL(const CefString& partialURL) override; CefString GetCompleteURL(const CefString& partialURL) override;
CefBrowserImpl* GetBrowser() { return browser_; } CefBrowserImpl* GetBrowser() { return browser_; }
blink::WebFrame* GetFrame() { return frame_; } blink::WebLocalFrame* GetFrame() { return frame_; }
// The document maintains a map of all existing node objects. // The document maintains a map of all existing node objects.
CefRefPtr<CefDOMNode> GetOrCreateNode(const blink::WebNode& node); CefRefPtr<CefDOMNode> GetOrCreateNode(const blink::WebNode& node);
@ -52,7 +52,7 @@ class CefDOMDocumentImpl : public CefDOMDocument {
protected: protected:
CefBrowserImpl* browser_; CefBrowserImpl* browser_;
blink::WebFrame* frame_; blink::WebLocalFrame* frame_;
typedef std::map<blink::WebNode, CefDOMNode*> NodeMap; typedef std::map<blink::WebNode, CefDOMNode*> NodeMap;
NodeMap node_map_; NodeMap node_map_;

View File

@ -18,7 +18,6 @@
#include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFormControlElement.h" #include "third_party/WebKit/public/web/WebFormControlElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebInputElement.h" #include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebNode.h" #include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebSelectElement.h" #include "third_party/WebKit/public/web/WebSelectElement.h"
@ -26,7 +25,6 @@
using blink::WebDocument; using blink::WebDocument;
using blink::WebDOMEvent; using blink::WebDOMEvent;
using blink::WebElement; using blink::WebElement;
using blink::WebFrame;
using blink::WebFormControlElement; using blink::WebFormControlElement;
using blink::WebInputElement; using blink::WebInputElement;
using blink::WebNode; using blink::WebNode;

View File

@ -117,6 +117,20 @@ int CefExtensionsRendererClient::GetLowestIsolatedWorldId() const {
return 1; return 1;
} }
extensions::Dispatcher* CefExtensionsRendererClient::GetDispatcher() {
return extension_dispatcher_.get();
}
void CefExtensionsRendererClient::OnExtensionLoaded(
const extensions::Extension& extension) {
resource_request_policy_->OnExtensionLoaded(extension);
}
void CefExtensionsRendererClient::OnExtensionUnloaded(
const extensions::ExtensionId& extension_id) {
resource_request_policy_->OnExtensionUnloaded(extension_id);
}
void CefExtensionsRendererClient::RenderThreadStarted() { void CefExtensionsRendererClient::RenderThreadStarted() {
content::RenderThread* thread = content::RenderThread::Get(); content::RenderThread* thread = content::RenderThread::Get();

View File

@ -19,13 +19,13 @@ class WebFrame;
class WebLocalFrame; class WebLocalFrame;
struct WebPluginParams; struct WebPluginParams;
class WebURL; class WebURL;
} } // namespace blink
namespace content { namespace content {
class BrowserPluginDelegate; class BrowserPluginDelegate;
class RenderFrame; class RenderFrame;
class RenderView; class RenderView;
} } // namespace content
namespace extensions { namespace extensions {
@ -42,6 +42,10 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
// ExtensionsRendererClient implementation. // ExtensionsRendererClient implementation.
bool IsIncognitoProcess() const override; bool IsIncognitoProcess() const override;
int GetLowestIsolatedWorldId() const override; int GetLowestIsolatedWorldId() const override;
extensions::Dispatcher* GetDispatcher() override;
void OnExtensionLoaded(const extensions::Extension& extension) override;
void OnExtensionUnloaded(
const extensions::ExtensionId& extension_id) override;
// See CefContentRendererClient methods with the same names. // See CefContentRendererClient methods with the same names.
void RenderThreadStarted(); void RenderThreadStarted();

View File

@ -26,7 +26,6 @@
#include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebFrameContentDumper.h" #include "third_party/WebKit/public/web/WebFrameContentDumper.h"
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h"
@ -35,7 +34,7 @@
using blink::WebString; using blink::WebString;
CefFrameImpl::CefFrameImpl(CefBrowserImpl* browser, blink::WebFrame* frame) CefFrameImpl::CefFrameImpl(CefBrowserImpl* browser, blink::WebLocalFrame* frame)
: browser_(browser), : browser_(browser),
frame_(frame), frame_(frame),
frame_id_(render_frame_util::GetIdentifier(frame)) {} frame_id_(render_frame_util::GetIdentifier(frame)) {}
@ -82,10 +81,9 @@ void CefFrameImpl::ViewSource() {
void CefFrameImpl::GetSource(CefRefPtr<CefStringVisitor> visitor) { void CefFrameImpl::GetSource(CefRefPtr<CefStringVisitor> visitor) {
CEF_REQUIRE_RT_RETURN_VOID(); CEF_REQUIRE_RT_RETURN_VOID();
if (frame_ && frame_->IsWebLocalFrame()) { if (frame_) {
const CefString& content = std::string( const CefString& content =
blink::WebFrameContentDumper::DumpAsMarkup(frame_->ToWebLocalFrame()) std::string(blink::WebFrameContentDumper::DumpAsMarkup(frame_).Utf8());
.Utf8());
visitor->Visit(content); visitor->Visit(content);
} }
} }
@ -205,8 +203,8 @@ CefRefPtr<CefFrame> CefFrameImpl::GetParent() {
if (frame_) { if (frame_) {
blink::WebFrame* parent = frame_->Parent(); blink::WebFrame* parent = frame_->Parent();
if (parent) if (parent && parent->IsWebLocalFrame())
return browser_->GetWebFrameImpl(parent).get(); return browser_->GetWebFrameImpl(parent->ToWebLocalFrame()).get();
} }
return NULL; return NULL;
@ -267,8 +265,8 @@ void CefFrameImpl::Detach() {
void CefFrameImpl::ExecuteCommand(const std::string& command) { void CefFrameImpl::ExecuteCommand(const std::string& command) {
CEF_REQUIRE_RT_RETURN_VOID(); CEF_REQUIRE_RT_RETURN_VOID();
if (frame_ && frame_->IsWebLocalFrame()) if (frame_)
frame_->ToWebLocalFrame()->ExecuteCommand(WebString::FromUTF8(command)); frame_->ExecuteCommand(WebString::FromUTF8(command));
} }
// Enable deprecation warnings for MSVC. See http://crbug.com/585142. // Enable deprecation warnings for MSVC. See http://crbug.com/585142.

View File

@ -13,7 +13,7 @@
class CefBrowserImpl; class CefBrowserImpl;
namespace blink { namespace blink {
class WebFrame; class WebLocalFrame;
} }
// Implementation of CefFrame. CefFrameImpl objects are owned by the // Implementation of CefFrame. CefFrameImpl objects are owned by the
@ -21,7 +21,7 @@ class WebFrame;
// associated renderer WebFrame will close. // associated renderer WebFrame will close.
class CefFrameImpl : public CefFrame { class CefFrameImpl : public CefFrame {
public: public:
CefFrameImpl(CefBrowserImpl* browser, blink::WebFrame* frame); CefFrameImpl(CefBrowserImpl* browser, blink::WebLocalFrame* frame);
~CefFrameImpl() override; ~CefFrameImpl() override;
// CefFrame implementation. // CefFrame implementation.
@ -54,13 +54,13 @@ class CefFrameImpl : public CefFrame {
void Detach(); void Detach();
blink::WebFrame* web_frame() const { return frame_; } blink::WebLocalFrame* web_frame() const { return frame_; }
private: private:
void ExecuteCommand(const std::string& command); void ExecuteCommand(const std::string& command);
CefBrowserImpl* browser_; CefBrowserImpl* browser_;
blink::WebFrame* frame_; blink::WebLocalFrame* frame_;
int64 frame_id_; int64 frame_id_;
IMPLEMENT_REFCOUNTING(CefFrameImpl); IMPLEMENT_REFCOUNTING(CefFrameImpl);

View File

@ -169,7 +169,10 @@ void CefPluginPlaceholder::PluginListChanged() {
if (!render_frame() || !plugin()) if (!render_frame() || !plugin())
return; return;
blink::WebLocalFrame* web_frame = render_frame()->GetWebFrame(); blink::WebLocalFrame* web_frame = render_frame()->GetWebFrame();
blink::WebDocument document = web_frame->Top()->GetDocument(); if (!web_frame->Top()->IsWebLocalFrame())
return;
blink::WebDocument document =
web_frame->Top()->ToWebLocalFrame()->GetDocument();
if (document.IsNull()) if (document.IsNull())
return; return;

View File

@ -73,6 +73,16 @@ void CefRenderFrameObserver::FocusedNodeChanged(const blink::WebNode& node) {
browserPtr->FocusedNodeChanged(node); browserPtr->FocusedNodeChanged(node);
} }
void CefRenderFrameObserver::DraggableRegionsChanged() {
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
CefRefPtr<CefBrowserImpl> browserPtr =
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
if (!browserPtr.get())
return;
browserPtr->DraggableRegionsChanged(frame);
}
void CefRenderFrameObserver::DidCreateScriptContext( void CefRenderFrameObserver::DidCreateScriptContext(
v8::Handle<v8::Context> context, v8::Handle<v8::Context> context,
int world_id) { int world_id) {

View File

@ -22,6 +22,7 @@ class CefRenderFrameObserver : public content::RenderFrameObserver {
void FrameDetached() override; void FrameDetached() override;
void FrameFocused() override; void FrameFocused() override;
void FocusedNodeChanged(const blink::WebNode& node) override; void FocusedNodeChanged(const blink::WebNode& node) override;
void DraggableRegionsChanged() override;
void DidCreateScriptContext(v8::Handle<v8::Context> context, void DidCreateScriptContext(v8::Handle<v8::Context> context,
int world_id) override; int world_id) override;
void WillReleaseScriptContext(v8::Handle<v8::Context> context, void WillReleaseScriptContext(v8::Handle<v8::Context> context,

View File

@ -12,7 +12,7 @@
namespace render_frame_util { namespace render_frame_util {
int64_t GetIdentifier(blink::WebFrame* frame) { int64_t GetIdentifier(blink::WebLocalFrame* frame) {
// Each WebFrame will have an associated RenderFrame. The RenderFrame // Each WebFrame will have an associated RenderFrame. The RenderFrame
// routing IDs are unique within a given renderer process. // routing IDs are unique within a given renderer process.
content::RenderFrame* render_frame = content::RenderFrame* render_frame =
@ -23,7 +23,7 @@ int64_t GetIdentifier(blink::WebFrame* frame) {
return webkit_glue::kInvalidFrameId; return webkit_glue::kInvalidFrameId;
} }
std::string GetUniqueName(blink::WebFrame* frame) { std::string GetUniqueName(blink::WebLocalFrame* frame) {
content::RenderFrameImpl* render_frame = content::RenderFrameImpl* render_frame =
content::RenderFrameImpl::FromWebFrame(frame); content::RenderFrameImpl::FromWebFrame(frame);
DCHECK(render_frame); DCHECK(render_frame);
@ -32,4 +32,4 @@ std::string GetUniqueName(blink::WebFrame* frame) {
return std::string(); return std::string();
} }
} // render_frame_util } // namespace render_frame_util

View File

@ -11,14 +11,14 @@
#include <string> #include <string>
namespace blink { namespace blink {
class WebFrame; class WebLocalFrame;
} }
namespace render_frame_util { namespace render_frame_util {
int64_t GetIdentifier(blink::WebFrame* frame); int64_t GetIdentifier(blink::WebLocalFrame* frame);
std::string GetUniqueName(blink::WebFrame* frame); std::string GetUniqueName(blink::WebLocalFrame* frame);
} // render_frame_util } // namespace render_frame_util
#endif // CEF_LIBCEF_RENDERER_RENDER_FRAME_UTIL_H_ #endif // CEF_LIBCEF_RENDERER_RENDER_FRAME_UTIL_H_

View File

@ -94,13 +94,19 @@ class CefRenderURLRequest::Context
if (!url.is_valid()) if (!url.is_valid())
return false; return false;
loader_ = blink::Platform::Current()->CreateURLLoader();
url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags())); url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags()));
WebURLRequest urlRequest; WebURLRequest urlRequest;
static_cast<CefRequestImpl*>(request_.get()) static_cast<CefRequestImpl*>(request_.get())
->Get(urlRequest, upload_data_size_); ->Get(urlRequest, upload_data_size_);
// Set the origin to match the request. The requirement for an origin is
// DCHECK'd in ResourceDispatcherHostImpl::ContinuePendingBeginRequest.
urlRequest.SetRequestorOrigin(
blink::WebSecurityOrigin::Create(urlRequest.Url()));
loader_ = blink::Platform::Current()->CreateURLLoader(urlRequest,
task_runner_.get());
loader_->LoadAsynchronously(urlRequest, url_client_.get()); loader_->LoadAsynchronously(urlRequest, url_client_.get());
return true; return true;
} }
@ -211,7 +217,7 @@ class CefRenderURLRequest::Context
CefRefPtr<CefRenderURLRequest> url_request_; CefRefPtr<CefRenderURLRequest> url_request_;
CefRefPtr<CefRequest> request_; CefRefPtr<CefRequest> request_;
CefRefPtr<CefURLRequestClient> client_; CefRefPtr<CefURLRequestClient> client_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
CefURLRequest::Status status_; CefURLRequest::Status status_;
CefURLRequest::ErrorCode error_code_; CefURLRequest::ErrorCode error_code_;
CefRefPtr<CefResponse> response_; CefRefPtr<CefResponse> response_;

View File

@ -883,7 +883,7 @@ CefRefPtr<CefBrowser> CefV8ContextImpl::GetBrowser() {
CefRefPtr<CefBrowser> browser; CefRefPtr<CefBrowser> browser;
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(browser); CEF_V8_REQUIRE_VALID_HANDLE_RETURN(browser);
blink::WebFrame* webframe = GetWebFrame(); blink::WebLocalFrame* webframe = GetWebFrame();
if (webframe) if (webframe)
browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->Top()); browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->Top());
@ -894,7 +894,7 @@ CefRefPtr<CefFrame> CefV8ContextImpl::GetFrame() {
CefRefPtr<CefFrame> frame; CefRefPtr<CefFrame> frame;
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(frame); CEF_V8_REQUIRE_VALID_HANDLE_RETURN(frame);
blink::WebFrame* webframe = GetWebFrame(); blink::WebLocalFrame* webframe = GetWebFrame();
if (webframe) { if (webframe) {
CefRefPtr<CefBrowserImpl> browser = CefRefPtr<CefBrowserImpl> browser =
CefBrowserImpl::GetBrowserForMainFrame(webframe->Top()); CefBrowserImpl::GetBrowserForMainFrame(webframe->Top());
@ -1023,7 +1023,7 @@ v8::Local<v8::Context> CefV8ContextImpl::GetV8Context() {
return handle_->GetNewV8Handle(); return handle_->GetNewV8Handle();
} }
blink::WebFrame* CefV8ContextImpl::GetWebFrame() { blink::WebLocalFrame* CefV8ContextImpl::GetWebFrame() {
CEF_REQUIRE_RT(); CEF_REQUIRE_RT();
if (webkit_glue::IsScriptForbidden()) if (webkit_glue::IsScriptForbidden())

View File

@ -21,7 +21,7 @@ class CefTrackNode;
class GURL; class GURL;
namespace blink { namespace blink {
class WebFrame; class WebLocalFrame;
}; };
// Call after a V8 Isolate has been created and entered for the first time. // Call after a V8 Isolate has been created and entered for the first time.
@ -177,7 +177,7 @@ class CefV8ContextImpl : public CefV8Context {
CefRefPtr<CefV8Exception>& exception) override; CefRefPtr<CefV8Exception>& exception) override;
v8::Local<v8::Context> GetV8Context(); v8::Local<v8::Context> GetV8Context();
blink::WebFrame* GetWebFrame(); blink::WebLocalFrame* GetWebFrame();
private: private:
typedef CefV8Handle<v8::Context> Handle; typedef CefV8Handle<v8::Context> Handle;

View File

@ -66,7 +66,7 @@ void GoForward(blink::WebView* view) {
impl->Client()->NavigateBackForwardSoon(1); impl->Client()->NavigateBackForwardSoon(1);
} }
std::string DumpDocumentText(blink::WebFrame* frame) { std::string DumpDocumentText(blink::WebLocalFrame* frame) {
// We use the document element's text instead of the body text here because // We use the document element's text instead of the body text here because
// not all documents have a body, such as XML documents. // not all documents have a body, such as XML documents.
blink::WebElement document_element = frame->GetDocument().DocumentElement(); blink::WebElement document_element = frame->GetDocument().DocumentElement();
@ -201,10 +201,6 @@ void RegisterURLSchemeAsSecure(const blink::WebString& scheme) {
blink::SchemeRegistry::RegisterURLSchemeAsSecure(scheme); blink::SchemeRegistry::RegisterURLSchemeAsSecure(scheme);
} }
void RegisterURLSchemeAsCORSEnabled(const blink::WebString& scheme) {
blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(scheme);
}
struct CefScriptForbiddenScope::Impl { struct CefScriptForbiddenScope::Impl {
blink::ScriptForbiddenScope scope_; blink::ScriptForbiddenScope scope_;
}; };
@ -213,4 +209,4 @@ CefScriptForbiddenScope::CefScriptForbiddenScope() : impl_(new Impl()) {}
CefScriptForbiddenScope::~CefScriptForbiddenScope() {} CefScriptForbiddenScope::~CefScriptForbiddenScope() {}
} // webkit_glue } // namespace webkit_glue

View File

@ -19,11 +19,11 @@
namespace blink { namespace blink {
class WebElement; class WebElement;
class WebFrame; class WebLocalFrame;
class WebNode; class WebNode;
class WebString; class WebString;
class WebView; class WebView;
} } // namespace blink
namespace webkit_glue { namespace webkit_glue {
@ -35,7 +35,7 @@ BLINK_EXPORT void GoBack(blink::WebView* view);
BLINK_EXPORT void GoForward(blink::WebView* view); BLINK_EXPORT void GoForward(blink::WebView* view);
// Returns the text of the document element. // Returns the text of the document element.
BLINK_EXPORT std::string DumpDocumentText(blink::WebFrame* frame); BLINK_EXPORT std::string DumpDocumentText(blink::WebLocalFrame* frame);
// Expose additional actions on WebNode. // Expose additional actions on WebNode.
BLINK_EXPORT cef_dom_node_type_t GetNodeType(const blink::WebNode& node); BLINK_EXPORT cef_dom_node_type_t GetNodeType(const blink::WebNode& node);
@ -67,8 +67,6 @@ BLINK_EXPORT bool IsScriptForbidden();
BLINK_EXPORT void RegisterURLSchemeAsLocal(const blink::WebString& scheme); BLINK_EXPORT void RegisterURLSchemeAsLocal(const blink::WebString& scheme);
BLINK_EXPORT void RegisterURLSchemeAsSecure(const blink::WebString& scheme); BLINK_EXPORT void RegisterURLSchemeAsSecure(const blink::WebString& scheme);
BLINK_EXPORT void RegisterURLSchemeAsCORSEnabled(
const blink::WebString& scheme);
// Wrapper for blink::ScriptForbiddenScope. // Wrapper for blink::ScriptForbiddenScope.
class BLINK_EXPORT CefScriptForbiddenScope final { class BLINK_EXPORT CefScriptForbiddenScope final {
@ -83,6 +81,6 @@ class BLINK_EXPORT CefScriptForbiddenScope final {
DISALLOW_COPY_AND_ASSIGN(CefScriptForbiddenScope); DISALLOW_COPY_AND_ASSIGN(CefScriptForbiddenScope);
}; };
} // webkit_glue } // namespace webkit_glue
#endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_ #endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_

View File

@ -8,7 +8,6 @@
#include <utility> #include <utility>
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/utility/utility_message_handler.h" #include "chrome/utility/utility_message_handler.h"
#include "components/printing/service/public/cpp/pdf_compositor_service_factory.h" #include "components/printing/service/public/cpp/pdf_compositor_service_factory.h"
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
@ -26,7 +25,6 @@
namespace { namespace {
void CreateProxyResolverFactory( void CreateProxyResolverFactory(
const service_manager::BindSourceInfo& source_info,
net::interfaces::ProxyResolverFactoryRequest request) { net::interfaces::ProxyResolverFactoryRequest request) {
mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(), mojo::MakeStrongBinding(base::MakeUnique<net::MojoProxyResolverFactoryImpl>(),
std::move(request)); std::move(request));
@ -36,7 +34,7 @@ void CreateProxyResolverFactory(
CefContentUtilityClient::CefContentUtilityClient() { CefContentUtilityClient::CefContentUtilityClient() {
#if defined(OS_WIN) #if defined(OS_WIN)
handlers_.push_back(new printing::PrintingHandler()); handlers_.push_back(base::MakeUnique<printing::PrintingHandler>());
#endif #endif
} }
@ -73,7 +71,7 @@ bool CefContentUtilityClient::OnMessageReceived(const IPC::Message& message) {
} }
void CefContentUtilityClient::RegisterServices(StaticServiceMap* services) { void CefContentUtilityClient::RegisterServices(StaticServiceMap* services) {
content::ServiceInfo pdf_compositor_info; service_manager::EmbeddedServiceInfo pdf_compositor_info;
pdf_compositor_info.factory = pdf_compositor_info.factory =
base::Bind(&printing::CreatePdfCompositorService, std::string()); base::Bind(&printing::CreatePdfCompositorService, std::string());
services->emplace(printing::mojom::kServiceName, pdf_compositor_info); services->emplace(printing::mojom::kServiceName, pdf_compositor_info);

View File

@ -6,7 +6,9 @@
#ifndef LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_ #ifndef LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_
#define LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_ #define LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_
#include "base/memory/scoped_vector.h" #include <memory>
#include <vector>
#include "content/public/utility/content_utility_client.h" #include "content/public/utility/content_utility_client.h"
class UtilityMessageHandler; class UtilityMessageHandler;
@ -21,7 +23,7 @@ class CefContentUtilityClient : public content::ContentUtilityClient {
void RegisterServices(StaticServiceMap* services) override; void RegisterServices(StaticServiceMap* services) override;
private: private:
typedef ScopedVector<UtilityMessageHandler> Handlers; using Handlers = std::vector<std::unique_ptr<UtilityMessageHandler>>;
Handlers handlers_; Handlers handlers_;
DISALLOW_COPY_AND_ASSIGN(CefContentUtilityClient); DISALLOW_COPY_AND_ASSIGN(CefContentUtilityClient);

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=fa03e8ba9a443a9028246fe21a8995d8a7bdb7d5$ // $hash=a62c6931d085746acf26926662f2b8497bd61186$
// //
#include "libcef_dll/cpptoc/accessibility_handler_cpptoc.h" #include "libcef_dll/cpptoc/accessibility_handler_cpptoc.h"
@ -79,10 +79,10 @@ CefRefPtr<CefAccessibilityHandler> CefCppToCRefCounted<
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount base::AtomicRefCount CefCppToCRefCounted<
CefCppToCRefCounted<CefAccessibilityHandlerCppToC, CefAccessibilityHandlerCppToC,
CefAccessibilityHandler, CefAccessibilityHandler,
cef_accessibility_handler_t>::DebugObjCt = 0; cef_accessibility_handler_t>::DebugObjCt ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=9f5778bffbd8c25b6f4ee2e7ec06e9eca5f9f48d$ // $hash=0316cd113473467a653145abd66ec920256f53ce$
// //
#include "libcef_dll/cpptoc/app_cpptoc.h" #include "libcef_dll/cpptoc/app_cpptoc.h"
@ -137,7 +137,8 @@ CefCppToCRefCounted<CefAppCppToC, CefApp, cef_app_t>::UnwrapDerived(
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount base::AtomicRefCount
CefCppToCRefCounted<CefAppCppToC, CefApp, cef_app_t>::DebugObjCt = 0; CefCppToCRefCounted<CefAppCppToC, CefApp, cef_app_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=bffdd556dc95e464816b9aa0c8b46e7fadd89e5d$ // $hash=59c6739c35bb63b28d66cc94109583eb5bd615f6$
// //
#include "libcef_dll/cpptoc/auth_callback_cpptoc.h" #include "libcef_dll/cpptoc/auth_callback_cpptoc.h"
@ -71,7 +71,8 @@ CefRefPtr<CefAuthCallback> CefCppToCRefCounted<
template <> template <>
base::AtomicRefCount CefCppToCRefCounted<CefAuthCallbackCppToC, base::AtomicRefCount CefCppToCRefCounted<CefAuthCallbackCppToC,
CefAuthCallback, CefAuthCallback,
cef_auth_callback_t>::DebugObjCt = 0; cef_auth_callback_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -20,8 +20,8 @@ CefRefPtr<CefBaseRefCounted> CefCppToCRefCounted<
template <> template <>
base::AtomicRefCount CefCppToCRefCounted<CefBaseRefCountedCppToC, base::AtomicRefCount CefCppToCRefCounted<CefBaseRefCountedCppToC,
CefBaseRefCounted, CefBaseRefCounted,
cef_base_ref_counted_t>::DebugObjCt = cef_base_ref_counted_t>::DebugObjCt
0; ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -24,9 +24,9 @@ CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped, cef_base_scoped_t>::
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount CefCppToCScoped<CefBaseScopedCppToC, base::AtomicRefCount
CefBaseScoped, CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped, cef_base_scoped_t>::
cef_base_scoped_t>::DebugObjCt = 0; DebugObjCt ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a904d37178d2bce73fdd6937cefa9f70dc352038$ // $hash=f1065394dac333079e531be1c0868c78bdc61163$
// //
#include "libcef_dll/cpptoc/before_download_callback_cpptoc.h" #include "libcef_dll/cpptoc/before_download_callback_cpptoc.h"
@ -54,10 +54,10 @@ CefCppToCRefCounted<CefBeforeDownloadCallbackCppToC,
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount base::AtomicRefCount CefCppToCRefCounted<
CefCppToCRefCounted<CefBeforeDownloadCallbackCppToC, CefBeforeDownloadCallbackCppToC,
CefBeforeDownloadCallback, CefBeforeDownloadCallback,
cef_before_download_callback_t>::DebugObjCt = 0; cef_before_download_callback_t>::DebugObjCt ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=3bb896234f1b9fc0ee14f936f28b6585a82502db$ // $hash=050a562b7dad49c1fff63b7f17adfa0670fa186a$
// //
#include "libcef_dll/cpptoc/binary_value_cpptoc.h" #include "libcef_dll/cpptoc/binary_value_cpptoc.h"
@ -181,7 +181,8 @@ CefCppToCRefCounted<CefBinaryValueCppToC, CefBinaryValue, cef_binary_value_t>::
template <> template <>
base::AtomicRefCount CefCppToCRefCounted<CefBinaryValueCppToC, base::AtomicRefCount CefCppToCRefCounted<CefBinaryValueCppToC,
CefBinaryValue, CefBinaryValue,
cef_binary_value_t>::DebugObjCt = 0; cef_binary_value_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a5b87e4e7e656c8643febf4afb3d1bd3f06c7ac0$ // $hash=28cdec0f8fd53a117bc9d4ea51d3bf9102ad239a$
// //
#include "libcef_dll/cpptoc/browser_cpptoc.h" #include "libcef_dll/cpptoc/browser_cpptoc.h"
@ -394,9 +394,9 @@ CefCppToCRefCounted<CefBrowserCppToC, CefBrowser, cef_browser_t>::UnwrapDerived(
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount CefCppToCRefCounted<CefBrowserCppToC, base::AtomicRefCount
CefBrowser, CefCppToCRefCounted<CefBrowserCppToC, CefBrowser, cef_browser_t>::DebugObjCt
cef_browser_t>::DebugObjCt = 0; ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=63aa1967a233a66852969c1e72ecd0c12e69105b$ // $hash=1c14ea52e06cca6ef0ad5e82797b9b1cda7141b4$
// //
#include "libcef_dll/cpptoc/browser_host_cpptoc.h" #include "libcef_dll/cpptoc/browser_host_cpptoc.h"
@ -1091,7 +1091,8 @@ CefCppToCRefCounted<CefBrowserHostCppToC, CefBrowserHost, cef_browser_host_t>::
template <> template <>
base::AtomicRefCount CefCppToCRefCounted<CefBrowserHostCppToC, base::AtomicRefCount CefCppToCRefCounted<CefBrowserHostCppToC,
CefBrowserHost, CefBrowserHost,
cef_browser_host_t>::DebugObjCt = 0; cef_browser_host_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif #endif
template <> template <>

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=81332687e151af6933a729c1456dd4b3a64f82df$ // $hash=dc92a1083681b1f0b2c2bf42470f5421d256391c$
// //
#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" #include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h"
@ -129,10 +129,10 @@ CefRefPtr<CefBrowserProcessHandler> CefCppToCRefCounted<
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
template <> template <>
base::AtomicRefCount base::AtomicRefCount CefCppToCRefCounted<
CefCppToCRefCounted<CefBrowserProcessHandlerCppToC, CefBrowserProcessHandlerCppToC,
CefBrowserProcessHandler, CefBrowserProcessHandler,
cef_browser_process_handler_t>::DebugObjCt = 0; cef_browser_process_handler_t>::DebugObjCt ATOMIC_DECLARATION;
#endif #endif
template <> template <>

Some files were not shown because too many files have changed in this diff Show More