Update to Chromium revision 304f01a1 (#358063)
- Improve ordering of CefLoadHandler callbacks. OnLoadingStateChange will be called before and after all calls to OnLoadStart and OnLoadEnd. OnLoadStart/OnLoadEnd calls will occur as matching pairs (see http://crbug.com/539952#c2). - Remove the |requesting_url| argument to CefGeolocationHandler:: OnCancelGeolocationPermission. Clients can use the |request_id| argument to track this information themselves. - Fix a crash when loading the PDF extension in multiple browsers with a custom CefRequestContext (issue #1757).
This commit is contained in:
parent
e0974ea64d
commit
c6111d5947
|
@ -7,5 +7,5 @@
|
|||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'cb947c0153db0ec02a8abbcb3ca086d88bf6006f',
|
||||
'chromium_checkout': '304f01a1e1f7ebeb7d637f847469c90ba008b86d',
|
||||
}
|
||||
|
|
15
cef.gyp
15
cef.gyp
|
@ -871,6 +871,9 @@
|
|||
# Generate chrome/common/safe_browsing/csd.pb.h required by
|
||||
# zip_analyzer_results.h via chrome_utility_messages.h
|
||||
'<(DEPTH)/chrome/chrome.gyp:safe_browsing_proto',
|
||||
# Generate chrome/common/chrome_version.h required by
|
||||
# chrome/common/chrome_contants.cc
|
||||
'<(DEPTH)/chrome/common_constants.gyp:version_header',
|
||||
'<(DEPTH)/components/components.gyp:cdm_renderer',
|
||||
'<(DEPTH)/components/components.gyp:component_updater',
|
||||
'<(DEPTH)/components/components.gyp:content_settings_core_browser',
|
||||
|
@ -891,6 +894,7 @@
|
|||
'<(DEPTH)/components/components.gyp:printing_common',
|
||||
'<(DEPTH)/components/components.gyp:printing_renderer',
|
||||
'<(DEPTH)/components/components.gyp:proxy_config',
|
||||
'<(DEPTH)/components/components.gyp:ssl_config',
|
||||
'<(DEPTH)/components/components.gyp:update_client',
|
||||
'<(DEPTH)/components/components.gyp:user_prefs',
|
||||
'<(DEPTH)/components/components.gyp:version_info',
|
||||
|
@ -1046,8 +1050,12 @@
|
|||
'libcef/browser/pepper/pepper_isolated_file_system_message_filter.cc',
|
||||
'libcef/browser/pepper/pepper_isolated_file_system_message_filter.h',
|
||||
'libcef/browser/pepper/device_id_fetcher.cc',
|
||||
'libcef/browser/permission_manager.cc',
|
||||
'libcef/browser/permission_manager.h',
|
||||
'libcef/browser/permissions/permission_context.cc',
|
||||
'libcef/browser/permissions/permission_context.h',
|
||||
'libcef/browser/permissions/permission_manager.cc',
|
||||
'libcef/browser/permissions/permission_manager.h',
|
||||
'libcef/browser/permissions/permission_util.cc',
|
||||
'libcef/browser/permissions/permission_util.h',
|
||||
'libcef/browser/plugins/plugin_info_message_filter.cc',
|
||||
'libcef/browser/plugins/plugin_info_message_filter.h',
|
||||
'libcef/browser/plugins/plugin_service_filter.cc',
|
||||
|
@ -1382,6 +1390,9 @@
|
|||
'<(DEPTH)/chrome/common/pref_names.h',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.h',
|
||||
# Include sources for permissions support.
|
||||
'<(DEPTH)/chrome/browser/permissions/permission_request_id.h',
|
||||
'<(DEPTH)/chrome/browser/permissions/permission_request_id.cc',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
|
|
|
@ -89,13 +89,12 @@ typedef struct _cef_geolocation_handler_t {
|
|||
struct _cef_geolocation_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called when a geolocation access request is canceled. |requesting_url| is
|
||||
// the URL that originally requested permission and |request_id| is the unique
|
||||
// ID for the permission request.
|
||||
// Called when a geolocation access request is canceled. |request_id| is the
|
||||
// unique ID for the permission request.
|
||||
///
|
||||
void (CEF_CALLBACK *on_cancel_geolocation_permission)(
|
||||
struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* requesting_url, int request_id);
|
||||
int request_id);
|
||||
} cef_geolocation_handler_t;
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ typedef struct _cef_load_handler_t {
|
|||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
// of failure. It will be called before any calls to OnLoadStart and after all
|
||||
// calls to OnLoadError and/or OnLoadEnd.
|
||||
///
|
||||
void (CEF_CALLBACK *on_loading_state_change)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, int isLoading, int canGoBack,
|
||||
|
@ -73,9 +74,9 @@ typedef struct _cef_load_handler_t {
|
|||
// never be NULL -- call the is_main() function to check if this frame is the
|
||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This
|
||||
// function may not be called for a particular frame if the load request for
|
||||
// that frame fails. For notification of overall browser load status use
|
||||
// OnLoadingStateChange instead.
|
||||
// function will always be called for all frames irrespective of whether the
|
||||
// request completes successfully. For notification of overall browser load
|
||||
// status use OnLoadingStateChange instead.
|
||||
///
|
||||
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
|
||||
|
@ -86,7 +87,8 @@ typedef struct _cef_load_handler_t {
|
|||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This
|
||||
// function will always be called for all frames irrespective of whether the
|
||||
// request completes successfully.
|
||||
// request completes successfully. For notification of overall browser load
|
||||
// status use OnLoadingStateChange instead.
|
||||
///
|
||||
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
|
|
|
@ -82,14 +82,12 @@ class CefGeolocationHandler : public virtual CefBase {
|
|||
}
|
||||
|
||||
///
|
||||
// Called when a geolocation access request is canceled. |requesting_url| is
|
||||
// the URL that originally requested permission and |request_id| is the unique
|
||||
// ID for the permission request.
|
||||
// Called when a geolocation access request is canceled. |request_id| is the
|
||||
// unique ID for the permission request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnCancelGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id) {
|
||||
}
|
||||
};
|
||||
|
|
|
@ -56,7 +56,8 @@ class CefLoadHandler : public virtual CefBase {
|
|||
// Called when the loading state has changed. This callback will be executed
|
||||
// twice -- once when loading is initiated either programmatically or by user
|
||||
// action, and once when loading is terminated due to completion, cancellation
|
||||
// of failure.
|
||||
// of failure. It will be called before any calls to OnLoadStart and after all
|
||||
// calls to OnLoadError and/or OnLoadEnd.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -69,8 +70,8 @@ class CefLoadHandler : public virtual CefBase {
|
|||
// never be empty -- call the IsMain() method to check if this frame is the
|
||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This method
|
||||
// may not be called for a particular frame if the load request for that frame
|
||||
// fails. For notification of overall browser load status use
|
||||
// will always be called for all frames irrespective of whether the request
|
||||
// completes successfully. For notification of overall browser load status use
|
||||
// OnLoadingStateChange instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
|
@ -83,7 +84,8 @@ class CefLoadHandler : public virtual CefBase {
|
|||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This method
|
||||
// will always be called for all frames irrespective of whether the request
|
||||
// completes successfully.
|
||||
// completes successfully. For notification of overall browser load status use
|
||||
// OnLoadingStateChange instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/permission_manager.h"
|
||||
#include "libcef/browser/permissions/permission_manager.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
@ -326,10 +326,15 @@ content::SSLHostStateDelegate*
|
|||
|
||||
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
|
||||
if (!permission_manager_.get())
|
||||
permission_manager_.reset(new CefPermissionManager());
|
||||
permission_manager_.reset(new CefPermissionManager(this));
|
||||
return permission_manager_.get();
|
||||
}
|
||||
|
||||
content::BackgroundSyncController*
|
||||
CefBrowserContextImpl::GetBackgroundSyncController() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
|||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
|
|
|
@ -25,6 +25,7 @@ bool ShouldProxyUserData(const void* key) {
|
|||
|
||||
// If this value is not proxied then CefBrowserContextImpl::GetGuestManager()
|
||||
// returns NULL.
|
||||
// See also CefExtensionsAPIClient::CreateGuestViewManagerDelegate.
|
||||
if (key == guest_view::kGuestViewManagerKeyName)
|
||||
return true;
|
||||
|
||||
|
@ -151,6 +152,11 @@ content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
|
|||
return parent_->GetPermissionManager();
|
||||
}
|
||||
|
||||
content::BackgroundSyncController*
|
||||
CefBrowserContextProxy::GetBackgroundSyncController() {
|
||||
return parent_->GetBackgroundSyncController();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
|||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
|
|
|
@ -382,8 +382,10 @@ CefRenderWidgetHostViewOSR* GetOSRHostView(content::WebContents* web_contents) {
|
|||
return fs_view;
|
||||
|
||||
content::RenderViewHost* host = web_contents->GetRenderViewHost();
|
||||
if (host)
|
||||
return static_cast<CefRenderWidgetHostViewOSR*>(host->GetView());
|
||||
if (host) {
|
||||
return static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
host->GetWidget()->GetView());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -570,7 +572,8 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForHost(
|
|||
DCHECK(host);
|
||||
CEF_REQUIRE_UIT();
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderViewHost(host);
|
||||
content::WebContents::FromRenderViewHost(
|
||||
const_cast<content::RenderViewHost*>(host));
|
||||
if (web_contents)
|
||||
return GetBrowserForContents(web_contents);
|
||||
return NULL;
|
||||
|
@ -1089,7 +1092,7 @@ void CefBrowserHostImpl::WasResized() {
|
|||
if (!IsWindowless()) {
|
||||
content::RenderViewHost* host = web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->WasResized();
|
||||
host->GetWidget()->WasResized();
|
||||
} else {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView(web_contents());
|
||||
if (view)
|
||||
|
@ -1177,7 +1180,7 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
|
|||
if (!IsWindowless()) {
|
||||
content::RenderViewHost* host = web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->ForwardKeyboardEvent(web_event);
|
||||
host->GetWidget()->ForwardKeyboardEvent(web_event);
|
||||
} else {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView(web_contents());
|
||||
if (view)
|
||||
|
@ -1233,7 +1236,7 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
|||
if (!IsWindowless()) {
|
||||
content::RenderViewHost* host = web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->ForwardWheelEvent(web_event);
|
||||
host->GetWidget()->ForwardWheelEvent(web_event);
|
||||
} else {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView(web_contents());
|
||||
if (view)
|
||||
|
@ -1278,7 +1281,7 @@ void CefBrowserHostImpl::SendMouseEvent(const blink::WebMouseEvent& event) {
|
|||
if (!IsWindowless()) {
|
||||
content::RenderViewHost* host = web_contents()->GetRenderViewHost();
|
||||
if (host)
|
||||
host->ForwardMouseEvent(event);
|
||||
host->GetWidget()->ForwardMouseEvent(event);
|
||||
} else {
|
||||
CefRenderWidgetHostViewOSR* view = GetOSRHostView(web_contents());
|
||||
if (view)
|
||||
|
@ -1316,7 +1319,8 @@ void CefBrowserHostImpl::SendCaptureLostEvent() {
|
|||
return;
|
||||
|
||||
content::RenderWidgetHostImpl* widget =
|
||||
content::RenderWidgetHostImpl::From(web_contents()->GetRenderViewHost());
|
||||
content::RenderWidgetHostImpl::From(
|
||||
web_contents()->GetRenderViewHost()->GetWidget());
|
||||
if (widget)
|
||||
widget->LostCapture();
|
||||
}
|
||||
|
@ -2443,6 +2447,7 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
|
|||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
int main_frame_route_id,
|
||||
int32_t main_frame_widget_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
|
@ -2609,7 +2614,7 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
||||
if (microphone_requested || webcam_requested) {
|
||||
switch (request.request_type) {
|
||||
case content::MEDIA_OPEN_DEVICE:
|
||||
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY:
|
||||
case content::MEDIA_DEVICE_ACCESS:
|
||||
case content::MEDIA_GENERATE_STREAM:
|
||||
case content::MEDIA_ENUMERATE_DEVICES:
|
||||
|
@ -2679,8 +2684,8 @@ void CefBrowserHostImpl::RenderViewCreated(
|
|||
|
||||
// Indicate that the view has an external parent (namely us). This changes the
|
||||
// default view behavior in some cases (e.g. focus handling on Linux).
|
||||
if (render_view_host->GetView())
|
||||
render_view_host->GetView()->SetHasExternalParent(true);
|
||||
if (render_view_host->GetWidget()->GetView())
|
||||
render_view_host->GetWidget()->GetView()->SetHasExternalParent(true);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewDeleted(
|
||||
|
@ -3088,8 +3093,26 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
|
|||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
|
||||
if (is_main_frame)
|
||||
if (is_main_frame && main_frame_id_ != frame_id) {
|
||||
if (main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) {
|
||||
// Remove the old main frame object before adding the new one.
|
||||
FrameMap::iterator it = frames_.find(main_frame_id_);
|
||||
if (it != frames_.end()) {
|
||||
// Persist URL and name to the new main frame.
|
||||
if (url.empty())
|
||||
url = it->second->GetURL();
|
||||
if (name.empty())
|
||||
name = it->second->GetName();
|
||||
|
||||
it->second->Detach();
|
||||
frames_.erase(it);
|
||||
}
|
||||
|
||||
if (focused_frame_id_ == main_frame_id_)
|
||||
focused_frame_id_ = frame_id;
|
||||
}
|
||||
main_frame_id_ = frame_id;
|
||||
}
|
||||
|
||||
// Check if a frame object already exists.
|
||||
FrameMap::const_iterator it = frames_.find(frame_id);
|
||||
|
|
|
@ -398,6 +398,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
int main_frame_route_id,
|
||||
int32_t main_frame_widget_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
|
|
|
@ -455,7 +455,7 @@ void CefBrowserHostImpl::PlatformNotifyMoveOrResizeStarted() {
|
|||
|
||||
// Send updated screen rectangle information to the renderer process so that
|
||||
// popups are displayed in the correct location.
|
||||
content::RenderWidgetHostImpl::From(web_contents()->GetRenderViewHost())->
|
||||
SendScreenRects();
|
||||
content::RenderWidgetHostImpl::From(
|
||||
web_contents()->GetRenderViewHost()->GetWidget())->SendScreenRects();
|
||||
}
|
||||
|
||||
|
|
|
@ -817,7 +817,8 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
|||
gfx::Point point = gfx::Point(cr.right, cr.bottom);
|
||||
float scale = gfx::Screen::GetNativeScreen()->
|
||||
GetDisplayNearestPoint(point).device_scale_factor();
|
||||
point = gfx::ToFlooredPoint(gfx::ScalePoint(point, 1.0f / scale));
|
||||
point = gfx::ToFlooredPoint(
|
||||
gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||
|
||||
CefWindowDelegateView* delegate_view =
|
||||
new CefWindowDelegateView(background_color);
|
||||
|
|
|
@ -25,7 +25,8 @@ void ChromeBrowserProcessStub::EndSession() {
|
|||
NOTIMPLEMENTED();
|
||||
};
|
||||
|
||||
MetricsServicesManager* ChromeBrowserProcessStub::GetMetricsServicesManager() {
|
||||
metrics_services_manager::MetricsServicesManager*
|
||||
ChromeBrowserProcessStub::GetMetricsServicesManager() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
|||
// BrowserProcess implementation.
|
||||
void ResourceDispatcherHostCreated() override;
|
||||
void EndSession() override;
|
||||
MetricsServicesManager* GetMetricsServicesManager() override;
|
||||
metrics_services_manager::MetricsServicesManager*
|
||||
GetMetricsServicesManager() override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
rappor::RapporService* rappor_service() override;
|
||||
IOThread* io_thread() override;
|
||||
|
|
|
@ -126,8 +126,6 @@ class CefConfigurator : public Configurator {
|
|||
bool UseBackgroundDownloader() const override;
|
||||
scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
|
||||
const override;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner()
|
||||
const override;
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefConfigurator>;
|
||||
|
@ -289,12 +287,6 @@ CefConfigurator::GetSequencedTaskRunner() const {
|
|||
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
|
||||
}
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner>
|
||||
CefConfigurator::GetSingleThreadTaskRunner() const {
|
||||
return content::BrowserThread::GetMessageLoopProxyForThread(
|
||||
content::BrowserThread::FILE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
scoped_refptr<update_client::Configurator>
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_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_view.h"
|
||||
#include "content/public/browser/resource_dispatcher_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
@ -1068,8 +1069,10 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
|
|||
content::WebPreferences* prefs) {
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
|
||||
if (rvh->GetView())
|
||||
rvh->GetView()->SetBackgroundColor(prefs->base_background_color);
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(
|
||||
prefs->base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "content/public/app/startup_helper_win.h"
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
|
@ -195,7 +195,7 @@ void CefQuitMessageLoop() {
|
|||
return;
|
||||
}
|
||||
|
||||
CefBrowserMessageLoop::current()->Quit();
|
||||
CefBrowserMessageLoop::current()->QuitWhenIdle();
|
||||
}
|
||||
|
||||
void CefSetOSModalLoop(bool osModalLoop) {
|
||||
|
|
|
@ -556,6 +556,7 @@ void CefCookieManagerImpl::SetCookieInternal(
|
|||
cookie.secure ? true : false,
|
||||
cookie.httponly ? true : false,
|
||||
false, // First-party only.
|
||||
false, // Enforces prefixes.
|
||||
net::COOKIE_PRIORITY_DEFAULT,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
|
@ -179,9 +180,11 @@ CefDevToolsFrontend::~CefDevToolsFrontend() {
|
|||
void CefDevToolsFrontend::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
if (!frontend_host_) {
|
||||
frontend_host_.reset(
|
||||
content::DevToolsFrontendHost::Create(
|
||||
web_contents()->GetMainFrame(), this));
|
||||
frontend_host_.reset(content::DevToolsFrontendHost::Create(
|
||||
web_contents()->GetMainFrame(),
|
||||
base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
|
||||
base::Unretained(this))));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,10 +223,12 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||
dict->GetInteger("id", &request_id);
|
||||
dict->GetList("params", ¶ms);
|
||||
|
||||
std::string browser_message;
|
||||
if (method == "sendMessageToBrowser" && params &&
|
||||
params->GetSize() == 1 && params->GetString(0, &browser_message)) {
|
||||
agent_host_->DispatchProtocolMessage(browser_message);
|
||||
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
|
||||
std::string protocol_message;
|
||||
if (!params->GetString(0, &protocol_message))
|
||||
return;
|
||||
if (agent_host_)
|
||||
agent_host_->DispatchProtocolMessage(protocol_message);
|
||||
} else if (method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"));
|
||||
|
@ -283,12 +288,6 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||
SendMessageAck(request_id, nullptr);
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) {
|
||||
if (agent_host_)
|
||||
agent_host_->DispatchProtocolMessage(message);
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) {
|
||||
|
|
|
@ -28,7 +28,6 @@ class WebContents;
|
|||
}
|
||||
|
||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
public content::DevToolsFrontendHost::Delegate,
|
||||
public content::DevToolsAgentHostClient,
|
||||
public net::URLFetcherDelegate {
|
||||
public:
|
||||
|
@ -72,10 +71,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
|||
void DocumentAvailableInMainFrame() override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
// content::DevToolsFrontendHost::Delegate implementation.
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message) override;
|
||||
void HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) override;
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
|
||||
// net::URLFetcherDelegate overrides.
|
||||
void OnURLFetchComplete(const net::URLFetcher* source) override;
|
||||
|
|
|
@ -261,6 +261,13 @@ scoped_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
|
|||
return make_scoped_ptr(new ExtensionSet());
|
||||
}
|
||||
|
||||
void CefExtensionSystem::InstallUpdate(const std::string& extension_id,
|
||||
const base::FilePath& temp_dir) {
|
||||
NOTREACHED();
|
||||
base::DeleteFile(temp_dir, true /* recursive */);
|
||||
}
|
||||
|
||||
|
||||
CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
|
||||
const base::DictionaryValue* manifest, const base::FilePath& directory)
|
||||
: manifest(manifest),
|
||||
|
|
|
@ -73,6 +73,8 @@ class CefExtensionSystem : public ExtensionSystem {
|
|||
ContentVerifier* content_verifier() override;
|
||||
scoped_ptr<ExtensionSet> GetDependentExtensions(
|
||||
const Extension* extension) override;
|
||||
void InstallUpdate(const std::string& extension_id,
|
||||
const base::FilePath& temp_dir) override;
|
||||
|
||||
private:
|
||||
// Information about a registered component extension.
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "libcef/browser/extensions/extensions_api_client.h"
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/extensions/mime_handler_view_guest_delegate.h"
|
||||
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
|
||||
|
@ -13,6 +14,7 @@
|
|||
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
|
@ -26,6 +28,22 @@ AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
scoped_ptr<guest_view::GuestViewManagerDelegate>
|
||||
CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
|
||||
content::BrowserContext* context) const {
|
||||
// The GuestViewManager instance associated with the returned Delegate, which
|
||||
// will be retrieved in the future via GuestViewManager::FromBrowserContext,
|
||||
// will be associated with the CefBrowserContextImpl instead of |context| due
|
||||
// to ShouldProxyUserData in browser_context_proxy.cc. Because the
|
||||
// GuestViewManagerDelegate keeps a reference to the passed-in context we need
|
||||
// to provide the *Impl object instead of |context| which may be a *Proxy
|
||||
// object. If we don't do this then the Delegate may attempt to access a
|
||||
// *Proxy object that has already been deleted.
|
||||
return make_scoped_ptr(
|
||||
new extensions::ExtensionsGuestViewManagerDelegate(
|
||||
CefBrowserContextImpl::GetForContext(context).get()));
|
||||
}
|
||||
|
||||
scoped_ptr<MimeHandlerViewGuestDelegate>
|
||||
CefExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const {
|
||||
|
|
|
@ -16,6 +16,9 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
|
|||
|
||||
// ExtensionsAPIClient implementation.
|
||||
AppViewGuestDelegate* CreateAppViewGuestDelegate() const override;
|
||||
scoped_ptr<guest_view::GuestViewManagerDelegate>
|
||||
CreateGuestViewManagerDelegate(
|
||||
content::BrowserContext* context) const override;
|
||||
scoped_ptr<MimeHandlerViewGuestDelegate>
|
||||
CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const override;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowser(
|
||||
extensions::MimeHandlerViewGuest* guest) {
|
||||
content::WebContents* owner_web_contents = guest->GetOwnerWebContents();
|
||||
content::WebContents* owner_web_contents = guest->owner_web_contents();
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents);
|
||||
DCHECK(owner_browser);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
textField_ = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 22)];
|
||||
[[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail];
|
||||
[alert_ setAccessoryView:textField_];
|
||||
[[alert_ window] setInitialFirstResponder:textField_];
|
||||
[textField_ release];
|
||||
|
||||
return textField_;
|
||||
|
|
|
@ -52,7 +52,8 @@ bool CefMenuCreatorRunnerWin::RunContextMenu(CefMenuCreator* manager) {
|
|||
// Adjust for potential display scaling.
|
||||
float scale = gfx::Screen::GetScreenFor(window)->
|
||||
GetDisplayNearestWindow(window).device_scale_factor();
|
||||
screen_point = gfx::ToFlooredPoint(gfx::ScalePoint(screen_point, scale));
|
||||
screen_point = gfx::ToFlooredPoint(
|
||||
gfx::ScalePoint(gfx::PointF(screen_point), scale));
|
||||
}
|
||||
|
||||
// Show the menu. Blocks until the menu is dismissed.
|
||||
|
|
|
@ -1,191 +0,0 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permission_manager.h"
|
||||
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_geolocation_handler.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "content/public/browser/geolocation_provider.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CefGeolocationCallbackImpl : public CefGeolocationCallback {
|
||||
public:
|
||||
typedef base::Callback<void(content::PermissionStatus)> CallbackType;
|
||||
|
||||
explicit CefGeolocationCallbackImpl(const CallbackType& callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
if (allow) {
|
||||
content::GeolocationProvider::GetInstance()->
|
||||
UserDidOptIntoLocationServices();
|
||||
}
|
||||
|
||||
callback_.Run(allow ? content::PERMISSION_STATUS_GRANTED :
|
||||
content::PERMISSION_STATUS_DENIED);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefGeolocationCallbackImpl::Continue, this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect() {
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefGeolocationCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefGeolocationCallbackImpl);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
struct CefPermissionManager::PendingRequest {
|
||||
PendingRequest(content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin)
|
||||
: permission(permission),
|
||||
render_process_id(render_frame_host->GetProcess()->GetID()),
|
||||
render_frame_id(render_frame_host->GetRoutingID()),
|
||||
requesting_origin(requesting_origin) {
|
||||
}
|
||||
|
||||
content::PermissionType permission;
|
||||
int render_process_id;
|
||||
int render_frame_id;
|
||||
GURL requesting_origin;
|
||||
};
|
||||
|
||||
CefPermissionManager::CefPermissionManager()
|
||||
: PermissionManager() {
|
||||
}
|
||||
|
||||
CefPermissionManager::~CefPermissionManager() {
|
||||
}
|
||||
|
||||
int CefPermissionManager::RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (permission != content::PermissionType::GEOLOCATION) {
|
||||
callback.Run(content::PERMISSION_STATUS_DENIED);
|
||||
return kNoPendingOperation;
|
||||
}
|
||||
|
||||
bool proceed = false;
|
||||
|
||||
PendingRequest* pending_request = new PendingRequest(
|
||||
permission, render_frame_host, requesting_origin);
|
||||
const int request_id = pending_requests_.Add(pending_request);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForHost(render_frame_host);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefGeolocationCallbackImpl> callbackImpl(
|
||||
new CefGeolocationCallbackImpl(callback));
|
||||
|
||||
// Notify the handler.
|
||||
proceed = handler->OnRequestGeolocationPermission(
|
||||
browser.get(), requesting_origin.spec(), request_id,
|
||||
callbackImpl.get());
|
||||
if (!proceed)
|
||||
callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (proceed)
|
||||
return request_id;
|
||||
|
||||
pending_requests_.Remove(request_id);
|
||||
|
||||
// Disallow geolocation access by default.
|
||||
callback.Run(content::PERMISSION_STATUS_DENIED);
|
||||
return kNoPendingOperation;
|
||||
}
|
||||
|
||||
void CefPermissionManager::CancelPermissionRequest(
|
||||
int request_id) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
|
||||
if (!pending_request)
|
||||
return;
|
||||
|
||||
if (pending_request->permission != content::PermissionType::GEOLOCATION)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrame(pending_request->render_process_id,
|
||||
pending_request->render_frame_id);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get()) {
|
||||
handler->OnCancelGeolocationPermission(
|
||||
browser.get(),
|
||||
pending_request->requesting_origin.spec(),
|
||||
request_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pending_requests_.Remove(request_id);
|
||||
}
|
||||
|
||||
void CefPermissionManager::ResetPermission(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
}
|
||||
|
||||
content::PermissionStatus CefPermissionManager::GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
return content::PERMISSION_STATUS_DENIED;
|
||||
}
|
||||
|
||||
void CefPermissionManager::RegisterPermissionUsage(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
}
|
||||
|
||||
int CefPermissionManager::SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CefPermissionManager::UnsubscribePermissionStatusChange(
|
||||
int subscription_id) {
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSION_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSION_MANAGER_H_
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/id_map.h"
|
||||
#include "base/macros.h"
|
||||
#include "content/public/browser/permission_manager.h"
|
||||
|
||||
class CefPermissionManager : public content::PermissionManager {
|
||||
public:
|
||||
CefPermissionManager();
|
||||
~CefPermissionManager() override;
|
||||
|
||||
// PermissionManager implementation.
|
||||
int RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||
void CancelPermissionRequest(int request_id) override;
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
content::PermissionStatus GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
void RegisterPermissionUsage(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
int SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||
void UnsubscribePermissionStatusChange(int subscription_id) override;
|
||||
|
||||
private:
|
||||
struct PendingRequest;
|
||||
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
|
||||
PendingRequestsMap pending_requests_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPermissionManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSION_MANAGER_H_
|
|
@ -0,0 +1,268 @@
|
|||
// Copyright 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_context.h"
|
||||
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_geolocation_handler.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "content/public/browser/geolocation_provider.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/origin_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Whether the permission should be restricted to secure origins.
|
||||
bool IsRestrictedToSecureOrigins(content::PermissionType permission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
class CefGeolocationCallbackImpl : public CefGeolocationCallback {
|
||||
public:
|
||||
typedef CefPermissionContext::PermissionDecidedCallback CallbackType;
|
||||
|
||||
explicit CefGeolocationCallbackImpl(const CallbackType& callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
if (allow) {
|
||||
content::GeolocationProvider::GetInstance()->
|
||||
UserDidOptIntoLocationServices();
|
||||
}
|
||||
|
||||
callback_.Run(allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefGeolocationCallbackImpl::Continue, this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect() {
|
||||
callback_.Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefGeolocationCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefGeolocationCallbackImpl);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefPermissionContext::CefPermissionContext(CefBrowserContext* profile)
|
||||
: profile_(profile),
|
||||
weak_ptr_factory_(this) {
|
||||
}
|
||||
|
||||
bool CefPermissionContext::SupportsPermission(
|
||||
content::PermissionType permission) {
|
||||
// Only Geolocation permissions are currently supported.
|
||||
return permission == content::PermissionType::GEOLOCATION;
|
||||
}
|
||||
|
||||
void CefPermissionContext::RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_frame,
|
||||
bool user_gesture,
|
||||
const BrowserPermissionCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
DecidePermission(permission,
|
||||
web_contents,
|
||||
id,
|
||||
requesting_frame.GetOrigin(),
|
||||
web_contents->GetLastCommittedURL().GetOrigin(),
|
||||
user_gesture,
|
||||
callback);
|
||||
}
|
||||
|
||||
void CefPermissionContext::CancelPermissionRequest(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(permission == content::PermissionType::GEOLOCATION);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get())
|
||||
handler->OnCancelGeolocationPermission(browser.get(), id.request_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefPermissionContext::ResetPermission(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
profile_->GetHostContentSettingsMap()->SetContentSetting(
|
||||
ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
|
||||
ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string(),
|
||||
CONTENT_SETTING_DEFAULT);
|
||||
}
|
||||
|
||||
ContentSetting CefPermissionContext::GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) const {
|
||||
if (IsRestrictedToSecureOrigins(permission) &&
|
||||
!content::IsOriginSecure(requesting_origin)) {
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
|
||||
return profile_->GetHostContentSettingsMap()->GetContentSetting(
|
||||
requesting_origin,
|
||||
embedding_origin,
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string());
|
||||
}
|
||||
|
||||
void CefPermissionContext::DecidePermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
bool user_gesture,
|
||||
const BrowserPermissionCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, CONTENT_SETTING_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsRestrictedToSecureOrigins(permission) &&
|
||||
!content::IsOriginSecure(requesting_origin)) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, CONTENT_SETTING_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
||||
ContentSetting content_setting =
|
||||
profile_->GetHostContentSettingsMap()->
|
||||
GetContentSettingAndMaybeUpdateLastUsage(
|
||||
requesting_origin,
|
||||
embedding_origin,
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string());
|
||||
|
||||
if (content_setting == CONTENT_SETTING_ALLOW ||
|
||||
content_setting == CONTENT_SETTING_BLOCK) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, content_setting);
|
||||
return;
|
||||
}
|
||||
|
||||
QueryPermission(
|
||||
permission, id, requesting_origin, embedding_origin,
|
||||
base::Bind(&CefPermissionContext::NotifyPermissionSet,
|
||||
weak_ptr_factory_.GetWeakPtr(), permission, id,
|
||||
requesting_origin, embedding_origin, callback,
|
||||
false /* persist */));
|
||||
}
|
||||
|
||||
void CefPermissionContext::QueryPermission(
|
||||
content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const PermissionDecidedCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(permission == content::PermissionType::GEOLOCATION);
|
||||
|
||||
bool proceed = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrame(id.render_process_id(),
|
||||
id.render_frame_id());
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefGeolocationCallbackImpl> callbackImpl(
|
||||
new CefGeolocationCallbackImpl(callback));
|
||||
|
||||
// Notify the handler.
|
||||
proceed = handler->OnRequestGeolocationPermission(
|
||||
browser.get(), requesting_origin.spec(), id.request_id(),
|
||||
callbackImpl.get());
|
||||
if (!proceed)
|
||||
callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!proceed) {
|
||||
// Disallow geolocation access by default.
|
||||
callback.Run(CONTENT_SETTING_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void CefPermissionContext::NotifyPermissionSet(
|
||||
content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback,
|
||||
bool persist,
|
||||
ContentSetting content_setting) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
if (persist) {
|
||||
UpdateContentSetting(permission, requesting_origin, embedding_origin,
|
||||
content_setting);
|
||||
}
|
||||
|
||||
if (content_setting == CONTENT_SETTING_DEFAULT) {
|
||||
content_setting =
|
||||
profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
DCHECK_NE(content_setting, CONTENT_SETTING_DEFAULT);
|
||||
callback.Run(content_setting);
|
||||
}
|
||||
|
||||
void CefPermissionContext::UpdateContentSetting(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
ContentSetting content_setting) {
|
||||
DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
|
||||
DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
|
||||
DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
|
||||
content_setting == CONTENT_SETTING_BLOCK);
|
||||
|
||||
profile_->GetHostContentSettingsMap()->SetContentSetting(
|
||||
ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
|
||||
ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string(),
|
||||
content_setting);
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
// Copyright 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/permissions/permission_request_id.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
|
||||
namespace content {
|
||||
enum class PermissionType;
|
||||
class WebContents;
|
||||
}; // namespace content
|
||||
|
||||
// Based on chrome/browser/permissions/permission_context_base.h
|
||||
class CefPermissionContext {
|
||||
public:
|
||||
explicit CefPermissionContext(CefBrowserContext* profile);
|
||||
|
||||
using BrowserPermissionCallback = base::Callback<void(ContentSetting)>;
|
||||
using PermissionDecidedCallback = base::Callback<void(ContentSetting)>;
|
||||
|
||||
// Returns true if support exists for querying the embedder about the
|
||||
// specified permission type.
|
||||
bool SupportsPermission(content::PermissionType permission);
|
||||
|
||||
// The renderer is requesting permission to push messages.
|
||||
// When the answer to a permission request has been determined, |callback|
|
||||
// should be called with the result.
|
||||
void RequestPermission(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_frame,
|
||||
bool user_gesture,
|
||||
const BrowserPermissionCallback& callback);
|
||||
|
||||
// Withdraw an existing permission request, no op if the permission request
|
||||
// was already cancelled by some other means.
|
||||
void CancelPermissionRequest(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id);
|
||||
|
||||
// Resets the permission to its default value.
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin);
|
||||
|
||||
// Returns whether the permission has been granted, denied...
|
||||
ContentSetting GetPermissionStatus(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) const;
|
||||
|
||||
private:
|
||||
// Decide whether the permission should be granted.
|
||||
// Calls PermissionDecided if permission can be decided non-interactively,
|
||||
// or NotifyPermissionSet if permission decided by presenting an infobar.
|
||||
void DecidePermission(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
bool user_gesture,
|
||||
const BrowserPermissionCallback& callback);
|
||||
|
||||
void QueryPermission(content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const PermissionDecidedCallback& callback);
|
||||
|
||||
void NotifyPermissionSet(content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback,
|
||||
bool persist,
|
||||
ContentSetting content_setting);
|
||||
|
||||
// Store the decided permission as a content setting.
|
||||
void UpdateContentSetting(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
ContentSetting content_setting);
|
||||
|
||||
CefBrowserContext* profile_;
|
||||
|
||||
base::WeakPtrFactory<CefPermissionContext> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPermissionContext);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
|
@ -0,0 +1,382 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_manager.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
using content::PermissionStatus;
|
||||
using content::PermissionType;
|
||||
|
||||
namespace {
|
||||
|
||||
// Helper method to convert ContentSetting to PermissionStatus.
|
||||
PermissionStatus ContentSettingToPermissionStatus(ContentSetting setting) {
|
||||
switch (setting) {
|
||||
case CONTENT_SETTING_ALLOW:
|
||||
case CONTENT_SETTING_SESSION_ONLY:
|
||||
return content::PERMISSION_STATUS_GRANTED;
|
||||
case CONTENT_SETTING_BLOCK:
|
||||
return content::PERMISSION_STATUS_DENIED;
|
||||
case CONTENT_SETTING_ASK:
|
||||
return content::PERMISSION_STATUS_ASK;
|
||||
case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT:
|
||||
case CONTENT_SETTING_DEFAULT:
|
||||
case CONTENT_SETTING_NUM_SETTINGS:
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return content::PERMISSION_STATUS_DENIED;
|
||||
}
|
||||
|
||||
// Helper method to convert PermissionStatus to ContentSetting.
|
||||
ContentSetting PermissionStatusToContentSetting(PermissionStatus status) {
|
||||
switch (status) {
|
||||
case content::PERMISSION_STATUS_GRANTED:
|
||||
return CONTENT_SETTING_ALLOW;
|
||||
case content::PERMISSION_STATUS_DENIED:
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
case content::PERMISSION_STATUS_ASK:
|
||||
return CONTENT_SETTING_ASK;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
|
||||
// Wrap a callback taking a PermissionStatus to pass it as a callback taking a
|
||||
// ContentSetting.
|
||||
void ContentSettingToPermissionStatusCallbackWrapper(
|
||||
const base::Callback<void(PermissionStatus)>& callback,
|
||||
ContentSetting setting) {
|
||||
callback.Run(ContentSettingToPermissionStatus(setting));
|
||||
}
|
||||
|
||||
// Returns whether the permission has a constant PermissionStatus value (i.e.
|
||||
// always approved or always denied).
|
||||
bool IsConstantPermission(PermissionType type) {
|
||||
switch (type) {
|
||||
case PermissionType::MIDI:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PermissionRequestResponseCallbackWrapper(
|
||||
const base::Callback<void(PermissionStatus)>& callback,
|
||||
const std::vector<PermissionStatus>& vector) {
|
||||
DCHECK_EQ(vector.size(), 1ul);
|
||||
callback.Run(vector[0]);
|
||||
}
|
||||
|
||||
// Function used for handling permission types which do not change their
|
||||
// value i.e. they are always approved or always denied etc.
|
||||
// CONTENT_SETTING_DEFAULT is returned if the permission needs further handling.
|
||||
// This function should only be called when IsConstantPermission has returned
|
||||
// true for the PermissionType.
|
||||
ContentSetting GetContentSettingForConstantPermission(PermissionType type) {
|
||||
DCHECK(IsConstantPermission(type));
|
||||
switch (type) {
|
||||
case PermissionType::MIDI:
|
||||
return CONTENT_SETTING_ALLOW;
|
||||
default:
|
||||
return CONTENT_SETTING_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
PermissionStatus GetPermissionStatusForConstantPermission(PermissionType type) {
|
||||
return ContentSettingToPermissionStatus(
|
||||
GetContentSettingForConstantPermission(type));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class CefPermissionManager::PendingRequest {
|
||||
public:
|
||||
PendingRequest(content::RenderFrameHost* render_frame_host,
|
||||
const std::vector<PermissionType> permissions,
|
||||
const base::Callback<void(
|
||||
const std::vector<PermissionStatus>&)>& callback)
|
||||
: render_process_id_(render_frame_host->GetProcess()->GetID()),
|
||||
render_frame_id_(render_frame_host->GetRoutingID()),
|
||||
callback_(callback),
|
||||
permissions_(permissions),
|
||||
results_(permissions.size(), content::PERMISSION_STATUS_DENIED),
|
||||
remaining_results_(permissions.size()) {
|
||||
}
|
||||
|
||||
void SetPermissionStatus(int permission_id, PermissionStatus status) {
|
||||
DCHECK(!IsComplete());
|
||||
|
||||
results_[permission_id] = status;
|
||||
--remaining_results_;
|
||||
}
|
||||
|
||||
bool IsComplete() const {
|
||||
return remaining_results_ == 0;
|
||||
}
|
||||
|
||||
int render_process_id() const { return render_process_id_; }
|
||||
int render_frame_id() const { return render_frame_id_; }
|
||||
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)>
|
||||
callback() const {
|
||||
return callback_;
|
||||
}
|
||||
|
||||
std::vector<PermissionType> permissions() const {
|
||||
return permissions_;
|
||||
}
|
||||
|
||||
std::vector<PermissionStatus> results() const {
|
||||
return results_;
|
||||
}
|
||||
|
||||
private:
|
||||
int render_process_id_;
|
||||
int render_frame_id_;
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)> callback_;
|
||||
std::vector<PermissionType> permissions_;
|
||||
std::vector<PermissionStatus> results_;
|
||||
size_t remaining_results_;
|
||||
};
|
||||
|
||||
struct CefPermissionManager::Subscription {
|
||||
PermissionType permission;
|
||||
GURL requesting_origin;
|
||||
GURL embedding_origin;
|
||||
base::Callback<void(PermissionStatus)> callback;
|
||||
ContentSetting current_value;
|
||||
};
|
||||
|
||||
CefPermissionManager::CefPermissionManager(CefBrowserContext* profile)
|
||||
: profile_(profile),
|
||||
context_(profile),
|
||||
weak_ptr_factory_(this) {
|
||||
}
|
||||
|
||||
CefPermissionManager::~CefPermissionManager() {
|
||||
if (!subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
int CefPermissionManager::RequestPermission(
|
||||
PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(PermissionStatus)>& callback) {
|
||||
return RequestPermissions(
|
||||
std::vector<PermissionType>(1, permission),
|
||||
render_frame_host,
|
||||
requesting_origin,
|
||||
user_gesture,
|
||||
base::Bind(&PermissionRequestResponseCallbackWrapper, callback));
|
||||
}
|
||||
|
||||
int CefPermissionManager::RequestPermissions(
|
||||
const std::vector<PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(
|
||||
const std::vector<PermissionStatus>&)>& callback) {
|
||||
if (permissions.empty()) {
|
||||
callback.Run(std::vector<PermissionStatus>());
|
||||
return kNoPendingOperation;
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
|
||||
|
||||
PendingRequest* pending_request = new PendingRequest(
|
||||
render_frame_host, permissions, callback);
|
||||
int request_id = pending_requests_.Add(pending_request);
|
||||
|
||||
const PermissionRequestID request(render_frame_host, request_id);
|
||||
|
||||
for (size_t i = 0; i < permissions.size(); ++i) {
|
||||
const PermissionType permission = permissions[i];
|
||||
|
||||
if (IsConstantPermission(permission) ||
|
||||
!context_.SupportsPermission(permission)) {
|
||||
OnPermissionsRequestResponseStatus(request_id, i,
|
||||
GetPermissionStatus(permission, requesting_origin, embedding_origin));
|
||||
continue;
|
||||
}
|
||||
|
||||
context_.RequestPermission(
|
||||
permission, web_contents, request, requesting_origin, user_gesture,
|
||||
base::Bind(&ContentSettingToPermissionStatusCallbackWrapper,
|
||||
base::Bind(
|
||||
&CefPermissionManager::OnPermissionsRequestResponseStatus,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id, i)));
|
||||
}
|
||||
|
||||
// The request might have been resolved already.
|
||||
if (!pending_requests_.Lookup(request_id))
|
||||
return kNoPendingOperation;
|
||||
|
||||
return request_id;
|
||||
}
|
||||
|
||||
void CefPermissionManager::OnPermissionsRequestResponseStatus(
|
||||
int request_id,
|
||||
int permission_id,
|
||||
PermissionStatus status) {
|
||||
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
|
||||
pending_request->SetPermissionStatus(permission_id, status);
|
||||
|
||||
if (!pending_request->IsComplete())
|
||||
return;
|
||||
|
||||
pending_request->callback().Run(pending_request->results());
|
||||
pending_requests_.Remove(request_id);
|
||||
}
|
||||
|
||||
void CefPermissionManager::CancelPermissionRequest(int request_id) {
|
||||
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
|
||||
if (!pending_request)
|
||||
return;
|
||||
|
||||
content::RenderFrameHost* render_frame_host =
|
||||
content::RenderFrameHost::FromID(pending_request->render_process_id(),
|
||||
pending_request->render_frame_id());
|
||||
DCHECK(render_frame_host);
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
DCHECK(web_contents);
|
||||
|
||||
const PermissionRequestID request(pending_request->render_process_id(),
|
||||
pending_request->render_frame_id(),
|
||||
request_id);
|
||||
for (PermissionType permission : pending_request->permissions()) {
|
||||
if (!context_.SupportsPermission(permission))
|
||||
continue;
|
||||
context_.CancelPermissionRequest(permission, web_contents, request);
|
||||
}
|
||||
pending_requests_.Remove(request_id);
|
||||
}
|
||||
|
||||
void CefPermissionManager::ResetPermission(PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
if (!context_.SupportsPermission(permission))
|
||||
return;
|
||||
context_.ResetPermission(permission, requesting_origin, embedding_origin);
|
||||
}
|
||||
|
||||
PermissionStatus CefPermissionManager::GetPermissionStatus(
|
||||
PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
if (IsConstantPermission(permission))
|
||||
return GetPermissionStatusForConstantPermission(permission);
|
||||
|
||||
if (!context_.SupportsPermission(permission))
|
||||
return content::PERMISSION_STATUS_DENIED;
|
||||
|
||||
return ContentSettingToPermissionStatus(
|
||||
context_.GetPermissionStatus(permission, requesting_origin,
|
||||
embedding_origin));
|
||||
}
|
||||
|
||||
void CefPermissionManager::RegisterPermissionUsage(
|
||||
PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
// This is required because constant permissions don't have a
|
||||
// ContentSettingsType.
|
||||
if (IsConstantPermission(permission))
|
||||
return;
|
||||
|
||||
profile_->GetHostContentSettingsMap()->UpdateLastUsage(
|
||||
requesting_origin,
|
||||
embedding_origin,
|
||||
permission_util::PermissionTypeToContentSetting(permission));
|
||||
}
|
||||
|
||||
int CefPermissionManager::SubscribePermissionStatusChange(
|
||||
PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(PermissionStatus)>& callback) {
|
||||
if (subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->AddObserver(this);
|
||||
|
||||
Subscription* subscription = new Subscription();
|
||||
subscription->permission = permission;
|
||||
subscription->requesting_origin = requesting_origin;
|
||||
subscription->embedding_origin = embedding_origin;
|
||||
subscription->callback = callback;
|
||||
|
||||
subscription->current_value = PermissionStatusToContentSetting(
|
||||
GetPermissionStatus(permission,
|
||||
subscription->requesting_origin,
|
||||
subscription->embedding_origin));
|
||||
|
||||
return subscriptions_.Add(subscription);
|
||||
}
|
||||
|
||||
void CefPermissionManager::UnsubscribePermissionStatusChange(
|
||||
int subscription_id) {
|
||||
// Whether |subscription_id| is known will be checked by the Remove() call.
|
||||
subscriptions_.Remove(subscription_id);
|
||||
|
||||
if (subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefPermissionManager::OnContentSettingChanged(
|
||||
const ContentSettingsPattern& primary_pattern,
|
||||
const ContentSettingsPattern& secondary_pattern,
|
||||
ContentSettingsType content_type,
|
||||
std::string resource_identifier) {
|
||||
std::list<base::Closure> callbacks;
|
||||
|
||||
for (SubscriptionsMap::iterator iter(&subscriptions_);
|
||||
!iter.IsAtEnd(); iter.Advance()) {
|
||||
Subscription* subscription = iter.GetCurrentValue();
|
||||
if (permission_util::PermissionTypeToContentSetting(
|
||||
subscription->permission) != content_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (primary_pattern.IsValid() &&
|
||||
!primary_pattern.Matches(subscription->requesting_origin))
|
||||
continue;
|
||||
if (secondary_pattern.IsValid() &&
|
||||
!secondary_pattern.Matches(subscription->embedding_origin))
|
||||
continue;
|
||||
|
||||
ContentSetting new_value = PermissionStatusToContentSetting(
|
||||
GetPermissionStatus(subscription->permission,
|
||||
subscription->requesting_origin,
|
||||
subscription->embedding_origin));
|
||||
if (subscription->current_value == new_value)
|
||||
continue;
|
||||
|
||||
subscription->current_value = new_value;
|
||||
|
||||
// Add the callback to |callbacks| which will be run after the loop to
|
||||
// prevent re-entrance issues.
|
||||
callbacks.push_back(
|
||||
base::Bind(subscription->callback,
|
||||
ContentSettingToPermissionStatus(new_value)));
|
||||
}
|
||||
|
||||
for (const auto& callback : callbacks)
|
||||
callback.Run();
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
||||
|
||||
#include "libcef/browser/permissions/permission_context.h"
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/id_map.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "components/content_settings/core/browser/content_settings_observer.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "content/public/browser/permission_manager.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
|
||||
namespace content {
|
||||
enum class PermissionType;
|
||||
class WebContents;
|
||||
}; // namespace content
|
||||
|
||||
// Implementation based on chrome/browser/permissions/permission_manager.h
|
||||
class CefPermissionManager : public KeyedService,
|
||||
public content::PermissionManager,
|
||||
public content_settings::Observer {
|
||||
public:
|
||||
explicit CefPermissionManager(CefBrowserContext* profile);
|
||||
~CefPermissionManager() override;
|
||||
|
||||
// content::CefPermissionManager implementation.
|
||||
int RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||
int RequestPermissions(
|
||||
const std::vector<content::PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(
|
||||
const std::vector<content::PermissionStatus>&)>& callback) override;
|
||||
void CancelPermissionRequest(int request_id) override;
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
content::PermissionStatus GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
void RegisterPermissionUsage(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
int SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||
void UnsubscribePermissionStatusChange(int subscription_id) override;
|
||||
|
||||
private:
|
||||
class PendingRequest;
|
||||
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
|
||||
|
||||
struct Subscription;
|
||||
using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
|
||||
|
||||
// Called when a permission was decided for a given PendingRequest. The
|
||||
// PendingRequest is identified by its |request_id| and the permission is
|
||||
// identified by its |permission_id|. If the PendingRequest contains more than
|
||||
// one permission, it will wait for the remaining permissions to be resolved.
|
||||
// When all the permissions have been resolved, the PendingRequest's callback
|
||||
// is run.
|
||||
void OnPermissionsRequestResponseStatus(
|
||||
int request_id,
|
||||
int permission_id,
|
||||
content::PermissionStatus status);
|
||||
|
||||
// content_settings::Observer implementation.
|
||||
void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
|
||||
const ContentSettingsPattern& secondary_pattern,
|
||||
ContentSettingsType content_type,
|
||||
std::string resource_identifier) override;
|
||||
|
||||
CefBrowserContext* profile_;
|
||||
PendingRequestsMap pending_requests_;
|
||||
SubscriptionsMap subscriptions_;
|
||||
CefPermissionContext context_;
|
||||
|
||||
base::WeakPtrFactory<CefPermissionManager> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPermissionManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
using content::PermissionType;
|
||||
|
||||
namespace permission_util {
|
||||
|
||||
ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
||||
switch (permission) {
|
||||
case PermissionType::MIDI_SYSEX:
|
||||
return CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
|
||||
case PermissionType::PUSH_MESSAGING:
|
||||
return CONTENT_SETTINGS_TYPE_PUSH_MESSAGING;
|
||||
case PermissionType::NOTIFICATIONS:
|
||||
return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
|
||||
case PermissionType::GEOLOCATION:
|
||||
return CONTENT_SETTINGS_TYPE_GEOLOCATION;
|
||||
case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
|
||||
#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||
return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER;
|
||||
#else
|
||||
NOTIMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
case PermissionType::DURABLE_STORAGE:
|
||||
return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE;
|
||||
case PermissionType::MIDI:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
case PermissionType::AUDIO_CAPTURE:
|
||||
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
|
||||
case PermissionType::VIDEO_CAPTURE:
|
||||
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
|
||||
case PermissionType::NUM:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED() << "Unknown content setting for permission "
|
||||
<< static_cast<int>(permission);
|
||||
return CONTENT_SETTINGS_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
} // namespace permission_util
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
||||
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
|
||||
namespace permission_util {
|
||||
|
||||
// Helper method to convert PermissionType to ContentSettingType.
|
||||
ContentSettingsType PermissionTypeToContentSetting(
|
||||
content::PermissionType permission);
|
||||
|
||||
} // namespace permission_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
|
@ -297,9 +297,9 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|||
// to actually spool the pages, only to have the renderer generate them. Run
|
||||
// a message loop until we get our signal that the print job is satisfied.
|
||||
// PrintJob will send a ALL_PAGES_REQUESTED after having received all the
|
||||
// pages it needs. MessageLoop::current()->Quit() will be called as soon as
|
||||
// print_job_->document()->IsComplete() is true on either ALL_PAGES_REQUESTED
|
||||
// or in DidPrintPage(). The check is done in
|
||||
// pages it needs. MessageLoop::current()->QuitWhenIdle() will be called as
|
||||
// soon as print_job_->document()->IsComplete() is true on either
|
||||
// ALL_PAGES_REQUESTED or in DidPrintPage(). The check is done in
|
||||
// ShouldQuitFromInnerMessageLoop().
|
||||
// BLOCKS until all the pages are received. (Need to enable recursive task)
|
||||
if (!RunInnerMessageLoop()) {
|
||||
|
@ -318,7 +318,7 @@ void PrintViewManagerBase::ShouldQuitFromInnerMessageLoop() {
|
|||
inside_inner_message_loop_) {
|
||||
// We are in a message loop created by RenderAllMissingPagesNow. Quit from
|
||||
// it.
|
||||
base::MessageLoop::current()->Quit();
|
||||
base::MessageLoop::current()->QuitWhenIdle();
|
||||
inside_inner_message_loop_ = false;
|
||||
}
|
||||
}
|
||||
|
@ -424,9 +424,9 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|||
// memory-bound.
|
||||
static const int kPrinterSettingsTimeout = 60000;
|
||||
base::OneShotTimer quit_timer;
|
||||
quit_timer.Start(FROM_HERE,
|
||||
TimeDelta::FromMilliseconds(kPrinterSettingsTimeout),
|
||||
base::MessageLoop::current(), &base::MessageLoop::Quit);
|
||||
quit_timer.Start(
|
||||
FROM_HERE, TimeDelta::FromMilliseconds(kPrinterSettingsTimeout),
|
||||
base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle);
|
||||
|
||||
inside_inner_message_loop_ = true;
|
||||
|
||||
|
@ -477,8 +477,9 @@ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|||
}
|
||||
|
||||
bool PrintViewManagerBase::PrintNowInternal(IPC::Message* message) {
|
||||
// Don't print / print preview interstitials.
|
||||
if (web_contents()->ShowingInterstitialPage()) {
|
||||
// Don't print / print preview interstitials or crashed tabs.
|
||||
if (web_contents()->ShowingInterstitialPage() ||
|
||||
web_contents()->IsCrashed()) {
|
||||
delete message;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ class CefCopyFrameGenerator {
|
|||
|
||||
gl_helper->CropScaleReadbackAndCleanMailbox(
|
||||
texture_mailbox.mailbox(),
|
||||
texture_mailbox.sync_point(),
|
||||
texture_mailbox.sync_token(),
|
||||
result_size,
|
||||
gfx::Rect(result_size),
|
||||
result_size,
|
||||
|
@ -290,14 +290,15 @@ class CefCopyFrameGenerator {
|
|||
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
|
||||
bool result) {
|
||||
// This method may be called after the view has been deleted.
|
||||
uint32 sync_point = 0;
|
||||
gpu::SyncToken sync_token;
|
||||
if (result) {
|
||||
content::GLHelper* gl_helper =
|
||||
content::ImageTransportFactory::GetInstance()->GetGLHelper();
|
||||
sync_point = gl_helper->InsertSyncPoint();
|
||||
if (gl_helper)
|
||||
sync_token = gpu::SyncToken(gl_helper->InsertSyncPoint());
|
||||
}
|
||||
bool lost_resource = sync_point == 0;
|
||||
release_callback->Run(sync_point, lost_resource);
|
||||
const bool lost_resource = !sync_token.HasData();
|
||||
release_callback->Run(sync_token, lost_resource);
|
||||
|
||||
if (generator) {
|
||||
generator->CopyFromCompositingSurfaceFinished(
|
||||
|
@ -461,7 +462,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||
render_widget_host_->SetView(this);
|
||||
|
||||
// CefBrowserHostImpl might not be created at this time for popups.
|
||||
if (render_widget_host_->IsRenderView()) {
|
||||
if (content::RenderViewHost::From(render_widget_host_)) {
|
||||
browser_impl_ = CefBrowserHostImpl::GetBrowserForHost(
|
||||
content::RenderViewHost::From(render_widget_host_));
|
||||
}
|
||||
|
@ -474,7 +475,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||
compositor_.reset(
|
||||
new ui::Compositor(content::GetContextFactory(),
|
||||
base::ThreadTaskRunnerHandle::Get()));
|
||||
compositor_->SetAcceleratedWidgetAndStartCompositor(compositor_widget_);
|
||||
compositor_->SetAcceleratedWidget(compositor_widget_);
|
||||
#endif
|
||||
compositor_->SetDelegate(this);
|
||||
compositor_->SetRootLayer(root_layer_.get());
|
||||
|
@ -947,6 +948,14 @@ content::BrowserAccessibilityManager*
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::LockCompositingSurface() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UnlockCompositingSurface() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
||||
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
|
||||
const gfx::Rect& rect_pixels,
|
||||
|
|
|
@ -167,6 +167,8 @@ class CefRenderWidgetHostViewOSR
|
|||
content::BrowserAccessibilityManager*
|
||||
CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate) override;
|
||||
void LockCompositingSurface() override;
|
||||
void UnlockCompositingSurface() override;
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
||||
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
|
||||
|
@ -193,12 +195,9 @@ class CefRenderWidgetHostViewOSR
|
|||
#if defined(OS_MACOSX)
|
||||
// AcceleratedWidgetMacNSView implementation.
|
||||
NSView* AcceleratedWidgetGetNSView() const override;
|
||||
bool AcceleratedWidgetShouldIgnoreBackpressure() const override;
|
||||
void AcceleratedWidgetGetVSyncParameters(
|
||||
base::TimeTicks* timebase, base::TimeDelta* interval) const override;
|
||||
void AcceleratedWidgetSwapCompleted(
|
||||
const std::vector<ui::LatencyInfo>& latency_info) override;
|
||||
void AcceleratedWidgetHitError() override;
|
||||
void AcceleratedWidgetSwapCompleted() override;
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
bool OnMessageReceived(const IPC::Message& msg) override;
|
||||
|
|
|
@ -117,31 +117,13 @@ NSView* CefRenderWidgetHostViewOSR::AcceleratedWidgetGetNSView() const {
|
|||
return [window_ contentView];
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::AcceleratedWidgetShouldIgnoreBackpressure()
|
||||
const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AcceleratedWidgetGetVSyncParameters(
|
||||
base::TimeTicks* timebase, base::TimeDelta* interval) const {
|
||||
*timebase = base::TimeTicks();
|
||||
*interval = base::TimeDelta();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AcceleratedWidgetSwapCompleted(
|
||||
const std::vector<ui::LatencyInfo>& all_latency_info) {
|
||||
if (!render_widget_host_)
|
||||
return;
|
||||
for (auto latency_info : all_latency_info) {
|
||||
latency_info.AddLatencyNumber(
|
||||
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
|
||||
render_widget_host_->FrameSwapped(latency_info);
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::AcceleratedWidgetHitError() {
|
||||
// Request a new frame be drawn.
|
||||
browser_compositor_->compositor()->ScheduleFullRedraw();
|
||||
void CefRenderWidgetHostViewOSR::AcceleratedWidgetSwapCompleted() {
|
||||
}
|
||||
|
||||
CefTextInputContext CefRenderWidgetHostViewOSR::GetNSTextInputContext() {
|
||||
|
|
|
@ -48,5 +48,5 @@ bool CefEndTracing(const CefString& tracing_file,
|
|||
}
|
||||
|
||||
int64 CefNowFromSystemTraceTime() {
|
||||
return base::TraceTicks::Now().ToInternalValue();
|
||||
return base::TimeTicks::Now().ToInternalValue();
|
||||
}
|
||||
|
|
|
@ -194,14 +194,14 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||
make_scoped_ptr<net::HttpServerProperties>(
|
||||
new net::HttpServerPropertiesImpl));
|
||||
|
||||
net::HttpCache::DefaultBackend* main_backend =
|
||||
scoped_ptr<net::HttpCache::DefaultBackend> main_backend(
|
||||
new net::HttpCache::DefaultBackend(
|
||||
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
|
||||
net::CACHE_BACKEND_DEFAULT,
|
||||
cache_path,
|
||||
0,
|
||||
BrowserThread::GetMessageLoopProxyForThread(
|
||||
BrowserThread::CACHE));
|
||||
BrowserThread::CACHE)));
|
||||
|
||||
net::HttpNetworkSession::Params network_session_params;
|
||||
network_session_params.host_resolver =
|
||||
|
@ -225,10 +225,12 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||
network_session_params.ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ? true : false;
|
||||
|
||||
scoped_ptr<net::HttpCache> main_cache(
|
||||
new net::HttpCache(network_session_params,
|
||||
main_backend));
|
||||
storage_->set_http_transaction_factory(main_cache.Pass());
|
||||
storage_->set_http_network_session(
|
||||
make_scoped_ptr(new net::HttpNetworkSession(network_session_params)));
|
||||
storage_->set_http_transaction_factory(make_scoped_ptr(
|
||||
new net::HttpCache(storage_->http_network_session(),
|
||||
main_backend.Pass(),
|
||||
true /* set_up_quic_server_info */)));
|
||||
|
||||
#if !defined(DISABLE_FTP_SUPPORT)
|
||||
ftp_transaction_factory_.reset(
|
||||
|
|
|
@ -123,7 +123,7 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
|
|||
guest_->embedder_web_contents();
|
||||
CefRenderWidgetHostViewOSR* embedder_host_view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(
|
||||
embedder_web_contents->GetRenderViewHost()->GetView());
|
||||
embedder_web_contents->GetRenderViewHost()->GetWidget()->GetView());
|
||||
|
||||
CefRenderWidgetHostViewOSR* platform_widget =
|
||||
new CefRenderWidgetHostViewOSR(render_widget_host, embedder_host_view);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "chrome/common/chrome_constants.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/widevine_cdm_constants.h"
|
||||
#include "components/content_settings/core/common/content_settings_pattern.h"
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
|
@ -193,8 +192,10 @@ void OverridePepperFlashSystemPluginPath() {
|
|||
return;
|
||||
#endif
|
||||
|
||||
PathService::Override(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN,
|
||||
plugin_filename);
|
||||
if (!plugin_filename.empty()) {
|
||||
PathService::Override(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN,
|
||||
plugin_filename);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
|
@ -566,8 +567,9 @@ void CefMainDelegate::PreSandboxStartup() {
|
|||
}
|
||||
#if defined(WIDEVINE_CDM_IS_COMPONENT)
|
||||
if (command_line->HasSwitch(switches::kEnableWidevineCdm)) {
|
||||
PathService::Override(chrome::DIR_COMPONENT_WIDEVINE_CDM,
|
||||
user_data_path.Append(kWidevineCdmBaseDirectory));
|
||||
PathService::Override(
|
||||
chrome::DIR_COMPONENT_WIDEVINE_CDM,
|
||||
user_data_path.Append(FILE_PATH_LITERAL("WidevineCDM")));
|
||||
}
|
||||
#endif // defined(WIDEVINE_CDM_IS_COMPONENT)
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
||||
|
|
|
@ -143,6 +143,9 @@ CefString CefURIDecode(const CefString& text,
|
|||
bool CefParseCSSColor(const CefString& string,
|
||||
bool strict,
|
||||
cef_color_t& color) {
|
||||
// Blink types depend on PartitionAlloc. Safe to call multiple times.
|
||||
webkit_glue::InitializePartitionAlloc();
|
||||
|
||||
return webkit_glue::ParseCSSColor(
|
||||
blink::WebString::fromUTF8(string.ToString().data()), strict, color);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/renderer/browser_impl.h"
|
||||
#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h"
|
||||
#include "libcef/renderer/extensions/extensions_renderer_client.h"
|
||||
#include "libcef/renderer/extensions/print_web_view_helper_delegate.h"
|
||||
#include "libcef/renderer/media/cef_key_systems.h"
|
||||
|
@ -34,12 +33,10 @@
|
|||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/extensions/extension_process_policy.h"
|
||||
#include "chrome/common/pepper_permission_util.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/renderer/content_settings_observer.h"
|
||||
#include "chrome/renderer/extensions/resource_request_policy.h"
|
||||
#include "chrome/renderer/loadtimes_extension_bindings.h"
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
|
||||
#include "chrome/renderer/spellchecker/spellcheck.h"
|
||||
|
@ -55,31 +52,22 @@
|
|||
#include "content/public/child/child_thread.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/renderer/plugin_instance_throttler.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "content/public/renderer/render_view_visitor.h"
|
||||
#include "content/renderer/render_frame_impl.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "extensions/renderer/dispatcher.h"
|
||||
#include "extensions/renderer/dispatcher_delegate.h"
|
||||
#include "extensions/renderer/extension_frame_helper.h"
|
||||
#include "extensions/renderer/extension_helper.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h"
|
||||
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
||||
#include "extensions/renderer/renderer_extension_registry.h"
|
||||
#include "ipc/ipc_sync_channel.h"
|
||||
#include "media/base/media.h"
|
||||
#include "third_party/WebKit/public/platform/WebPrerenderingSupport.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.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/WebPluginParams.h"
|
||||
#include "third_party/WebKit/public/web/WebPrerendererClient.h"
|
||||
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
|
@ -117,14 +105,6 @@ class CefPrerendererClient : public content::RenderViewObserver,
|
|||
void willAddPrerender(blink::WebPrerender* prerender) override {}
|
||||
};
|
||||
|
||||
void IsGuestViewApiAvailableToScriptContext(
|
||||
bool* api_is_available,
|
||||
extensions::ScriptContext* context) {
|
||||
if (context->GetAvailability("guestViewInternal").is_available()) {
|
||||
*api_is_available = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AppendParams(const std::vector<base::string16>& additional_names,
|
||||
const std::vector<base::string16>& additional_values,
|
||||
blink::WebVector<blink::WebString>* existing_names,
|
||||
|
@ -165,73 +145,20 @@ std::string GetPluginInstancePosterAttribute(
|
|||
return std::string();
|
||||
}
|
||||
|
||||
bool IsStandaloneExtensionProcess() {
|
||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
extensions::switches::kExtensionProcess);
|
||||
}
|
||||
|
||||
bool CrossesExtensionExtents(
|
||||
blink::WebLocalFrame* frame,
|
||||
const GURL& new_url,
|
||||
bool is_extension_url,
|
||||
bool is_initial_navigation) {
|
||||
DCHECK(!frame->parent());
|
||||
GURL old_url(frame->document().url());
|
||||
|
||||
extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
|
||||
// If old_url is still empty and this is an initial navigation, then this is
|
||||
// a window.open operation. We should look at the opener URL. Note that the
|
||||
// opener is a local frame in this case.
|
||||
if (is_initial_navigation && old_url.is_empty() && frame->opener()) {
|
||||
blink::WebLocalFrame* opener_frame = frame->opener()->toWebLocalFrame();
|
||||
|
||||
// If we're about to open a normal web page from a same-origin opener stuck
|
||||
// in an extension process, we want to keep it in process to allow the
|
||||
// opener to script it.
|
||||
blink::WebDocument opener_document = opener_frame->document();
|
||||
blink::WebSecurityOrigin opener_origin = opener_document.securityOrigin();
|
||||
bool opener_is_extension_url = !opener_origin.isUnique() &&
|
||||
extension_registry->GetExtensionOrAppByURL(
|
||||
opener_document.url()) != NULL;
|
||||
if (!is_extension_url &&
|
||||
!opener_is_extension_url &&
|
||||
IsStandaloneExtensionProcess() &&
|
||||
opener_origin.canRequest(blink::WebURL(new_url)))
|
||||
return false;
|
||||
|
||||
// In all other cases, we want to compare against the URL that determines
|
||||
// the type of process. In default Chrome, that's the URL of the opener's
|
||||
// top frame and not the opener frame itself. In --site-per-process, we
|
||||
// can use the opener frame itself.
|
||||
// TODO(nick): Either wire this up to SiteIsolationPolicy, or to state on
|
||||
// |opener_frame|/its ancestors.
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kSitePerProcess) ||
|
||||
base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kIsolateExtensions))
|
||||
old_url = opener_frame->document().url();
|
||||
else
|
||||
old_url = opener_frame->top()->document().url();
|
||||
}
|
||||
|
||||
// Only consider keeping non-app URLs in an app process if this window
|
||||
// has an opener (in which case it might be an OAuth popup that tries to
|
||||
// script an iframe within the app).
|
||||
bool should_consider_workaround = !!frame->opener();
|
||||
|
||||
return extensions::CrossesExtensionProcessBoundary(
|
||||
*extension_registry->GetMainThreadExtensionSet(), old_url, new_url,
|
||||
should_consider_workaround);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefContentRendererClient::CefContentRendererClient()
|
||||
: devtools_agent_count_(0),
|
||||
uncaught_exception_stack_size_(0),
|
||||
single_process_cleanup_complete_(false) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions_client_.reset(new extensions::CefExtensionsClient);
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
extensions_renderer_client_.reset(
|
||||
new extensions::CefExtensionsRendererClient);
|
||||
extensions::ExtensionsRendererClient::Set(
|
||||
extensions_renderer_client_.get());
|
||||
}
|
||||
}
|
||||
|
||||
CefContentRendererClient::~CefContentRendererClient() {
|
||||
|
@ -464,30 +391,8 @@ void CefContentRendererClient::RenderThreadStarted() {
|
|||
pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get());
|
||||
}
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions_client_.reset(new extensions::CefExtensionsClient);
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
|
||||
extensions_renderer_client_.reset(
|
||||
new extensions::CefExtensionsRendererClient);
|
||||
extensions::ExtensionsRendererClient::Set(
|
||||
extensions_renderer_client_.get());
|
||||
|
||||
extension_dispatcher_delegate_.reset(
|
||||
new extensions::CefExtensionsDispatcherDelegate());
|
||||
|
||||
// Must be initialized after ExtensionsRendererClient.
|
||||
extension_dispatcher_.reset(
|
||||
new extensions::Dispatcher(extension_dispatcher_delegate_.get()));
|
||||
thread->AddObserver(extension_dispatcher_.get());
|
||||
|
||||
guest_view_container_dispatcher_.reset(
|
||||
new extensions::ExtensionsGuestViewContainerDispatcher());
|
||||
thread->AddObserver(guest_view_container_dispatcher_.get());
|
||||
|
||||
resource_request_policy_.reset(
|
||||
new extensions::ResourceRequestPolicy(extension_dispatcher_.get()));
|
||||
}
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderThreadStarted();
|
||||
|
||||
// Notify the render process handler.
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
|
@ -511,11 +416,8 @@ void CefContentRendererClient::RenderFrameCreated(
|
|||
new CefRenderFrameObserver(render_frame);
|
||||
new CefPepperHelper(render_frame);
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
new extensions::ExtensionFrameHelper(render_frame,
|
||||
extension_dispatcher_.get());
|
||||
extension_dispatcher_->OnRenderFrameCreated(render_frame);
|
||||
}
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderFrameCreated(render_frame);
|
||||
|
||||
BrowserCreated(render_frame->GetRenderView(), render_frame);
|
||||
}
|
||||
|
@ -528,9 +430,8 @@ void CefContentRendererClient::RenderViewCreated(
|
|||
make_scoped_ptr<printing::PrintWebViewHelper::Delegate>(
|
||||
new extensions::CefPrintWebViewHelperDelegate()));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
new extensions::ExtensionHelper(render_view, extension_dispatcher_.get());
|
||||
}
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extensions_renderer_client_->RenderViewCreated(render_view);
|
||||
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
@ -545,26 +446,19 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
|||
blink::WebLocalFrame* frame,
|
||||
const blink::WebPluginParams& params,
|
||||
blink::WebPlugin** plugin) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
// Based on ChromeContentRendererClient::OverrideCreatePlugin.
|
||||
std::string orig_mime_type = params.mimeType.utf8();
|
||||
if (orig_mime_type == content::kBrowserPluginMimeType) {
|
||||
bool guest_view_api_available = false;
|
||||
extension_dispatcher_->script_context_set().ForEach(
|
||||
render_frame,
|
||||
base::Bind(&IsGuestViewApiAvailableToScriptContext,
|
||||
&guest_view_api_available));
|
||||
if (guest_view_api_available)
|
||||
return false;
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
!extensions_renderer_client_->OverrideCreatePlugin(render_frame,
|
||||
params)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GURL url(params.url);
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
blink::WebString top_origin = frame->top()->securityOrigin().toString();
|
||||
render_frame->Send(new CefViewHostMsg_GetPluginInfo(
|
||||
render_frame->GetRoutingID(), url, frame->top()->document().url(),
|
||||
orig_mime_type, &output));
|
||||
render_frame->GetRoutingID(), url, GURL(top_origin), orig_mime_type,
|
||||
&output));
|
||||
|
||||
*plugin = CreatePlugin(render_frame, frame, params, output);
|
||||
return true;
|
||||
|
@ -572,7 +466,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
|||
|
||||
bool CefContentRendererClient::HandleNavigation(
|
||||
content::RenderFrame* render_frame,
|
||||
content::DocumentState* document_state,
|
||||
bool is_content_initiated,
|
||||
int opener_id,
|
||||
blink::WebFrame* frame,
|
||||
const blink::WebURLRequest& request,
|
||||
|
@ -644,42 +538,8 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||
return false;
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
const extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
|
||||
// Determine if the new URL is an extension (excluding bookmark apps).
|
||||
const extensions::Extension* new_url_extension =
|
||||
extensions::GetNonBookmarkAppExtension(
|
||||
*extension_registry->GetMainThreadExtensionSet(), url);
|
||||
bool is_extension_url = !!new_url_extension;
|
||||
|
||||
// If the navigation would cross an app extent boundary, we also need
|
||||
// to defer to the browser to ensure process isolation. This is not
|
||||
// necessary for server redirects, which will be transferred to a new
|
||||
// process by the browser process when they are ready to commit. It is
|
||||
// necessary for client redirects, which won't be transferred in the same
|
||||
// way.
|
||||
if (!is_server_redirect &&
|
||||
CrossesExtensionExtents(frame, url, is_extension_url,
|
||||
is_initial_navigation)) {
|
||||
// Include the referrer in this case since we're going from a hosted web
|
||||
// page. (the packaged case is handled previously by the extension
|
||||
// navigation test)
|
||||
*send_referrer = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this is a reload, check whether it has the wrong process type. We
|
||||
// should send it to the browser if it's an extension URL (e.g., hosted app)
|
||||
// in a normal process, or if it's a process for an extension that has been
|
||||
// uninstalled. Without --site-per-process mode, we never fork processes
|
||||
// for subframes, so this check only makes sense for top-level frames.
|
||||
// TODO(alexmos,nasko): Figure out how this check should work when reloading
|
||||
// subframes in --site-per-process mode.
|
||||
if (!frame->parent() && frame->document().url() == url) {
|
||||
if (is_extension_url != IsStandaloneExtensionProcess())
|
||||
return true;
|
||||
}
|
||||
return extensions::CefExtensionsRendererClient::ShouldFork(
|
||||
frame, url, is_initial_navigation, is_server_redirect, send_referrer);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -692,21 +552,8 @@ bool CefContentRendererClient::WillSendRequest(
|
|||
const GURL& first_party_for_cookies,
|
||||
GURL* new_url) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Check whether the request should be allowed. If not allowed, we reset the
|
||||
// URL to something invalid to prevent the request and cause an error.
|
||||
if (url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
!resource_request_policy_->CanRequestResource(url, frame,
|
||||
transition_type)) {
|
||||
*new_url = GURL(chrome::kExtensionInvalidRequestURL);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.SchemeIs(extensions::kExtensionResourceScheme) &&
|
||||
!resource_request_policy_->CanRequestExtensionResourceScheme(url,
|
||||
frame)) {
|
||||
*new_url = GURL(chrome::kExtensionResourceInvalidRequestURL);
|
||||
return true;
|
||||
}
|
||||
return extensions_renderer_client_->WillSendRequest(frame, transition_type,
|
||||
url, new_url);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -718,12 +565,8 @@ CefContentRendererClient::CreateBrowserPluginDelegate(
|
|||
const std::string& mime_type,
|
||||
const GURL& original_url) {
|
||||
DCHECK(extensions::ExtensionsEnabled());
|
||||
if (mime_type == content::kBrowserPluginMimeType) {
|
||||
return new extensions::ExtensionsGuestViewContainer(render_frame);
|
||||
} else {
|
||||
return new extensions::MimeHandlerViewContainer(
|
||||
render_frame, mime_type, original_url);
|
||||
}
|
||||
return extensions::CefExtensionsRendererClient::CreateBrowserPluginDelegate(
|
||||
render_frame, mime_type, original_url);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::AddKeySystems(
|
||||
|
@ -787,6 +630,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
params.mimeType = blink::WebString::fromUTF8(actual_mime_type.c_str());
|
||||
}
|
||||
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
auto create_blocked_plugin =
|
||||
[&render_frame, &frame, ¶ms, &info, &identifier, &group_name](
|
||||
int template_id, const base::string16& message) {
|
||||
|
@ -806,11 +650,26 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
// CefContentRendererClient::CreatePlugin instead, to
|
||||
// reduce the chance of future regressions.
|
||||
bool is_prerendering = false;
|
||||
bool power_saver_enabled =
|
||||
bool is_flash =
|
||||
info.name == base::ASCIIToUTF16(content::kFlashPluginName);
|
||||
|
||||
std::string override_for_testing = command_line->GetSwitchValueASCII(
|
||||
switches::kOverridePluginPowerSaverForTesting);
|
||||
|
||||
// This feature has only been tested throughly with Flash thus far.
|
||||
// It is also enabled for the Power Saver test plugin for browser tests.
|
||||
bool can_throttle_plugin_type =
|
||||
is_flash || override_for_testing == "ignore-list";
|
||||
|
||||
bool power_saver_setting_on =
|
||||
status ==
|
||||
CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
|
||||
bool power_saver_enabled =
|
||||
override_for_testing == "always" ||
|
||||
(power_saver_setting_on && can_throttle_plugin_type);
|
||||
bool blocked_for_background_tab =
|
||||
render_frame->IsHidden() && power_saver_enabled;
|
||||
power_saver_enabled && render_frame->IsHidden();
|
||||
|
||||
PlaceholderPosterInfo poster_info;
|
||||
if (power_saver_enabled) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "content/public/renderer/content_renderer_client.h"
|
||||
|
||||
namespace extensions {
|
||||
class CefExtensionsRendererClient;
|
||||
class Dispatcher;
|
||||
class DispatcherDelegate;
|
||||
class ExtensionsClient;
|
||||
|
@ -90,7 +91,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
|||
const blink::WebPluginParams& params,
|
||||
blink::WebPlugin** plugin) override;
|
||||
bool HandleNavigation(content::RenderFrame* render_frame,
|
||||
content::DocumentState* document_state,
|
||||
bool is_content_initiated,
|
||||
int opener_id,
|
||||
blink::WebFrame* frame,
|
||||
const blink::WebURLRequest& request,
|
||||
|
@ -149,12 +150,8 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
|||
scoped_ptr<ChromePDFPrintClient> pdf_print_client_;
|
||||
|
||||
scoped_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||
scoped_ptr<extensions::ExtensionsRendererClient> extensions_renderer_client_;
|
||||
scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_;
|
||||
scoped_ptr<extensions::Dispatcher> extension_dispatcher_;
|
||||
scoped_ptr<extensions::ExtensionsGuestViewContainerDispatcher>
|
||||
guest_view_container_dispatcher_;
|
||||
scoped_ptr<extensions::ResourceRequestPolicy> resource_request_policy_;
|
||||
scoped_ptr<extensions::CefExtensionsRendererClient>
|
||||
extensions_renderer_client_;
|
||||
|
||||
int devtools_agent_count_;
|
||||
int uncaught_exception_stack_size_;
|
||||
|
|
|
@ -4,10 +4,111 @@
|
|||
|
||||
#include "libcef/renderer/extensions/extensions_renderer_client.h"
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h"
|
||||
#include "libcef/renderer/render_process_observer.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/common/extensions/extension_process_policy.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/renderer/extensions/resource_request_policy.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "extensions/renderer/dispatcher.h"
|
||||
#include "extensions/renderer/extension_frame_helper.h"
|
||||
#include "extensions/renderer/extension_helper.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
|
||||
#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h"
|
||||
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
||||
#include "extensions/renderer/renderer_extension_registry.h"
|
||||
#include "extensions/renderer/script_context.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginParams.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsStandaloneExtensionProcess() {
|
||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
extensions::switches::kExtensionProcess);
|
||||
}
|
||||
|
||||
void IsGuestViewApiAvailableToScriptContext(
|
||||
bool* api_is_available,
|
||||
extensions::ScriptContext* context) {
|
||||
if (context->GetAvailability("guestViewInternal").is_available()) {
|
||||
*api_is_available = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if the frame is navigating to an URL either into or out of an
|
||||
// extension app's extent.
|
||||
bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
|
||||
const GURL& new_url,
|
||||
bool is_extension_url,
|
||||
bool is_initial_navigation) {
|
||||
DCHECK(!frame->parent());
|
||||
GURL old_url(frame->document().url());
|
||||
|
||||
extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
|
||||
// If old_url is still empty and this is an initial navigation, then this is
|
||||
// a window.open operation. We should look at the opener URL. Note that the
|
||||
// opener is a local frame in this case.
|
||||
if (is_initial_navigation && old_url.is_empty() && frame->opener()) {
|
||||
blink::WebLocalFrame* opener_frame = frame->opener()->toWebLocalFrame();
|
||||
|
||||
// We usually want to compare against the URL that determines the type of
|
||||
// process. In default Chrome, that's the URL of the opener's top frame and
|
||||
// not the opener frame itself. In --site-per-process, we can use the
|
||||
// opener frame itself.
|
||||
// TODO(nick): Either wire this up to SiteIsolationPolicy, or to state on
|
||||
// |opener_frame|/its ancestors.
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
::switches::kSitePerProcess) ||
|
||||
extensions::IsIsolateExtensionsEnabled())
|
||||
old_url = opener_frame->document().url();
|
||||
else
|
||||
old_url = opener_frame->top()->document().url();
|
||||
|
||||
// If we're about to open a normal web page from a same-origin opener stuck
|
||||
// in an extension process (other than the Chrome Web Store), we want to
|
||||
// keep it in process to allow the opener to script it.
|
||||
blink::WebDocument opener_document = opener_frame->document();
|
||||
blink::WebSecurityOrigin opener_origin = opener_document.securityOrigin();
|
||||
bool opener_is_extension_url = !opener_origin.isUnique() &&
|
||||
extension_registry->GetExtensionOrAppByURL(
|
||||
opener_document.url()) != nullptr;
|
||||
const extensions::Extension* opener_top_extension =
|
||||
extension_registry->GetExtensionOrAppByURL(old_url);
|
||||
bool opener_is_web_store =
|
||||
opener_top_extension &&
|
||||
opener_top_extension->id() == extensions::kWebStoreAppId;
|
||||
if (!is_extension_url && !opener_is_extension_url && !opener_is_web_store &&
|
||||
IsStandaloneExtensionProcess() &&
|
||||
opener_origin.canRequest(blink::WebURL(new_url)))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only consider keeping non-app URLs in an app process if this window
|
||||
// has an opener (in which case it might be an OAuth popup that tries to
|
||||
// script an iframe within the app).
|
||||
bool should_consider_workaround = !!frame->opener();
|
||||
|
||||
return extensions::CrossesExtensionProcessBoundary(
|
||||
*extension_registry->GetMainThreadExtensionSet(), old_url, new_url,
|
||||
should_consider_workaround);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefExtensionsRendererClient::CefExtensionsRendererClient() {
|
||||
}
|
||||
|
||||
|
@ -24,4 +125,127 @@ int CefExtensionsRendererClient::GetLowestIsolatedWorldId() const {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void CefExtensionsRendererClient::RenderThreadStarted() {
|
||||
content::RenderThread* thread = content::RenderThread::Get();
|
||||
|
||||
extension_dispatcher_delegate_.reset(
|
||||
new extensions::CefExtensionsDispatcherDelegate());
|
||||
extension_dispatcher_.reset(
|
||||
new extensions::Dispatcher(extension_dispatcher_delegate_.get()));
|
||||
resource_request_policy_.reset(
|
||||
new extensions::ResourceRequestPolicy(extension_dispatcher_.get()));
|
||||
guest_view_container_dispatcher_.reset(
|
||||
new extensions::ExtensionsGuestViewContainerDispatcher());
|
||||
|
||||
thread->AddObserver(extension_dispatcher_.get());
|
||||
thread->AddObserver(guest_view_container_dispatcher_.get());
|
||||
}
|
||||
|
||||
void CefExtensionsRendererClient::RenderFrameCreated(
|
||||
content::RenderFrame* render_frame) {
|
||||
new extensions::ExtensionFrameHelper(render_frame,
|
||||
extension_dispatcher_.get());
|
||||
extension_dispatcher_->OnRenderFrameCreated(render_frame);
|
||||
}
|
||||
|
||||
void CefExtensionsRendererClient::RenderViewCreated(
|
||||
content::RenderView* render_view) {
|
||||
new extensions::ExtensionHelper(render_view, extension_dispatcher_.get());
|
||||
}
|
||||
|
||||
bool CefExtensionsRendererClient::OverrideCreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params) {
|
||||
if (params.mimeType.utf8() != content::kBrowserPluginMimeType)
|
||||
return true;
|
||||
|
||||
bool guest_view_api_available = false;
|
||||
extension_dispatcher_->script_context_set().ForEach(
|
||||
render_frame, base::Bind(&IsGuestViewApiAvailableToScriptContext,
|
||||
&guest_view_api_available));
|
||||
return !guest_view_api_available;
|
||||
}
|
||||
|
||||
bool CefExtensionsRendererClient::WillSendRequest(
|
||||
blink::WebFrame* frame,
|
||||
ui::PageTransition transition_type,
|
||||
const GURL& url,
|
||||
GURL* new_url) {
|
||||
// Check whether the request should be allowed. If not allowed, we reset the
|
||||
// URL to something invalid to prevent the request and cause an error.
|
||||
if (url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
!resource_request_policy_->CanRequestResource(url, frame,
|
||||
transition_type)) {
|
||||
*new_url = GURL(chrome::kExtensionInvalidRequestURL);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.SchemeIs(extensions::kExtensionResourceScheme) &&
|
||||
!resource_request_policy_->CanRequestExtensionResourceScheme(url,
|
||||
frame)) {
|
||||
*new_url = GURL(chrome::kExtensionResourceInvalidRequestURL);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer) {
|
||||
const extensions::RendererExtensionRegistry* extension_registry =
|
||||
extensions::RendererExtensionRegistry::Get();
|
||||
|
||||
// Determine if the new URL is an extension (excluding bookmark apps).
|
||||
const extensions::Extension* new_url_extension =
|
||||
extensions::GetNonBookmarkAppExtension(
|
||||
*extension_registry->GetMainThreadExtensionSet(), url);
|
||||
bool is_extension_url = !!new_url_extension;
|
||||
|
||||
// If the navigation would cross an app extent boundary, we also need
|
||||
// to defer to the browser to ensure process isolation. This is not
|
||||
// necessary for server redirects, which will be transferred to a new
|
||||
// process by the browser process when they are ready to commit. It is
|
||||
// necessary for client redirects, which won't be transferred in the same
|
||||
// way.
|
||||
if (!is_server_redirect &&
|
||||
CrossesExtensionExtents(frame, url, is_extension_url,
|
||||
is_initial_navigation)) {
|
||||
// Include the referrer in this case since we're going from a hosted web
|
||||
// page. (the packaged case is handled previously by the extension
|
||||
// navigation test)
|
||||
*send_referrer = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this is a reload, check whether it has the wrong process type. We
|
||||
// should send it to the browser if it's an extension URL (e.g., hosted app)
|
||||
// in a normal process, or if it's a process for an extension that has been
|
||||
// uninstalled. Without --site-per-process mode, we never fork processes
|
||||
// for subframes, so this check only makes sense for top-level frames.
|
||||
// TODO(alexmos,nasko): Figure out how this check should work when reloading
|
||||
// subframes in --site-per-process mode.
|
||||
if (!frame->parent() && frame->document().url() == url) {
|
||||
if (is_extension_url != IsStandaloneExtensionProcess())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
content::BrowserPluginDelegate*
|
||||
CefExtensionsRendererClient::CreateBrowserPluginDelegate(
|
||||
content::RenderFrame* render_frame,
|
||||
const std::string& mime_type,
|
||||
const GURL& original_url) {
|
||||
if (mime_type == content::kBrowserPluginMimeType)
|
||||
return new extensions::ExtensionsGuestViewContainer(render_frame);
|
||||
return new extensions::MimeHandlerViewContainer(render_frame, mime_type,
|
||||
original_url);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
|
|
@ -5,11 +5,34 @@
|
|||
#ifndef CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
#define CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_RENDERER_CLIENT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "extensions/renderer/extensions_renderer_client.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace blink {
|
||||
class WebFrame;
|
||||
class WebLocalFrame;
|
||||
struct WebPluginParams;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
class BrowserPluginDelegate;
|
||||
class RenderFrame;
|
||||
class RenderView;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class Dispatcher;
|
||||
class DispatcherDelegate;
|
||||
class ExtensionsGuestViewContainerDispatcher;
|
||||
class ResourceRequestPolicy;
|
||||
|
||||
class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
||||
public:
|
||||
CefExtensionsRendererClient();
|
||||
|
@ -19,7 +42,34 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
|||
bool IsIncognitoProcess() const override;
|
||||
int GetLowestIsolatedWorldId() const override;
|
||||
|
||||
// See CefContentRendererClient methods with the same names.
|
||||
void RenderThreadStarted();
|
||||
void RenderFrameCreated(content::RenderFrame* render_frame);
|
||||
void RenderViewCreated(content::RenderView* render_view);
|
||||
bool OverrideCreatePlugin(content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params);
|
||||
bool WillSendRequest(blink::WebFrame* frame,
|
||||
ui::PageTransition transition_type,
|
||||
const GURL& url,
|
||||
GURL* new_url);
|
||||
|
||||
static bool ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect,
|
||||
bool* send_referrer);
|
||||
static content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
|
||||
content::RenderFrame* render_frame,
|
||||
const std::string& mime_type,
|
||||
const GURL& original_url);
|
||||
|
||||
private:
|
||||
scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_;
|
||||
scoped_ptr<extensions::Dispatcher> extension_dispatcher_;
|
||||
scoped_ptr<extensions::ExtensionsGuestViewContainerDispatcher>
|
||||
guest_view_container_dispatcher_;
|
||||
scoped_ptr<extensions::ResourceRequestPolicy> resource_request_policy_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsRendererClient);
|
||||
};
|
||||
|
||||
|
|
|
@ -8,12 +8,14 @@
|
|||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/renderer/plugins/plugin_preroller.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/renderer/custom_menu_commands.h"
|
||||
#include "components/content_settings/content/common/content_settings_messages.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_thread.h"
|
||||
|
@ -274,15 +276,24 @@ blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() {
|
|||
|
||||
gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return gin::Wrappable<CefPluginPlaceholder>::GetObjectTemplateBuilder(
|
||||
isolate)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"hide", &CefPluginPlaceholder::HideCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"load", &CefPluginPlaceholder::LoadCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"didFinishLoading",
|
||||
&CefPluginPlaceholder::DidFinishLoadingCallback)
|
||||
.SetMethod("openAboutPlugins",
|
||||
&CefPluginPlaceholder::OpenAboutPluginsCallback);
|
||||
gin::ObjectTemplateBuilder builder =
|
||||
gin::Wrappable<CefPluginPlaceholder>::GetObjectTemplateBuilder(isolate)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"hide", &CefPluginPlaceholder::HideCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"load", &CefPluginPlaceholder::LoadCallback)
|
||||
.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"didFinishLoading",
|
||||
&CefPluginPlaceholder::DidFinishLoadingCallback)
|
||||
.SetMethod("openAboutPlugins",
|
||||
&CefPluginPlaceholder::OpenAboutPluginsCallback);
|
||||
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnablePluginPlaceholderTesting)) {
|
||||
builder.SetMethod<void (CefPluginPlaceholder::*)()>(
|
||||
"didFinishIconRepositionForTesting",
|
||||
&CefPluginPlaceholder::DidFinishIconRepositionForTestingCallback);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
|
|||
~CefWebURLLoaderClient() override;
|
||||
|
||||
// blink::WebURLLoaderClient methods.
|
||||
void willSendRequest(
|
||||
void willFollowRedirect(
|
||||
WebURLLoader* loader,
|
||||
WebURLRequest& newRequest,
|
||||
const WebURLResponse& redirectResponse) override;
|
||||
|
@ -260,7 +260,7 @@ CefWebURLLoaderClient::CefWebURLLoaderClient(
|
|||
CefWebURLLoaderClient::~CefWebURLLoaderClient() {
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::willSendRequest(
|
||||
void CefWebURLLoaderClient::willFollowRedirect(
|
||||
WebURLLoader* loader,
|
||||
WebURLRequest& newRequest,
|
||||
const WebURLResponse& redirectResponse) {
|
||||
|
|
|
@ -160,17 +160,22 @@ blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool ParseCSSColor(const blink::WebString& string, bool strict, SkColor& color) {
|
||||
blink::RGBA32 rgba_color =
|
||||
void InitializePartitionAlloc() {
|
||||
WTF::Partitions::initialize(nullptr);
|
||||
}
|
||||
|
||||
bool ParseCSSColor(const blink::WebString& string,
|
||||
bool strict, SkColor& color) {
|
||||
blink::Color rgba_color =
|
||||
blink::makeRGBA(SkColorGetR(color), SkColorGetG(color),
|
||||
SkColorGetB(color), SkColorGetA(color));
|
||||
if (!blink::CSSParser::parseColor(rgba_color, string, strict))
|
||||
return false;
|
||||
|
||||
color = SkColorSetARGB(blink::alphaChannel(rgba_color),
|
||||
blink::redChannel(rgba_color),
|
||||
blink::greenChannel(rgba_color),
|
||||
blink::blueChannel(rgba_color));
|
||||
color = SkColorSetARGB(rgba_color.alpha(),
|
||||
rgba_color.red(),
|
||||
rgba_color.green(),
|
||||
rgba_color.blue());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ int64 GetIdentifier(blink::WebFrame* frame);
|
|||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||
blink::WebFrame* relative_to_frame);
|
||||
|
||||
// Initialize PartitionAlloc before calling Blink functions from the browser
|
||||
// process. Safe to call multiple times.
|
||||
void InitializePartitionAlloc();
|
||||
|
||||
bool ParseCSSColor(const blink::WebString& string, bool strict, SkColor& color);
|
||||
|
||||
} // webkit_glue
|
||||
|
|
|
@ -55,7 +55,7 @@ int CEF_CALLBACK geolocation_handler_on_request_geolocation_permission(
|
|||
|
||||
void CEF_CALLBACK geolocation_handler_on_cancel_geolocation_permission(
|
||||
struct _cef_geolocation_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* requesting_url, int request_id) {
|
||||
int request_id) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
|
@ -65,15 +65,10 @@ void CEF_CALLBACK geolocation_handler_on_cancel_geolocation_permission(
|
|||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: requesting_url; type: string_byref_const
|
||||
DCHECK(requesting_url);
|
||||
if (!requesting_url)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefGeolocationHandlerCppToC::Get(self)->OnCancelGeolocationPermission(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(requesting_url),
|
||||
request_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ bool CefGeolocationHandlerCToCpp::OnRequestGeolocationPermission(
|
|||
}
|
||||
|
||||
void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser, const CefString& requesting_url,
|
||||
int request_id) {
|
||||
CefRefPtr<CefBrowser> browser, int request_id) {
|
||||
cef_geolocation_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_cancel_geolocation_permission))
|
||||
return;
|
||||
|
@ -63,15 +62,10 @@ void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission(
|
|||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: requesting_url; type: string_byref_const
|
||||
DCHECK(!requesting_url.empty());
|
||||
if (requesting_url.empty())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_cancel_geolocation_permission(_struct,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
requesting_url.GetStruct(),
|
||||
request_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CefGeolocationHandlerCToCpp
|
|||
const CefString& requesting_url, int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) override;
|
||||
void OnCancelGeolocationPermission(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url, int request_id) override;
|
||||
int request_id) override;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
|
|
@ -253,13 +253,14 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
|
|||
const std::string& message_name = message->GetName();
|
||||
if (message_name == query_message_name_) {
|
||||
CefRefPtr<CefListValue> args = message->GetArgumentList();
|
||||
DCHECK_EQ(args->GetSize(), 6U);
|
||||
DCHECK_EQ(args->GetSize(), 7U);
|
||||
|
||||
const int64 frame_id = CefInt64Set(args->GetInt(0), args->GetInt(1));
|
||||
const int context_id = args->GetInt(2);
|
||||
const int request_id = args->GetInt(3);
|
||||
const CefString& request = args->GetString(4);
|
||||
const bool persistent = args->GetBool(5);
|
||||
const bool is_main_frame = args->GetBool(2);
|
||||
const int context_id = args->GetInt(3);
|
||||
const int request_id = args->GetInt(4);
|
||||
const CefString& request = args->GetString(5);
|
||||
const bool persistent = args->GetBool(6);
|
||||
|
||||
if (handler_set_.empty()) {
|
||||
// No handlers so cancel the query.
|
||||
|
@ -270,7 +271,11 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
|
|||
const int browser_id = browser->GetIdentifier();
|
||||
const int64 query_id = query_id_generator_.GetNextId();
|
||||
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrame(frame_id);
|
||||
CefRefPtr<CefFrame> frame;
|
||||
if (is_main_frame)
|
||||
frame = browser->GetMainFrame();
|
||||
else
|
||||
frame = browser->GetFrame(frame_id);
|
||||
CefRefPtr<CallbackImpl> callback(
|
||||
new CallbackImpl(this, browser_id, query_id, persistent));
|
||||
|
||||
|
@ -298,6 +303,7 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
|
|||
QueryInfo* info = new QueryInfo;
|
||||
info->browser = browser;
|
||||
info->frame_id = frame_id;
|
||||
info->is_main_frame = is_main_frame;
|
||||
info->context_id = context_id;
|
||||
info->request_id = request_id;
|
||||
info->persistent = persistent;
|
||||
|
@ -334,6 +340,7 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
|
|||
// Browser and frame originated the query.
|
||||
CefRefPtr<CefBrowser> browser;
|
||||
int64 frame_id;
|
||||
bool is_main_frame;
|
||||
|
||||
// IDs that uniquely identify the query in the renderer process. These
|
||||
// values are opaque to the browser process but must be returned with the
|
||||
|
@ -476,7 +483,11 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
|
|||
if (notify_renderer)
|
||||
SendQueryFailure(info, kCanceledErrorCode, kCanceledErrorMessage);
|
||||
|
||||
CefRefPtr<CefFrame> frame = info->browser->GetFrame(info->frame_id);
|
||||
CefRefPtr<CefFrame> frame;
|
||||
if (info->is_main_frame)
|
||||
frame = info->browser->GetMainFrame();
|
||||
else
|
||||
frame = info->browser->GetFrame(info->frame_id);
|
||||
info->handler->OnQueryCanceled(info->browser, frame, query_id);
|
||||
|
||||
// Invalidate the callback.
|
||||
|
@ -668,11 +679,12 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
|
||||
const int context_id = GetIDForContext(context);
|
||||
const int64 frame_id = context->GetFrame()->GetIdentifier();
|
||||
const bool is_main_frame = context->GetFrame()->IsMain();
|
||||
const bool persistent =
|
||||
(persistentVal.get() && persistentVal->GetBoolValue());
|
||||
|
||||
const int request_id = router_->SendQuery(
|
||||
context->GetBrowser(), frame_id, context_id,
|
||||
context->GetBrowser(), frame_id, is_main_frame, context_id,
|
||||
requestVal->GetStringValue(), persistent, successVal, failureVal);
|
||||
retval = CefV8Value::CreateInt(request_id);
|
||||
return true;
|
||||
|
@ -687,9 +699,7 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
if (request_id != kReservedId) {
|
||||
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
|
||||
const int context_id = GetIDForContext(context);
|
||||
const int64 frame_id = context->GetFrame()->GetIdentifier();
|
||||
|
||||
result = router_->SendCancel(context->GetBrowser(), frame_id,
|
||||
result = router_->SendCancel(context->GetBrowser(),
|
||||
context_id, request_id);
|
||||
}
|
||||
retval = CefV8Value::CreateBool(result);
|
||||
|
@ -817,7 +827,7 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
const int context_id = GetIDForContext(context, true);
|
||||
if (context_id != kReservedId) {
|
||||
// Cancel all pending requests for the context.
|
||||
SendCancel(browser, frame->GetIdentifier(), context_id, kReservedId);
|
||||
SendCancel(browser, context_id, kReservedId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -915,6 +925,7 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
// Returns the new request ID.
|
||||
int SendQuery(CefRefPtr<CefBrowser> browser,
|
||||
int64 frame_id,
|
||||
bool is_main_frame,
|
||||
int context_id,
|
||||
const CefString& request,
|
||||
bool persistent,
|
||||
|
@ -937,10 +948,11 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
CefRefPtr<CefListValue> args = message->GetArgumentList();
|
||||
args->SetInt(0, CefInt64GetLow(frame_id));
|
||||
args->SetInt(1, CefInt64GetHigh(frame_id));
|
||||
args->SetInt(2, context_id);
|
||||
args->SetInt(3, request_id);
|
||||
args->SetString(4, request);
|
||||
args->SetBool(5, persistent);
|
||||
args->SetBool(2, is_main_frame);
|
||||
args->SetInt(3, context_id);
|
||||
args->SetInt(4, request_id);
|
||||
args->SetString(5, request);
|
||||
args->SetBool(6, persistent);
|
||||
|
||||
browser->SendProcessMessage(PID_BROWSER, message);
|
||||
|
||||
|
@ -951,7 +963,6 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
|||
// will be canceled, otherwise only the specified |request_id| will be
|
||||
// canceled. Returns true if any request was canceled.
|
||||
bool SendCancel(CefRefPtr<CefBrowser> browser,
|
||||
int64 frame_id,
|
||||
int context_id,
|
||||
int request_id) {
|
||||
CEF_REQUIRE_RENDERER_THREAD();
|
||||
|
|
|
@ -207,12 +207,6 @@ patches = [
|
|||
'name': 'render_widget_host_1070383005',
|
||||
'path': '../content/browser/renderer_host/',
|
||||
},
|
||||
{
|
||||
# Fix incorrect forward declaration in extension_process_policy.h.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=543230
|
||||
'name': 'extension_process_policy_543230',
|
||||
'path': '../chrome/common/extensions/',
|
||||
},
|
||||
{
|
||||
# Fix missing check for defined(ENABLE_THEMES) in
|
||||
# renderer_preferences_util.cc on Linux.
|
||||
|
@ -226,4 +220,18 @@ patches = [
|
|||
'name': 'font_family_cache_1501',
|
||||
'path': '../chrome/browser/',
|
||||
},
|
||||
{
|
||||
# Fix crash while printing on Windows by properly initializing V8 in the PDF
|
||||
# module.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=549365#c12
|
||||
'name': 'pdf_print_549365',
|
||||
'path': '../pdf/',
|
||||
},
|
||||
{
|
||||
# Fix crash while printing on Windows by properly initializing V8 in the PDF
|
||||
# module.
|
||||
# https://code.google.com/p/chromium/issues/detail?id=549365#c17
|
||||
'name': 'pdfium_print_549365',
|
||||
'path': '../third_party/pdfium/',
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
|
||||
index ecda893d..446c6e6 100644
|
||||
index b389e40..c3b5d3e 100644
|
||||
--- render_widget_host_view_guest.cc
|
||||
+++ render_widget_host_view_guest.cc
|
||||
@@ -191,6 +191,9 @@ void RenderWidgetHostViewGuest::Destroy() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
||||
index 00529ff..57ccf08 100644
|
||||
index cef0842..d79092d 100644
|
||||
--- browser/browser_plugin/browser_plugin_guest.cc
|
||||
+++ browser/browser_plugin/browser_plugin_guest.cc
|
||||
@@ -23,7 +23,7 @@
|
||||
|
@ -11,7 +11,7 @@ index 00529ff..57ccf08 100644
|
|||
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
||||
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
||||
#include "content/common/content_constants_internal.h"
|
||||
@@ -289,20 +289,19 @@ void BrowserPluginGuest::InitInternal(
|
||||
@@ -290,20 +290,19 @@ void BrowserPluginGuest::InitInternal(
|
||||
guest_window_rect_ = params.view_rect;
|
||||
|
||||
if (owner_web_contents_ != owner_web_contents) {
|
||||
|
@ -36,24 +36,23 @@ index 00529ff..57ccf08 100644
|
|||
}
|
||||
|
||||
RendererPreferences* renderer_prefs =
|
||||
@@ -748,12 +747,9 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
@@ -792,11 +791,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
// This will trigger a callback to RenderViewReady after a round-trip IPC.
|
||||
static_cast<RenderViewHostImpl*>(
|
||||
GetWebContents()->GetRenderViewHost())->Init();
|
||||
- WebContentsViewGuest* web_contents_view =
|
||||
- static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
- if (!web_contents()->GetRenderViewHost()->GetView()) {
|
||||
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
|
||||
- web_contents_view->CreateViewForWidget(
|
||||
- web_contents()->GetRenderViewHost(), true);
|
||||
- }
|
||||
+ if (!web_contents()->GetRenderViewHost()->GetView())
|
||||
+ delegate_->CreateViewForWidget(GetWebContents()->GetView(),
|
||||
+ web_contents()->GetRenderViewHost());
|
||||
- web_contents()->GetRenderViewHost()->GetWidget(), true);
|
||||
+ delegate_->CreateViewForWidget(
|
||||
+ GetWebContents()->GetView(),
|
||||
+ web_contents()->GetRenderViewHost()->GetWidget());
|
||||
}
|
||||
}
|
||||
|
||||
InitInternal(params, embedder_web_contents);
|
||||
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
||||
index fd7dec4..49d4f99 100644
|
||||
index bfa19e4..d788495 100644
|
||||
--- public/browser/browser_plugin_guest_delegate.cc
|
||||
+++ public/browser/browser_plugin_guest_delegate.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
|
@ -65,7 +64,7 @@ index fd7dec4..49d4f99 100644
|
|||
namespace content {
|
||||
|
||||
bool BrowserPluginGuestDelegate::CanRunInDetachedState() const {
|
||||
@@ -30,4 +32,23 @@ bool BrowserPluginGuestDelegate::StopFinding(StopFindAction action) {
|
||||
@@ -32,4 +34,23 @@ bool BrowserPluginGuestDelegate::HandleStopFindingForEmbedder(
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ index fd7dec4..49d4f99 100644
|
|||
+
|
||||
} // namespace content
|
||||
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
|
||||
index aabe27b..8ff46f4 100644
|
||||
index 4dd1a4c..b299190 100644
|
||||
--- public/browser/browser_plugin_guest_delegate.h
|
||||
+++ public/browser/browser_plugin_guest_delegate.h
|
||||
@@ -21,6 +21,8 @@ class Size;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
diff --git web_contents_impl.cc web_contents_impl.cc
|
||||
index 7c84d90..2aaace4 100644
|
||||
index bf45da9..19ef2c7 100644
|
||||
--- web_contents_impl.cc
|
||||
+++ web_contents_impl.cc
|
||||
@@ -1353,23 +1353,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
MSG_ROUTING_NONE);
|
||||
@@ -1351,23 +1351,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
main_frame_widget_routing_id);
|
||||
frame_tree_.root()->SetFrameName(params.main_frame_name);
|
||||
|
||||
- WebContentsViewDelegate* delegate =
|
||||
|
@ -50,7 +50,7 @@ index 7c84d90..2aaace4 100644
|
|||
}
|
||||
CHECK(render_view_host_delegate_view_);
|
||||
CHECK(view_.get());
|
||||
@@ -1715,6 +1722,9 @@ void WebContentsImpl::CreateNewWindow(
|
||||
@@ -1719,11 +1726,14 @@ void WebContentsImpl::CreateNewWindow(
|
||||
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
|
||||
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
|
||||
|
||||
|
@ -58,20 +58,15 @@ index 7c84d90..2aaace4 100644
|
|||
+ content::RenderViewHostDelegateView* delegate_view = NULL;
|
||||
+
|
||||
if (delegate_ &&
|
||||
!delegate_->ShouldCreateWebContents(this,
|
||||
route_id,
|
||||
@@ -1723,7 +1733,9 @@ void WebContentsImpl::CreateNewWindow(
|
||||
params.frame_name,
|
||||
params.target_url,
|
||||
partition_id,
|
||||
- session_storage_namespace)) {
|
||||
+ session_storage_namespace,
|
||||
+ &view,
|
||||
+ &delegate_view)) {
|
||||
!delegate_->ShouldCreateWebContents(
|
||||
this, route_id, main_frame_route_id, main_frame_widget_route_id,
|
||||
params.window_container_type, params.frame_name, params.target_url,
|
||||
- partition_id, session_storage_namespace)) {
|
||||
+ partition_id, session_storage_namespace, &view, &delegate_view)) {
|
||||
if (route_id != MSG_ROUTING_NONE &&
|
||||
!RenderViewHost::FromID(render_process_id, route_id)) {
|
||||
// If the embedder didn't create a WebContents for this route, we need to
|
||||
@@ -1745,6 +1757,8 @@ void WebContentsImpl::CreateNewWindow(
|
||||
@@ -1748,6 +1758,8 @@ void WebContentsImpl::CreateNewWindow(
|
||||
create_params.opener_render_process_id = render_process_id;
|
||||
create_params.opener_render_frame_id = params.opener_render_frame_id;
|
||||
create_params.opener_suppressed = params.opener_suppressed;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git common.gypi common.gypi
|
||||
index cce7b3c..84a702a 100644
|
||||
index 780f43d..409a018 100644
|
||||
--- common.gypi
|
||||
+++ common.gypi
|
||||
@@ -9,6 +9,9 @@
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git ui/browser.cc ui/browser.cc
|
||||
index 36d24b6..bbc5075 100644
|
||||
index d6a2493..c352fd6a 100644
|
||||
--- ui/browser.cc
|
||||
+++ ui/browser.cc
|
||||
@@ -1669,7 +1669,9 @@ bool Browser::ShouldCreateWebContents(
|
||||
@@ -1673,7 +1673,9 @@ bool Browser::ShouldCreateWebContents(
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
@ -12,9 +12,9 @@ index 36d24b6..bbc5075 100644
|
|||
+ content::RenderViewHostDelegateView** delegate_view) {
|
||||
if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
|
||||
// If a BackgroundContents is created, suppress the normal WebContents.
|
||||
return !MaybeCreateBackgroundContents(route_id,
|
||||
return !MaybeCreateBackgroundContents(
|
||||
diff --git ui/browser.h ui/browser.h
|
||||
index e296569..bf03785 100644
|
||||
index 1511788..23ffe53 100644
|
||||
--- ui/browser.h
|
||||
+++ ui/browser.h
|
||||
@@ -591,7 +591,9 @@ class Browser : public TabStripModelObserver,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
|
||||
index b7ed844..c6ec2a9 100644
|
||||
index b74845f..4ac77c3 100644
|
||||
--- content/browser/compositor/gpu_process_transport_factory.cc
|
||||
+++ content/browser/compositor/gpu_process_transport_factory.cc
|
||||
@@ -142,6 +142,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
|
||||
@@ -143,6 +143,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
|
||||
scoped_ptr<cc::SoftwareOutputDevice>
|
||||
GpuProcessTransportFactory::CreateSoftwareOutputDevice(
|
||||
ui::Compositor* compositor) {
|
||||
|
@ -17,10 +17,10 @@ index b7ed844..c6ec2a9 100644
|
|||
return scoped_ptr<cc::SoftwareOutputDevice>(
|
||||
new SoftwareOutputDeviceWin(software_backing_.get(), compositor));
|
||||
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
|
||||
index fe2a033..b6cd7c9 100644
|
||||
index 1602d30..3dd3e3e 100644
|
||||
--- ui/compositor/compositor.h
|
||||
+++ ui/compositor/compositor.h
|
||||
@@ -15,6 +15,7 @@
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/time/time.h"
|
||||
#include "cc/output/begin_frame_args.h"
|
||||
|
@ -28,7 +28,7 @@ index fe2a033..b6cd7c9 100644
|
|||
#include "cc/surfaces/surface_sequence.h"
|
||||
#include "cc/trees/layer_tree_host_client.h"
|
||||
#include "cc/trees/layer_tree_host_single_thread_client.h"
|
||||
@@ -149,6 +150,17 @@ class COMPOSITOR_EXPORT CompositorBeginFrameObserver {
|
||||
@@ -148,6 +149,17 @@ class COMPOSITOR_EXPORT CompositorBeginFrameObserver {
|
||||
virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ index fe2a033..b6cd7c9 100644
|
|||
// Compositor object to take care of GPU painting.
|
||||
// A Browser compositor object is responsible for generating the final
|
||||
// displayable form of pixels comprising a single widget's contents. It draws an
|
||||
@@ -169,6 +181,9 @@ class COMPOSITOR_EXPORT Compositor
|
||||
@@ -168,6 +180,9 @@ class COMPOSITOR_EXPORT Compositor
|
||||
// Schedules a redraw of the layer tree associated with this compositor.
|
||||
void ScheduleDraw();
|
||||
|
||||
|
@ -56,7 +56,7 @@ index fe2a033..b6cd7c9 100644
|
|||
// Sets the root of the layer tree drawn by this Compositor. The root layer
|
||||
// must have no parent. The compositor's root layer is reset if the root layer
|
||||
// is destroyed. NULL can be passed to reset the root layer, in which case the
|
||||
@@ -335,6 +350,8 @@ class COMPOSITOR_EXPORT Compositor
|
||||
@@ -338,6 +353,8 @@ class COMPOSITOR_EXPORT Compositor
|
||||
|
||||
ui::ContextFactory* context_factory_;
|
||||
|
||||
|
|
|
@ -1,78 +1,60 @@
|
|||
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
|
||||
index e09e803..ff26996 100644
|
||||
index 3d0316f..ccd1f58 100644
|
||||
--- public/renderer/content_renderer_client.cc
|
||||
+++ public/renderer/content_renderer_client.cc
|
||||
@@ -98,6 +98,18 @@ bool ContentRendererClient::AllowPopup() {
|
||||
@@ -98,7 +98,6 @@ bool ContentRendererClient::AllowPopup() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool ContentRendererClient::HandleNavigation(
|
||||
+ RenderFrame* render_frame,
|
||||
+ DocumentState* document_state,
|
||||
+ int opener_id,
|
||||
+ blink::WebFrame* frame,
|
||||
+ const blink::WebURLRequest& request,
|
||||
+ blink::WebNavigationType type,
|
||||
+ blink::WebNavigationPolicy default_policy,
|
||||
+ bool is_redirect) {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
-#ifdef OS_ANDROID
|
||||
bool ContentRendererClient::HandleNavigation(
|
||||
RenderFrame* render_frame,
|
||||
bool is_content_initiated,
|
||||
@@ -110,7 +109,6 @@ bool ContentRendererClient::HandleNavigation(
|
||||
bool is_redirect) {
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
|
||||
bool ContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
const GURL& url,
|
||||
const std::string& http_method,
|
||||
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
|
||||
index df8d501..f3a2068 100644
|
||||
index f55c691..0aeb1b24 100644
|
||||
--- public/renderer/content_renderer_client.h
|
||||
+++ public/renderer/content_renderer_client.h
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "base/strings/string16.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
|
||||
+#include "third_party/WebKit/public/web/WebNavigationPolicy.h"
|
||||
+#include "third_party/WebKit/public/web/WebNavigationType.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
@@ -191,6 +193,17 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||
@@ -192,7 +192,6 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||
// Returns true if a popup window should be allowed.
|
||||
virtual bool AllowPopup();
|
||||
|
||||
+ // Returns true if the navigation was handled by the embedder and should be
|
||||
+ // ignored by WebKit. This method is used by CEF and android_webview.
|
||||
+ virtual bool HandleNavigation(RenderFrame* render_frame,
|
||||
+ DocumentState* document_state,
|
||||
+ int opener_id,
|
||||
+ blink::WebFrame* frame,
|
||||
+ const blink::WebURLRequest& request,
|
||||
+ blink::WebNavigationType type,
|
||||
+ blink::WebNavigationPolicy default_policy,
|
||||
+ bool is_redirect);
|
||||
+
|
||||
-#ifdef OS_ANDROID
|
||||
// TODO(sgurun) This callback is deprecated and will be removed as soon
|
||||
// as android webview completes implementation of a resource throttle based
|
||||
// shouldoverrideurl implementation. See crbug.com/325351
|
||||
@@ -207,7 +206,6 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||
blink::WebNavigationType type,
|
||||
blink::WebNavigationPolicy default_policy,
|
||||
bool is_redirect);
|
||||
-#endif
|
||||
|
||||
// Returns true if we should fork a new process for the given navigation.
|
||||
// If |send_referrer| is set to false (which is the default), no referrer
|
||||
// header will be send for the navigation. Otherwise, the referrer header is
|
||||
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
|
||||
index ff5d269..6ca4948 100644
|
||||
index 33219e5..f6aac25 100644
|
||||
--- renderer/render_frame_impl.cc
|
||||
+++ renderer/render_frame_impl.cc
|
||||
@@ -4274,6 +4274,19 @@ void RenderFrameImpl::OnFailedNavigation(
|
||||
WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
|
||||
RenderFrame* render_frame,
|
||||
const NavigationPolicyInfo& info) {
|
||||
+ if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
|
||||
+ GetContentClient()->renderer()->HandleNavigation(
|
||||
+ render_frame,
|
||||
+ static_cast<DocumentState*>(info.extraData),
|
||||
+ render_view_->opener_id_,
|
||||
+ info.frame,
|
||||
+ info.urlRequest,
|
||||
+ info.navigationType,
|
||||
+ info.defaultPolicy,
|
||||
+ info.isRedirect)) {
|
||||
+ return blink::WebNavigationPolicyIgnore;
|
||||
+ }
|
||||
+
|
||||
Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
|
||||
info.urlRequest));
|
||||
@@ -4395,7 +4395,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
(pending_navigation_params_ &&
|
||||
!pending_navigation_params_->request_params.redirects.empty());
|
||||
|
||||
-#ifdef OS_ANDROID
|
||||
// The handlenavigation API is deprecated and will be removed once
|
||||
// crbug.com/325351 is resolved.
|
||||
if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
|
||||
@@ -4405,7 +4404,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
is_redirect)) {
|
||||
return blink::WebNavigationPolicyIgnore;
|
||||
}
|
||||
-#endif
|
||||
|
||||
Referrer referrer(
|
||||
RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest));
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
diff --git extension_process_policy.h extension_process_policy.h
|
||||
index 7231c0f..2323483 100644
|
||||
--- extension_process_policy.h
|
||||
+++ extension_process_policy.h
|
||||
@@ -5,12 +5,12 @@
|
||||
#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_PROCESS_POLICY_H_
|
||||
#define CHROME_COMMON_EXTENSIONS_EXTENSION_PROCESS_POLICY_H_
|
||||
|
||||
-class ExtensionSet;
|
||||
class GURL;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class Extension;
|
||||
+class ExtensionSet;
|
||||
|
||||
// Returns the extension for the given URL. Excludes extension objects for
|
||||
// bookmark apps, which do not use the app process model.
|
|
@ -1,8 +1,8 @@
|
|||
diff --git browser/guest_view/extension_options/extension_options_guest.cc browser/guest_view/extension_options/extension_options_guest.cc
|
||||
index cfdb5cf..5a4749d 100644
|
||||
index 6a34aa0..1743907 100644
|
||||
--- browser/guest_view/extension_options/extension_options_guest.cc
|
||||
+++ browser/guest_view/extension_options/extension_options_guest.cc
|
||||
@@ -196,7 +196,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents(
|
||||
@@ -197,7 +197,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents(
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
@ -14,17 +14,17 @@ index cfdb5cf..5a4749d 100644
|
|||
// view is used for displaying embedded extension options, we want any
|
||||
// external links to be opened in a new tab, not in a new guest view.
|
||||
diff --git browser/guest_view/extension_options/extension_options_guest.h browser/guest_view/extension_options/extension_options_guest.h
|
||||
index 9cf37d2..19e3b6d 100644
|
||||
index 922d670..cb19e4e 100644
|
||||
--- browser/guest_view/extension_options/extension_options_guest.h
|
||||
+++ browser/guest_view/extension_options/extension_options_guest.h
|
||||
@@ -49,7 +49,9 @@ class ExtensionOptionsGuest
|
||||
@@ -54,7 +54,9 @@ class ExtensionOptionsGuest
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
- content::SessionStorageNamespace* session_storage_namespace) override;
|
||||
- content::SessionStorageNamespace* session_storage_namespace) final;
|
||||
+ content::SessionStorageNamespace* session_storage_namespace,
|
||||
+ content::WebContentsView** view,
|
||||
+ content::RenderViewHostDelegateView** delegate_view) override;
|
||||
+ content::RenderViewHostDelegateView** delegate_view) final;
|
||||
|
||||
// content::WebContentsObserver implementation.
|
||||
void DidNavigateMainFrame(
|
||||
void DidNavigateMainFrame(const content::LoadCommittedDetails& details,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git resource_ids resource_ids
|
||||
index 92456c8..9fa9ce3 100644
|
||||
index a5bcffe..6b897df 100644
|
||||
--- resource_ids
|
||||
+++ resource_ids
|
||||
@@ -14,6 +14,12 @@
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git gyp/generator/ninja.py gyp/generator/ninja.py
|
||||
index 51c288b..d996bbd 100644
|
||||
index 58be3bf..4dcb2a6 100644
|
||||
--- gyp/generator/ninja.py
|
||||
+++ gyp/generator/ninja.py
|
||||
@@ -741,7 +741,16 @@ class NinjaWriter(object):
|
||||
@@ -745,7 +745,16 @@ class NinjaWriter(object):
|
||||
for path in copy['files']:
|
||||
# Normalize the path so trailing slashes don't confuse us.
|
||||
path = os.path.normpath(path)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git hwnd_message_handler.cc hwnd_message_handler.cc
|
||||
index 5348080..4f9bec5 100644
|
||||
index 035df76..d1517b4 100644
|
||||
--- hwnd_message_handler.cc
|
||||
+++ hwnd_message_handler.cc
|
||||
@@ -2364,8 +2364,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git input_method_win.cc input_method_win.cc
|
||||
index df75bb2..a688138 100644
|
||||
index ef500a7..5454067 100644
|
||||
--- input_method_win.cc
|
||||
+++ input_method_win.cc
|
||||
@@ -548,8 +548,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
|
||||
@@ -586,8 +586,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
|
||||
// receiving keyboard input as long as it is an active window. This works well
|
||||
// even when the |attached_window_handle| becomes active but has not received
|
||||
// WM_FOCUS yet.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git mime_handler_view_guest.cc mime_handler_view_guest.cc
|
||||
index aee7d72..951d0cc 100644
|
||||
index 55b2426..bea8823 100644
|
||||
--- mime_handler_view_guest.cc
|
||||
+++ mime_handler_view_guest.cc
|
||||
@@ -131,6 +131,8 @@ void MimeHandlerViewGuest::CreateWebContents(
|
||||
@@ -132,6 +132,8 @@ void MimeHandlerViewGuest::CreateWebContents(
|
||||
WebContents::CreateParams params(browser_context(),
|
||||
guest_site_instance.get());
|
||||
params.guest_delegate = this;
|
||||
|
@ -11,7 +11,7 @@ index aee7d72..951d0cc 100644
|
|||
callback.Run(WebContents::Create(params));
|
||||
}
|
||||
|
||||
@@ -155,6 +157,30 @@ bool MimeHandlerViewGuest::ZoomPropagatesFromEmbedderToGuest() const {
|
||||
@@ -156,6 +158,30 @@ bool MimeHandlerViewGuest::ZoomPropagatesFromEmbedderToGuest() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,12 @@ index aee7d72..951d0cc 100644
|
|||
WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
diff --git mime_handler_view_guest.h mime_handler_view_guest.h
|
||||
index 26c0e11..a568b45 100644
|
||||
index a876f6a..4808aa3 100644
|
||||
--- mime_handler_view_guest.h
|
||||
+++ mime_handler_view_guest.h
|
||||
@@ -67,6 +67,15 @@ class MimeHandlerViewGuest :
|
||||
bool ShouldHandleFindRequestsForEmbedder() const override;
|
||||
bool ZoomPropagatesFromEmbedderToGuest() const override;
|
||||
@@ -74,6 +74,15 @@ class MimeHandlerViewGuest :
|
||||
bool ShouldHandleFindRequestsForEmbedder() const final;
|
||||
bool ZoomPropagatesFromEmbedderToGuest() const final;
|
||||
|
||||
+ // content::BrowserPluginGuestDelegate implementation
|
||||
+ void OnGuestAttached(content::WebContentsView* guest_view,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git url_request.h url_request.h
|
||||
index 9209697..a2f73f8 100644
|
||||
index f685cf7..d01faaee 100644
|
||||
--- url_request.h
|
||||
+++ url_request.h
|
||||
@@ -640,10 +640,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
|
||||
@@ -645,10 +645,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
|
||||
// or after the response headers are received.
|
||||
void GetConnectionAttempts(ConnectionAttempts* out) const;
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
diff --git pdf.cc pdf.cc
|
||||
index 1f580e4..9521fdf 100644
|
||||
--- pdf.cc
|
||||
+++ pdf.cc
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
-#include "gin/array_buffer.h"
|
||||
-#include "gin/public/isolate_holder.h"
|
||||
#include "pdf/out_of_process_instance.h"
|
||||
#include "ppapi/c/ppp.h"
|
||||
#include "ppapi/cpp/private/internal_module.h"
|
||||
@@ -24,14 +22,6 @@ namespace {
|
||||
|
||||
bool g_sdk_initialized_via_pepper = false;
|
||||
|
||||
-gin::IsolateHolder* g_isolate_holder = nullptr;
|
||||
-
|
||||
-void TearDownV8() {
|
||||
- g_isolate_holder->isolate()->Exit();
|
||||
- delete g_isolate_holder;
|
||||
- g_isolate_holder = nullptr;
|
||||
-}
|
||||
-
|
||||
} // namespace
|
||||
|
||||
PDFModule::PDFModule() {
|
||||
@@ -39,7 +29,6 @@ PDFModule::PDFModule() {
|
||||
|
||||
PDFModule::~PDFModule() {
|
||||
if (g_sdk_initialized_via_pepper) {
|
||||
- TearDownV8();
|
||||
chrome_pdf::ShutdownSDK();
|
||||
g_sdk_initialized_via_pepper = false;
|
||||
}
|
||||
@@ -60,15 +49,8 @@ pp::Instance* PDFModule::CreateInstance(PP_Instance instance) {
|
||||
v8::V8::SetNativesDataBlob(&natives);
|
||||
v8::V8::SetSnapshotDataBlob(&snapshot);
|
||||
}
|
||||
- gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||
- gin::ArrayBufferAllocator::SharedInstance());
|
||||
- g_isolate_holder =
|
||||
- new gin::IsolateHolder(gin::IsolateHolder::kSingleThread);
|
||||
- g_isolate_holder->isolate()->Enter();
|
||||
- if (!chrome_pdf::InitializeSDK()) {
|
||||
- TearDownV8();
|
||||
+ if (!chrome_pdf::InitializeSDK())
|
||||
return NULL;
|
||||
- }
|
||||
g_sdk_initialized_via_pepper = true;
|
||||
}
|
||||
|
||||
diff --git pdfium/pdfium_engine.cc pdfium/pdfium_engine.cc
|
||||
index 8631088..d23c141 100644
|
||||
--- pdfium/pdfium_engine.cc
|
||||
+++ pdfium/pdfium_engine.cc
|
||||
@@ -18,7 +18,9 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
+#include "gin/array_buffer.h"
|
||||
#include "gin/public/gin_embedders.h"
|
||||
+#include "gin/public/isolate_holder.h"
|
||||
#include "pdf/draw_utils.h"
|
||||
#include "pdf/pdfium/pdfium_api_string_buffer_adapter.h"
|
||||
#include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
|
||||
@@ -449,9 +451,27 @@ std::string GetDocumentMetadata(FPDF_DOCUMENT doc, const std::string& key) {
|
||||
return base::UTF16ToUTF8(value);
|
||||
}
|
||||
|
||||
+gin::IsolateHolder* g_isolate_holder = nullptr;
|
||||
+
|
||||
+void SetUpV8() {
|
||||
+ gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||
+ gin::ArrayBufferAllocator::SharedInstance());
|
||||
+ g_isolate_holder =
|
||||
+ new gin::IsolateHolder(gin::IsolateHolder::kSingleThread);
|
||||
+ g_isolate_holder->isolate()->Enter();
|
||||
+}
|
||||
+
|
||||
+void TearDownV8() {
|
||||
+ g_isolate_holder->isolate()->Exit();
|
||||
+ delete g_isolate_holder;
|
||||
+ g_isolate_holder = nullptr;
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
bool InitializeSDK() {
|
||||
+ SetUpV8();
|
||||
+
|
||||
FPDF_LIBRARY_CONFIG config;
|
||||
config.version = 2;
|
||||
config.m_pUserFontPaths = nullptr;
|
||||
@@ -470,6 +490,7 @@ bool InitializeSDK() {
|
||||
}
|
||||
|
||||
void ShutdownSDK() {
|
||||
+ TearDownV8();
|
||||
FPDF_DestroyLibrary();
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
diff --git fpdfsdk/src/fpdfview.cpp fpdfsdk/src/fpdfview.cpp
|
||||
index 97da89e..0484d93 100644
|
||||
--- fpdfsdk/src/fpdfview.cpp
|
||||
+++ fpdfsdk/src/fpdfview.cpp
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "../../core/include/fxcodec/fx_codec.h"
|
||||
#include "../../core/include/fxcrt/fx_safe_types.h"
|
||||
+#include "../../fpdfsdk/include/jsapi/fxjs_v8.h"
|
||||
#include "../../public/fpdf_ext.h"
|
||||
#include "../../public/fpdf_progressive.h"
|
||||
#include "../../public/fpdfview.h"
|
||||
@@ -105,6 +106,7 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
|
||||
DLLEXPORT void STDCALL FPDF_DestroyLibrary() {
|
||||
CPDF_ModuleMgr::Destroy();
|
||||
CFX_GEModule::Destroy();
|
||||
+ FXJS_Release();
|
||||
|
||||
delete g_pCodecModule;
|
||||
g_pCodecModule = nullptr;
|
|
@ -1,8 +1,8 @@
|
|||
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
|
||||
index a308f84..bbbe950 100644
|
||||
index 48ba994..039d8fe 100644
|
||||
--- public/common/common_param_traits_macros.h
|
||||
+++ public/common/common_param_traits_macros.h
|
||||
@@ -196,6 +196,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
|
||||
@@ -195,6 +195,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
|
||||
IPC_STRUCT_TRAITS_MEMBER(main_frame_resizes_are_orientation_changes)
|
||||
IPC_STRUCT_TRAITS_MEMBER(initialize_at_minimum_page_scale)
|
||||
IPC_STRUCT_TRAITS_MEMBER(smart_insert_delete_enabled)
|
||||
|
@ -11,7 +11,7 @@ index a308f84..bbbe950 100644
|
|||
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
|
||||
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
|
||||
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
|
||||
index deb82db..2da2957 100644
|
||||
index 6b599c0..d2ff454 100644
|
||||
--- public/common/web_preferences.cc
|
||||
+++ public/common/web_preferences.cc
|
||||
@@ -176,6 +176,7 @@ WebPreferences::WebPreferences()
|
||||
|
@ -21,9 +21,9 @@ index deb82db..2da2957 100644
|
|||
+ base_background_color(0xFFFFFFFF), // Color::white
|
||||
v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
|
||||
slimming_paint_v2_enabled(false),
|
||||
inert_visual_viewport(false),
|
||||
cookie_enabled(true),
|
||||
diff --git public/common/web_preferences.h public/common/web_preferences.h
|
||||
index 75012d1..8da71be 100644
|
||||
index 0378cd7..484342b 100644
|
||||
--- public/common/web_preferences.h
|
||||
+++ public/common/web_preferences.h
|
||||
@@ -173,6 +173,7 @@ struct CONTENT_EXPORT WebPreferences {
|
||||
|
@ -33,12 +33,12 @@ index 75012d1..8da71be 100644
|
|||
+ uint32_t base_background_color;
|
||||
V8CacheOptions v8_cache_options;
|
||||
bool slimming_paint_v2_enabled;
|
||||
bool inert_visual_viewport;
|
||||
|
||||
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
|
||||
index d6d5d6e..82b499e 100644
|
||||
index 3fd5464..4bf3639 100644
|
||||
--- renderer/render_view_impl.cc
|
||||
+++ renderer/render_view_impl.cc
|
||||
@@ -949,6 +949,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
|
||||
@@ -953,6 +953,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
|
||||
settings->setCookieEnabled(prefs.cookie_enabled);
|
||||
settings->setNavigateOnDragDrop(prefs.navigate_on_drag_drop);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git printing/renderer/print_web_view_helper.cc printing/renderer/print_web_view_helper.cc
|
||||
index 27419d6..0a6757b 100644
|
||||
index f2dc502..c0049d0 100644
|
||||
--- printing/renderer/print_web_view_helper.cc
|
||||
+++ printing/renderer/print_web_view_helper.cc
|
||||
@@ -73,6 +73,9 @@ const double kMinDpi = 1.0;
|
||||
@@ -74,6 +74,9 @@ const double kMinDpi = 1.0;
|
||||
|
||||
#if defined(ENABLE_PRINT_PREVIEW)
|
||||
bool g_is_preview_enabled = true;
|
||||
|
@ -12,7 +12,7 @@ index 27419d6..0a6757b 100644
|
|||
|
||||
const char kPageLoadScriptFormat[] =
|
||||
"document.open(); document.write(%s); document.close();";
|
||||
@@ -87,9 +90,6 @@ void ExecuteScript(blink::WebFrame* frame,
|
||||
@@ -88,9 +91,6 @@ void ExecuteScript(blink::WebFrame* frame,
|
||||
std::string script = base::StringPrintf(script_format, json.c_str());
|
||||
frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ index 27419d6..0a6757b 100644
|
|||
|
||||
int GetDPI(const PrintMsg_Print_Params* print_params) {
|
||||
#if defined(OS_MACOSX)
|
||||
@@ -480,7 +480,6 @@ blink::WebView* FrameReference::view() {
|
||||
@@ -481,7 +481,6 @@ blink::WebView* FrameReference::view() {
|
||||
return view_;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ index 27419d6..0a6757b 100644
|
|||
// static - Not anonymous so that platform implementations can use it.
|
||||
void PrintWebViewHelper::PrintHeaderAndFooter(
|
||||
blink::WebCanvas* canvas,
|
||||
@@ -536,7 +535,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
|
||||
@@ -537,7 +536,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
|
||||
web_view->close();
|
||||
frame->close();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ index 27419d6..0a6757b 100644
|
|||
|
||||
// static - Not anonymous so that platform implementations can use it.
|
||||
float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
|
||||
@@ -807,6 +805,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
|
||||
@@ -810,6 +808,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
|
||||
print_for_preview_(false),
|
||||
delegate_(delegate.Pass()),
|
||||
print_node_in_progress_(false),
|
||||
|
@ -46,7 +46,7 @@ index 27419d6..0a6757b 100644
|
|||
is_loading_(false),
|
||||
is_scripted_preview_delayed_(false),
|
||||
ipc_nesting_level_(0),
|
||||
@@ -1246,7 +1245,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
|
||||
@@ -1249,7 +1248,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
|
||||
// that instead.
|
||||
auto plugin = delegate_->GetPdfElement(frame);
|
||||
if (!plugin.isNull()) {
|
||||
|
@ -56,7 +56,7 @@ index 27419d6..0a6757b 100644
|
|||
return;
|
||||
}
|
||||
print_preview_context_.InitWithFrame(frame);
|
||||
@@ -1279,7 +1280,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
|
||||
@@ -1282,7 +1283,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
|
||||
|
||||
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
|
||||
// its |context_menu_node_|.
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
diff --git web_contents.cc web_contents.cc
|
||||
index 887f242..a7cc318 100644
|
||||
index 1b6d8a6..b606a30 100644
|
||||
--- web_contents.cc
|
||||
+++ web_contents.cc
|
||||
@@ -21,7 +21,9 @@ WebContents::CreateParams::CreateParams(BrowserContext* context)
|
||||
initially_hidden(false),
|
||||
guest_delegate(nullptr),
|
||||
context(nullptr),
|
||||
- renderer_initiated_creation(false) {}
|
||||
+ renderer_initiated_creation(false),
|
||||
+ view(nullptr),
|
||||
+ delegate_view(nullptr) {}
|
||||
|
||||
WebContents::CreateParams::CreateParams(
|
||||
BrowserContext* context, SiteInstance* site)
|
||||
@@ -36,7 +38,9 @@ WebContents::CreateParams::CreateParams(
|
||||
@@ -26,7 +26,9 @@ WebContents::CreateParams::CreateParams(BrowserContext* context,
|
||||
initially_hidden(false),
|
||||
guest_delegate(nullptr),
|
||||
context(nullptr),
|
||||
|
@ -25,7 +14,7 @@ index 887f242..a7cc318 100644
|
|||
WebContents::CreateParams::~CreateParams() {
|
||||
}
|
||||
diff --git web_contents.h web_contents.h
|
||||
index 08c5ba9..459fe19 100644
|
||||
index cda6487..6a84ed1 100644
|
||||
--- web_contents.h
|
||||
+++ web_contents.h
|
||||
@@ -52,9 +52,11 @@ class PageState;
|
||||
|
@ -40,7 +29,7 @@ index 08c5ba9..459fe19 100644
|
|||
struct CustomContextMenuContext;
|
||||
struct DropData;
|
||||
struct Manifest;
|
||||
@@ -142,6 +144,10 @@ class WebContents : public PageNavigator,
|
||||
@@ -144,6 +146,10 @@ class WebContents : public PageNavigator,
|
||||
// RenderFrame, have already been created on the renderer side, and
|
||||
// WebContents construction should take this into account.
|
||||
bool renderer_initiated_creation;
|
||||
|
@ -52,10 +41,10 @@ index 08c5ba9..459fe19 100644
|
|||
|
||||
// Creates a new WebContents.
|
||||
diff --git web_contents_delegate.cc web_contents_delegate.cc
|
||||
index b3d2d70..727401c 100644
|
||||
index b39436d..bf257a7 100644
|
||||
--- web_contents_delegate.cc
|
||||
+++ web_contents_delegate.cc
|
||||
@@ -138,7 +138,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
|
||||
@@ -139,7 +139,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
@ -67,7 +56,7 @@ index b3d2d70..727401c 100644
|
|||
}
|
||||
|
||||
diff --git web_contents_delegate.h web_contents_delegate.h
|
||||
index 76dfd36..f3bec13 100644
|
||||
index 40a4904..e857dee 100644
|
||||
--- web_contents_delegate.h
|
||||
+++ web_contents_delegate.h
|
||||
@@ -39,9 +39,11 @@ class DownloadItem;
|
||||
|
@ -82,7 +71,7 @@ index 76dfd36..f3bec13 100644
|
|||
struct ColorSuggestion;
|
||||
struct ContextMenuParams;
|
||||
struct DropData;
|
||||
@@ -299,7 +301,9 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
@@ -296,7 +298,9 @@ class CONTENT_EXPORT WebContentsDelegate {
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
|
||||
index 8db1f59..41157952 100644
|
||||
index fb89516..6edca6e 100644
|
||||
--- render_widget_host_view_mac.mm
|
||||
+++ render_widget_host_view_mac.mm
|
||||
@@ -590,9 +590,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
|
||||
@@ -529,9 +529,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
|
||||
// Paint this view host with |background_color_| when there is no content
|
||||
// ready to draw.
|
||||
background_layer_.reset([[CALayer alloc] init]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git os_exchange_data_provider_aurax11.cc os_exchange_data_provider_aurax11.cc
|
||||
index 73ec4bf..9023835 100644
|
||||
index e2bba47..ea698fa3 100644
|
||||
--- os_exchange_data_provider_aurax11.cc
|
||||
+++ os_exchange_data_provider_aurax11.cc
|
||||
@@ -159,7 +159,8 @@ void OSExchangeDataProviderAuraX11::SetURL(const GURL& url,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git web_dialog_view.cc web_dialog_view.cc
|
||||
index 4b5e8b2..1501d0b 100644
|
||||
index c5a2b03..0594c4a 100644
|
||||
--- web_dialog_view.cc
|
||||
+++ web_dialog_view.cc
|
||||
@@ -340,7 +340,9 @@ bool WebDialogView::ShouldCreateWebContents(
|
||||
@@ -341,7 +341,9 @@ bool WebDialogView::ShouldCreateWebContents(
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
@ -14,10 +14,10 @@ index 4b5e8b2..1501d0b 100644
|
|||
return delegate_->HandleShouldCreateWebContents();
|
||||
return true;
|
||||
diff --git web_dialog_view.h web_dialog_view.h
|
||||
index dc6598d..ce2616c 100644
|
||||
index d897dbf..92bb481 100644
|
||||
--- web_dialog_view.h
|
||||
+++ web_dialog_view.h
|
||||
@@ -119,7 +119,9 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView,
|
||||
@@ -120,7 +120,9 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
index c7aac43..ae08073 100644
|
||||
index bbb79c9..bf9a924 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
||||
@@ -758,6 +758,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
|
||||
|
@ -40,7 +40,7 @@ index 1b40705..52599e5 100644
|
|||
return renderer_frame_number_;
|
||||
}
|
||||
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
|
||||
index 2fbfb1e..33aa009 100644
|
||||
index bf3b8e1..351c601 100644
|
||||
--- content/browser/renderer_host/render_widget_host_view_base.h
|
||||
+++ content/browser/renderer_host/render_widget_host_view_base.h
|
||||
@@ -78,6 +78,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
|
@ -51,7 +51,7 @@ index 2fbfb1e..33aa009 100644
|
|||
|
||||
// IPC::Listener implementation:
|
||||
bool OnMessageReceived(const IPC::Message& msg) override;
|
||||
@@ -416,6 +417,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
@@ -414,6 +415,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
|
||||
// renderer.
|
||||
bool pinch_zoom_enabled_;
|
||||
|
||||
|
@ -91,7 +91,7 @@ index a8e088c..838b6a0 100644
|
|||
return host ? host->GetAcceleratedWidget() : NULL;
|
||||
}
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
index 270bd54..53d979b 100644
|
||||
index 48368f9..6a566ba 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
|
||||
@@ -85,6 +85,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
|
||||
|
@ -150,7 +150,7 @@ index 363c019..97ada1d 100644
|
|||
// a reference.
|
||||
corewm::TooltipWin* tooltip_;
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
index ed0cb1d..d4a2221 100644
|
||||
index 298c92b..393a5dc 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
|
||||
@@ -165,6 +165,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
|
@ -161,17 +161,17 @@ index ed0cb1d..d4a2221 100644
|
|||
drag_drop_client_(NULL),
|
||||
native_widget_delegate_(native_widget_delegate),
|
||||
desktop_native_widget_aura_(desktop_native_widget_aura),
|
||||
@@ -172,7 +173,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
window_parent_(NULL),
|
||||
@@ -173,7 +174,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
|
||||
custom_window_shape_(false),
|
||||
urgency_hint_set_(false),
|
||||
activatable_(true),
|
||||
- close_widget_factory_(this) {
|
||||
+ close_widget_factory_(this),
|
||||
+ xwindow_destroyed_(false) {
|
||||
}
|
||||
|
||||
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
|
||||
@@ -382,7 +384,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
@@ -384,7 +386,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
|
||||
// Actually free our native resources.
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
|
@ -181,7 +181,7 @@ index ed0cb1d..d4a2221 100644
|
|||
xwindow_ = None;
|
||||
|
||||
desktop_native_widget_aura_->OnHostClosed();
|
||||
@@ -526,6 +529,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
@@ -533,6 +536,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
|
||||
|
@ -190,7 +190,7 @@ index ed0cb1d..d4a2221 100644
|
|||
return ToDIPRect(bounds_in_pixels_);
|
||||
}
|
||||
|
||||
@@ -963,6 +968,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
||||
@@ -970,6 +975,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
|
||||
}
|
||||
|
||||
gfx::Rect DesktopWindowTreeHostX11::GetBounds() const {
|
||||
|
@ -199,7 +199,7 @@ index ed0cb1d..d4a2221 100644
|
|||
return bounds_in_pixels_;
|
||||
}
|
||||
|
||||
@@ -1020,6 +1027,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
||||
@@ -1027,6 +1034,8 @@ void DesktopWindowTreeHostX11::SetBounds(
|
||||
}
|
||||
|
||||
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
|
||||
|
@ -208,7 +208,7 @@ index ed0cb1d..d4a2221 100644
|
|||
return bounds_in_pixels_.origin();
|
||||
}
|
||||
|
||||
@@ -1133,9 +1142,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
||||
@@ -1140,9 +1149,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ index ed0cb1d..d4a2221 100644
|
|||
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
|
||||
bounds_in_pixels_.height(),
|
||||
0, // border width
|
||||
@@ -1789,6 +1804,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
||||
@@ -1797,6 +1812,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ index ed0cb1d..d4a2221 100644
|
|||
if (xev->xfocus.mode != NotifyGrab) {
|
||||
ReleaseCapture();
|
||||
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
index 73e9e3e6..8c2f0f7 100644
|
||||
index 09b5993..db1b2bc 100644
|
||||
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
|
||||
@@ -85,6 +85,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
|
@ -274,7 +274,7 @@ index 73e9e3e6..8c2f0f7 100644
|
|||
DesktopDragDropClientAuraX11* drag_drop_client_;
|
||||
|
||||
scoped_ptr<ui::EventHandler> x11_non_client_event_filter_;
|
||||
@@ -351,6 +364,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
@@ -353,6 +366,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
|
||||
|
||||
base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
|
||||
|
||||
|
@ -346,10 +346,10 @@ index 5ab84f9..c4095fa 100644
|
|||
x_active_window_ = None;
|
||||
}
|
||||
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
|
||||
index 154d107..cf276b1 100644
|
||||
index 6c0168d..fbcfbfc 100644
|
||||
--- ui/views/widget/widget.cc
|
||||
+++ ui/views/widget/widget.cc
|
||||
@@ -119,6 +119,7 @@ Widget::InitParams::InitParams()
|
||||
@@ -124,6 +124,7 @@ Widget::InitParams::InitParams()
|
||||
use_system_default_icon(false),
|
||||
show_state(ui::SHOW_STATE_DEFAULT),
|
||||
parent(NULL),
|
||||
|
@ -357,7 +357,7 @@ index 154d107..cf276b1 100644
|
|||
native_widget(NULL),
|
||||
desktop_window_tree_host(NULL),
|
||||
layer_type(ui::LAYER_TEXTURED),
|
||||
@@ -142,6 +143,7 @@ Widget::InitParams::InitParams(Type type)
|
||||
@@ -148,6 +149,7 @@ Widget::InitParams::InitParams(Type type)
|
||||
use_system_default_icon(false),
|
||||
show_state(ui::SHOW_STATE_DEFAULT),
|
||||
parent(NULL),
|
||||
|
@ -365,7 +365,7 @@ index 154d107..cf276b1 100644
|
|||
native_widget(NULL),
|
||||
desktop_window_tree_host(NULL),
|
||||
layer_type(ui::LAYER_TEXTURED),
|
||||
@@ -316,7 +318,7 @@ void Widget::Init(const InitParams& in_params) {
|
||||
@@ -323,7 +325,7 @@ void Widget::Init(const InitParams& in_params) {
|
||||
InitParams params = in_params;
|
||||
|
||||
params.child |= (params.type == InitParams::TYPE_CONTROL);
|
||||
|
@ -374,7 +374,7 @@ index 154d107..cf276b1 100644
|
|||
|
||||
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
|
||||
params.type != views::Widget::InitParams::TYPE_WINDOW &&
|
||||
@@ -379,7 +381,12 @@ void Widget::Init(const InitParams& in_params) {
|
||||
@@ -386,7 +388,12 @@ void Widget::Init(const InitParams& in_params) {
|
||||
Minimize();
|
||||
} else if (params.delegate) {
|
||||
SetContentsView(params.delegate->GetContentsView());
|
||||
|
@ -389,7 +389,7 @@ index 154d107..cf276b1 100644
|
|||
// This must come after SetContentsView() or it might not be able to find
|
||||
// the correct NativeTheme (on Linux). See http://crbug.com/384492
|
||||
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
|
||||
index 1342625..7fbc24c 100644
|
||||
index 301c0af..de63108 100644
|
||||
--- ui/views/widget/widget.h
|
||||
+++ ui/views/widget/widget.h
|
||||
@@ -232,6 +232,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
|
||||
index 5577228..74ccf53 100644
|
||||
index 499991c..b5d6d32 100644
|
||||
--- Source/web/ChromeClientImpl.cpp
|
||||
+++ Source/web/ChromeClientImpl.cpp
|
||||
@@ -814,7 +814,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
|
||||
@@ -809,7 +809,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
|
||||
PassRefPtrWillBeRawPtr<PopupMenu> ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select)
|
||||
{
|
||||
notifyPopupOpeningObservers();
|
||||
|
@ -12,10 +12,10 @@ index 5577228..74ccf53 100644
|
|||
|
||||
ASSERT(RuntimeEnabledFeatures::pagePopupEnabled());
|
||||
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
|
||||
index b708684..769c127 100644
|
||||
index c97a89c..6d2fb40 100644
|
||||
--- Source/web/WebViewImpl.cpp
|
||||
+++ Source/web/WebViewImpl.cpp
|
||||
@@ -421,6 +421,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
||||
@@ -418,6 +418,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
||||
, m_enableFakePageScaleAnimationForTesting(false)
|
||||
, m_fakePageScaleAnimationPageScaleFactor(0)
|
||||
, m_fakePageScaleAnimationUseAnchor(false)
|
||||
|
@ -40,10 +40,10 @@ index b708684..769c127 100644
|
|||
|
||||
void WebViewImpl::startDragging(LocalFrame* frame,
|
||||
diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h
|
||||
index a1f3e54..24f60a9 100644
|
||||
index 09b718d..a1bc2ffc 100644
|
||||
--- Source/web/WebViewImpl.h
|
||||
+++ Source/web/WebViewImpl.h
|
||||
@@ -393,7 +393,8 @@ public:
|
||||
@@ -389,7 +389,8 @@ public:
|
||||
|
||||
// Returns true if popup menus should be rendered by the browser, false if
|
||||
// they should be rendered by WebKit (which is the default).
|
||||
|
@ -53,7 +53,7 @@ index a1f3e54..24f60a9 100644
|
|||
|
||||
bool shouldAutoResize() const
|
||||
{
|
||||
@@ -671,6 +672,8 @@ private:
|
||||
@@ -670,6 +671,8 @@ private:
|
||||
float m_fakePageScaleAnimationPageScaleFactor;
|
||||
bool m_fakePageScaleAnimationUseAnchor;
|
||||
|
||||
|
@ -63,7 +63,7 @@ index a1f3e54..24f60a9 100644
|
|||
|
||||
bool m_ignoreInputEvents;
|
||||
diff --git public/web/WebView.h public/web/WebView.h
|
||||
index 1bce1b2..3ea51c1 100644
|
||||
index 83d8c13..350bca4 100644
|
||||
--- public/web/WebView.h
|
||||
+++ public/web/WebView.h
|
||||
@@ -400,6 +400,7 @@ public:
|
||||
|
|
|
@ -542,6 +542,11 @@ TEST(CookieTest, DomainCookieOnDisk) {
|
|||
EXPECT_TRUE(manager.get());
|
||||
|
||||
TestDomainCookie(manager, event);
|
||||
|
||||
// The backing store will be closed on the DB thread after the CookieManager
|
||||
// is destroyed.
|
||||
manager = NULL;
|
||||
WaitForDBThread();
|
||||
}
|
||||
|
||||
// Test creation of a host cookie.
|
||||
|
@ -585,6 +590,11 @@ TEST(CookieTest, HostCookieOnDisk) {
|
|||
EXPECT_TRUE(manager.get());
|
||||
|
||||
TestHostCookie(manager, event);
|
||||
|
||||
// The backing store will be closed on the DB thread after the CookieManager
|
||||
// is destroyed.
|
||||
manager = NULL;
|
||||
WaitForDBThread();
|
||||
}
|
||||
|
||||
// Test creation of multiple cookies.
|
||||
|
@ -628,6 +638,11 @@ TEST(CookieTest, MultipleCookiesOnDisk) {
|
|||
EXPECT_TRUE(manager.get());
|
||||
|
||||
TestMultipleCookies(manager, event);
|
||||
|
||||
// The backing store will be closed on the DB thread after the CookieManager
|
||||
// is destroyed.
|
||||
manager = NULL;
|
||||
WaitForDBThread();
|
||||
}
|
||||
|
||||
TEST(CookieTest, AllCookiesGlobal) {
|
||||
|
@ -668,6 +683,11 @@ TEST(CookieTest, AllCookiesOnDisk) {
|
|||
EXPECT_TRUE(manager.get());
|
||||
|
||||
TestAllCookies(manager, event);
|
||||
|
||||
// The backing store will be closed on the DB thread after the CookieManager
|
||||
// is destroyed.
|
||||
manager = NULL;
|
||||
WaitForDBThread();
|
||||
}
|
||||
|
||||
TEST(CookieTest, ChangeDirectoryGlobal) {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// Include this first to avoid type conflicts with CEF headers.
|
||||
#include "tests/unittests/chromium_includes.h"
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/wrapper/cef_closure_task.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "tests/unittests/test_handler.h"
|
||||
|
||||
|
@ -29,7 +31,9 @@ const char kTitleStr3[] = "Title 3";
|
|||
class TitleTestHandler : public TestHandler {
|
||||
public:
|
||||
TitleTestHandler()
|
||||
: step_(0) {}
|
||||
: step_(0),
|
||||
got_title_change_(false),
|
||||
got_loading_state_change_(false) {}
|
||||
|
||||
void RunTest() override {
|
||||
// Add the resources that we will navigate to/from.
|
||||
|
@ -52,32 +56,57 @@ class TitleTestHandler : public TestHandler {
|
|||
|
||||
void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) override {
|
||||
// Ignore the 2nd OnTitleChange call which arrives after navigation
|
||||
// completion.
|
||||
if (got_title_change_)
|
||||
return;
|
||||
|
||||
std::string title_str = title;
|
||||
if (step_ == 0 || step_ == 2) {
|
||||
EXPECT_STREQ(kTitleStr1, title_str.c_str());
|
||||
} else if (step_ == 1 || step_ == 3) {
|
||||
EXPECT_STREQ(kTitleStr2, title_str.c_str());
|
||||
} else if (step_ == 4) {
|
||||
// Ignore the unexpected notification of the page URL.
|
||||
// Related bug: http://crbug.com/331351
|
||||
if (title_str == &kTitleUrl2[7])
|
||||
return;
|
||||
|
||||
EXPECT_STREQ(kTitleStr3, title_str.c_str());
|
||||
}
|
||||
|
||||
got_title_[step_].yes();
|
||||
|
||||
if (step_ == 4)
|
||||
if (step_ == 4) {
|
||||
DestroyTest();
|
||||
} else {
|
||||
got_title_change_ = true;
|
||||
NextIfReady(browser);
|
||||
}
|
||||
}
|
||||
|
||||
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) override {
|
||||
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override {
|
||||
if (isLoading)
|
||||
return;
|
||||
|
||||
// Call NextIfReady asynchronously because an additional call to
|
||||
// OnTitleChange will be triggered later in the current call stack due to
|
||||
// navigation completion and we want that call to arrive before execution of
|
||||
// NextIfReady.
|
||||
got_loading_state_change_ = true;
|
||||
CefPostTask(TID_UI,
|
||||
base::Bind(&TitleTestHandler::NextIfReady, this, browser));
|
||||
}
|
||||
|
||||
private:
|
||||
void NextIfReady(CefRefPtr<CefBrowser> browser) {
|
||||
if (!got_title_change_ || !got_loading_state_change_)
|
||||
return;
|
||||
|
||||
got_title_change_ = false;
|
||||
got_loading_state_change_ = false;
|
||||
|
||||
switch (step_++) {
|
||||
case 0:
|
||||
frame->LoadURL(kTitleUrl2);
|
||||
browser->GetMainFrame()->LoadURL(kTitleUrl2);
|
||||
break;
|
||||
case 1:
|
||||
browser->GoBack();
|
||||
|
@ -86,14 +115,13 @@ class TitleTestHandler : public TestHandler {
|
|||
browser->GoForward();
|
||||
break;
|
||||
case 3:
|
||||
frame->ExecuteJavaScript("setTitle()", kTitleUrl2, 0);
|
||||
browser->GetMainFrame()->ExecuteJavaScript("setTitle()", kTitleUrl2, 0);
|
||||
break;
|
||||
default:
|
||||
EXPECT_TRUE(false); // Not reached.
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void DestroyTest() override {
|
||||
for (int i = 0; i < 5; ++i)
|
||||
EXPECT_TRUE(got_title_[i]) << "step " << i;
|
||||
|
@ -103,6 +131,9 @@ class TitleTestHandler : public TestHandler {
|
|||
|
||||
int step_;
|
||||
|
||||
bool got_title_change_;
|
||||
bool got_loading_state_change_;
|
||||
|
||||
TrackCallback got_title_[5];
|
||||
|
||||
IMPLEMENT_REFCOUNTING(TitleTestHandler);
|
||||
|
|
|
@ -1823,7 +1823,8 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
|
|||
V_EXPECT_TRUE(frame1b->GetIdentifier() == frame1id);
|
||||
V_EXPECT_TRUE(frame2b->GetIdentifier() == frame2id);
|
||||
|
||||
V_EXPECT_TRUE(browser->GetFrameCount() == 3U);
|
||||
size_t frame_count = browser->GetFrameCount();
|
||||
V_EXPECT_TRUE(frame_count == 3U) << "actual " << frame_count;
|
||||
|
||||
// Verify the GetFrameNames result.
|
||||
std::vector<CefString> names;
|
||||
|
@ -1958,6 +1959,8 @@ class FrameNavExpectationsBrowserTestNestedIframes :
|
|||
} else if (frame_number == 2) {
|
||||
V_EXPECT_TRUE(got_load_start_[0]);
|
||||
V_EXPECT_TRUE(got_load_start_[1]);
|
||||
} else {
|
||||
V_EXPECT_TRUE(false); // Not reached.
|
||||
}
|
||||
|
||||
got_load_start_[frame_number].yes();
|
||||
|
@ -1984,6 +1987,8 @@ class FrameNavExpectationsBrowserTestNestedIframes :
|
|||
} else if (frame_number == 2) {
|
||||
V_EXPECT_FALSE(got_load_end_[0]);
|
||||
V_EXPECT_FALSE(got_load_end_[1]);
|
||||
} else {
|
||||
V_EXPECT_TRUE(false); // Not reached.
|
||||
}
|
||||
|
||||
V_EXPECT_TRUE(VerifyBrowserIframe(browser, frame, origin_, frame_number)) <<
|
||||
|
|
|
@ -110,13 +110,11 @@ class GeolocationTestHandler : public TestHandler {
|
|||
|
||||
void OnCancelGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id) override {
|
||||
got_cancelgeolocationpermission_.yes();
|
||||
|
||||
EXPECT_TRUE(CefCurrentlyOn(TID_UI));
|
||||
|
||||
EXPECT_STREQ(kTestOrigin, requesting_url.ToString().c_str());
|
||||
EXPECT_EQ(request_id, request_id_);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,15 @@ class MRRenderDelegate : public ClientAppRenderer::Delegate {
|
|||
CefRefPtr<CefBrowser> browser = context->GetBrowser();
|
||||
CefRefPtr<CefFrame> frame = context->GetFrame();
|
||||
const int64 frame_id = frame->GetIdentifier();
|
||||
const bool is_main_frame = frame->IsMain();
|
||||
|
||||
CefRefPtr<CefProcessMessage> message =
|
||||
CefProcessMessage::Create(kDoneMessageName);
|
||||
CefRefPtr<CefListValue> args = message->GetArgumentList();
|
||||
args->SetInt(0, CefInt64GetLow(frame_id));
|
||||
args->SetInt(1, CefInt64GetHigh(frame_id));
|
||||
args->SetString(2, msg);
|
||||
args->SetBool(2, is_main_frame);
|
||||
args->SetString(3, msg);
|
||||
EXPECT_TRUE(browser->SendProcessMessage(PID_BROWSER, message));
|
||||
return true;
|
||||
} else {
|
||||
|
@ -251,16 +253,22 @@ class MRTestHandler : public TestHandler {
|
|||
const std::string& message_name = message->GetName();
|
||||
if (message_name == kDoneMessageName) {
|
||||
CefRefPtr<CefListValue> args = message->GetArgumentList();
|
||||
EXPECT_EQ(3U, args->GetSize());
|
||||
EXPECT_EQ(4U, args->GetSize());
|
||||
EXPECT_EQ(VTYPE_INT, args->GetType(0));
|
||||
EXPECT_EQ(VTYPE_INT, args->GetType(1));
|
||||
EXPECT_EQ(VTYPE_STRING, args->GetType(2));
|
||||
EXPECT_EQ(VTYPE_BOOL, args->GetType(2));
|
||||
EXPECT_EQ(VTYPE_STRING, args->GetType(3));
|
||||
|
||||
const int64 frame_id = CefInt64Set(args->GetInt(0), args->GetInt(1));
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrame(frame_id);
|
||||
const bool is_main_frame = args->GetBool(2);
|
||||
CefRefPtr<CefFrame> frame;
|
||||
if (is_main_frame)
|
||||
frame = browser->GetMainFrame();
|
||||
else
|
||||
frame = browser->GetFrame(frame_id);
|
||||
EXPECT_TRUE(frame.get());
|
||||
|
||||
OnNotify(browser, frame, args->GetString(2));
|
||||
OnNotify(browser, frame, args->GetString(3));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1268,6 +1276,7 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
|
|||
|
||||
query.browser_id = browser->GetIdentifier();
|
||||
query.frame_id = frame->GetIdentifier();
|
||||
query.is_main_frame = frame->IsMain();
|
||||
|
||||
if (query.type == SUCCESS) {
|
||||
// Send the single success response.
|
||||
|
@ -1317,7 +1326,12 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
|
|||
if (query.query_id == query_id) {
|
||||
// Verify that browser and frame are the same.
|
||||
EXPECT_EQ(query.browser_id, browser->GetIdentifier()) << i;
|
||||
EXPECT_EQ(query.frame_id, frame->GetIdentifier()) << i;
|
||||
if (query.is_main_frame) {
|
||||
EXPECT_TRUE(frame->IsMain()) << i;
|
||||
} else {
|
||||
EXPECT_FALSE(frame->IsMain()) << i;
|
||||
EXPECT_EQ(query.frame_id, frame->GetIdentifier()) << i;
|
||||
}
|
||||
|
||||
// Verify a successful/expected result.
|
||||
EXPECT_TRUE(WillCancel(query.type)) << i;
|
||||
|
@ -1414,6 +1428,7 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
|
|||
: type(test_type),
|
||||
browser_id(0),
|
||||
frame_id(0),
|
||||
is_main_frame(false),
|
||||
query_id(0) {}
|
||||
|
||||
TestType type;
|
||||
|
@ -1421,6 +1436,7 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
|
|||
// Set in OnQuery and verified in OnNotify or OnQueryCanceled.
|
||||
int browser_id;
|
||||
int64 frame_id;
|
||||
bool is_main_frame;
|
||||
|
||||
// Used when a query is canceled.
|
||||
int64 query_id;
|
||||
|
|
|
@ -347,6 +347,7 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
HistoryNavTestHandler()
|
||||
: nav_(0),
|
||||
load_end_confirmation_(false),
|
||||
load_state_change_loaded_confirmation_(false),
|
||||
renderer_confirmation_(false) {}
|
||||
|
||||
void RunTest() override {
|
||||
|
@ -401,8 +402,10 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
}
|
||||
|
||||
void RunNextNavIfReady(CefRefPtr<CefBrowser> browser) {
|
||||
if (load_end_confirmation_ && renderer_confirmation_) {
|
||||
if (load_end_confirmation_ && load_state_change_loaded_confirmation_ &&
|
||||
renderer_confirmation_) {
|
||||
load_end_confirmation_ = false;
|
||||
load_state_change_loaded_confirmation_ = false;
|
||||
renderer_confirmation_ = false;
|
||||
nav_++;
|
||||
RunNav(browser);
|
||||
|
@ -470,6 +473,9 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override {
|
||||
if (isLoading)
|
||||
return;
|
||||
|
||||
const NavListItem& item = kHNavList[nav_];
|
||||
|
||||
got_loading_state_change_[nav_].yes();
|
||||
|
@ -478,6 +484,9 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
got_correct_can_go_back_[nav_].yes();
|
||||
if (item.can_go_forward == canGoForward)
|
||||
got_correct_can_go_forward_[nav_].yes();
|
||||
|
||||
load_state_change_loaded_confirmation_ = true;
|
||||
RunNextNavIfReady(browser);
|
||||
}
|
||||
|
||||
void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -516,11 +525,6 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
if (url1 == item.target && url2 == item.target)
|
||||
got_correct_load_end_url_[nav_].yes();
|
||||
|
||||
if (item.can_go_back == browser->CanGoBack())
|
||||
got_correct_can_go_back2_[nav_].yes();
|
||||
if (item.can_go_forward == browser->CanGoForward())
|
||||
got_correct_can_go_forward2_[nav_].yes();
|
||||
|
||||
load_end_confirmation_ = true;
|
||||
RunNextNavIfReady(browser);
|
||||
}
|
||||
|
@ -549,6 +553,7 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
|
||||
int nav_;
|
||||
bool load_end_confirmation_;
|
||||
bool load_state_change_loaded_confirmation_;
|
||||
bool renderer_confirmation_;
|
||||
|
||||
TrackCallback got_before_browse_[NAV_LIST_SIZE()];
|
||||
|
@ -563,8 +568,6 @@ class HistoryNavTestHandler : public TestHandler {
|
|||
TrackCallback got_load_end_[NAV_LIST_SIZE()];
|
||||
TrackCallback got_correct_history_[NAV_LIST_SIZE()];
|
||||
TrackCallback got_correct_load_end_url_[NAV_LIST_SIZE()];
|
||||
TrackCallback got_correct_can_go_back2_[NAV_LIST_SIZE()];
|
||||
TrackCallback got_correct_can_go_forward2_[NAV_LIST_SIZE()];
|
||||
|
||||
IMPLEMENT_REFCOUNTING(HistoryNavTestHandler);
|
||||
};
|
||||
|
@ -597,8 +600,6 @@ TEST(NavigationTest, History) {
|
|||
ASSERT_TRUE(handler->got_load_end_[i]) << "i = " << i;
|
||||
ASSERT_TRUE(handler->got_correct_history_[i]) << "i = " << i;
|
||||
ASSERT_TRUE(handler->got_correct_load_end_url_[i]) << "i = " << i;
|
||||
ASSERT_TRUE(handler->got_correct_can_go_back2_[i]) << "i = " << i;
|
||||
ASSERT_TRUE(handler->got_correct_can_go_forward2_[i]) << "i = " << i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,7 +932,7 @@ class OrderNavLoadState {
|
|||
|
||||
got_loading_state_start_.yes();
|
||||
} else {
|
||||
EXPECT_TRUE(Verify(true, false, true, false));
|
||||
EXPECT_TRUE(Verify(true, false, true, true));
|
||||
|
||||
got_loading_state_end_.yes();
|
||||
}
|
||||
|
@ -947,7 +948,7 @@ class OrderNavLoadState {
|
|||
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) {
|
||||
EXPECT_TRUE(Verify(true, true, true, false));
|
||||
EXPECT_TRUE(Verify(true, false, true, false));
|
||||
|
||||
got_load_end_.yes();
|
||||
}
|
||||
|
|
|
@ -35,10 +35,6 @@ class PluginBrowserTest : public client::ClientAppBrowser::Delegate {
|
|||
void OnBeforeCommandLineProcessing(
|
||||
CefRefPtr<client::ClientAppBrowser> app,
|
||||
CefRefPtr<CefCommandLine> command_line) override {
|
||||
// Enables testing of the plugin placeholder.
|
||||
// See LoadablePluginPlaceholder::DidFinishLoadingCallback.
|
||||
command_line->AppendSwitch("enable-plugin-placeholder-testing");
|
||||
|
||||
// Allow all plugin loading by default.
|
||||
command_line->AppendSwitchWithValue("plugin-policy", "allow");
|
||||
}
|
||||
|
@ -50,6 +46,9 @@ class PluginBrowserTest : public client::ClientAppBrowser::Delegate {
|
|||
const char kPdfHtmlUrl[] = "http://tests/pdf.html";
|
||||
const char kPdfDirectUrl[] = "http://tests/pdf.pdf";
|
||||
|
||||
// Delay waiting for the plugin placeholder to load.
|
||||
const int64 kPlaceholderLoadDelayMs = 1000;
|
||||
|
||||
// Delay waiting for iframe tests to load the PDF file.
|
||||
#if defined(OS_LINUX)
|
||||
const int64 kPdfLoadDelayMs = 7000;
|
||||
|
@ -246,29 +245,12 @@ class PluginTestHandler : public RoutingTestHandler,
|
|||
frame->ExecuteJavaScript(code, frame->GetURL(), 0);
|
||||
}
|
||||
|
||||
void WaitForPlaceholderLoad(CefRefPtr<CefFrame> frame) const {
|
||||
void WaitForPlaceholderLoad(CefRefPtr<CefFrame> frame) {
|
||||
// Waits for the placeholder to load.
|
||||
// See LoadablePluginPlaceholder::DidFinishLoadingCallback and
|
||||
// chrome/browser/plugins/plugin_power_saver_browsertest.cc.
|
||||
const std::string& code =
|
||||
"var plugin = " + GetPluginNode() +";"
|
||||
"if (plugin === undefined ||"
|
||||
" (plugin.nodeName !== 'OBJECT' && plugin.nodeName !== 'EMBED')) {"
|
||||
" window.testQuery({request:'placeholder_error'});"
|
||||
"} else {"
|
||||
" function handleEvent(event) {"
|
||||
" if (event.data === 'placeholderLoaded') {"
|
||||
" window.testQuery({request:'placeholder_ready'});"
|
||||
" plugin.removeEventListener('message', handleEvent);"
|
||||
" }"
|
||||
" }"
|
||||
" plugin.addEventListener('message', handleEvent);"
|
||||
" if (plugin.hasAttribute('placeholderLoaded')) {"
|
||||
" window.testQuery({request:'placeholder_ready'});"
|
||||
" plugin.removeEventListener('message', handleEvent);"
|
||||
" }"
|
||||
"}";
|
||||
frame->ExecuteJavaScript(code, frame->GetURL(), 0);
|
||||
CefPostDelayedTask(TID_UI,
|
||||
base::Bind(&PluginTestHandler::TriggerContextMenu, this,
|
||||
frame->GetBrowser()),
|
||||
kPlaceholderLoadDelayMs);
|
||||
}
|
||||
|
||||
void WaitForPlaceholderHide(CefRefPtr<CefFrame> frame) const {
|
||||
|
@ -430,15 +412,7 @@ class PluginTestHandler : public RoutingTestHandler,
|
|||
// Wait for the first PDF file to load.
|
||||
WaitForPluginLoad(frame);
|
||||
}
|
||||
} else if (request == "placeholder_ready") {
|
||||
EXPECT_FALSE(got_placeholder_ready_);
|
||||
got_placeholder_ready_.yes();
|
||||
|
||||
// The plugin placeholder has loaded.
|
||||
CefPostTask(TID_UI,
|
||||
base::Bind(&PluginTestHandler::TriggerContextMenu, this, browser));
|
||||
} else if (request == "placeholder_hidden") {
|
||||
EXPECT_TRUE(got_placeholder_ready_);
|
||||
EXPECT_FALSE(got_placeholder_hidden_);
|
||||
got_placeholder_hidden_.yes();
|
||||
|
||||
|
@ -536,11 +510,6 @@ class PluginTestHandler : public RoutingTestHandler,
|
|||
context_handler_ = NULL;
|
||||
}
|
||||
|
||||
if (HasBlock() || HasDisable())
|
||||
EXPECT_TRUE(got_placeholder_ready_);
|
||||
else
|
||||
EXPECT_FALSE(got_placeholder_ready_);
|
||||
|
||||
if (HasContextHide()) {
|
||||
EXPECT_TRUE(got_placeholder_hidden_);
|
||||
EXPECT_FALSE(got_plugin_ready_);
|
||||
|
@ -614,7 +583,6 @@ class PluginTestHandler : public RoutingTestHandler,
|
|||
TrackCallback got_on_load_end_pdf2_;
|
||||
TrackCallback got_pdf_plugin_found_;
|
||||
TrackCallback got_pdf_plugin_missing_;
|
||||
TrackCallback got_placeholder_ready_;
|
||||
TrackCallback got_placeholder_hidden_;
|
||||
TrackCallback got_plugin_ready_;
|
||||
TrackCallback got_run_context_menu_;
|
||||
|
|
|
@ -317,6 +317,7 @@ void WaitForThread(CefRefPtr<CefTaskRunner> task_runner);
|
|||
|
||||
#define WaitForIOThread() WaitForThread(TID_IO)
|
||||
#define WaitForUIThread() WaitForThread(TID_UI)
|
||||
#define WaitForDBThread() WaitForThread(TID_DB)
|
||||
|
||||
// Returns true if the currently running test has failed.
|
||||
bool TestFailed();
|
||||
|
|
Loading…
Reference in New Issue