Compare commits

...

34 Commits
3770 ... 2743

Author SHA1 Message Date
Marshall Greenblatt
90ba67d8ea Fix crash when scrolling to the bottom of an iframe with --root-layer-scrolls 2016-08-22 17:13:48 +03:00
Marshall Greenblatt
f5be340d57 cefclient: Allow dragging of fragments and show message when blocking URLs/files (issue #1976) 2016-08-19 14:03:09 +02:00
Marshall Greenblatt
37d988bda8 Windows: Resize offscreen compositor window to match view size (issue #1933) 2016-08-17 17:33:00 +02:00
Marshall Greenblatt
e2f626dcf8 Linux: Flush display after showing window (issue #1946) 2016-08-17 17:01:09 +02:00
Marshall Greenblatt
dad7c0a6af Check that platform_delegate_ is non-NULL 2016-08-15 12:36:31 +03:00
Marshall Greenblatt
7c94121cbb Update to Chromium version 52.0.2743.116 2016-08-05 19:51:38 +03:00
Marshall Greenblatt
61abe4a841 Windows: Add VS2015 Update 3 build support for GYP 2016-08-05 18:22:38 +03:00
Marshall Greenblatt
e29124d62f Fix Widevine CDM download (issue #1950) 2016-07-15 13:14:56 -04:00
Marshall Greenblatt
f1f4e9fbea Update to Chromium version 52.0.2743.75 2016-07-14 16:46:23 -04:00
Marshall Greenblatt
086447f605 Update component updater configurator to match chrome 2016-07-14 12:56:42 -04:00
Marshall Greenblatt
7cf8c6ff5c Move HTTP cache to a subfolder of CefSettings.cache_path (issue #1940) 2016-07-12 15:02:49 -04:00
Marshall Greenblatt
33d0fc3657 Pass transition type to CefLoadHandler::OnLoadStart (issue #1943) 2016-07-12 12:14:46 -04:00
Marshall Greenblatt
6779696971 Mac: Remove duplicate focus change notification 2016-07-11 17:13:25 -04:00
Marshall Greenblatt
558e60afba Fix crash in CefResourceDispatcherHostDelegate::HandleExternalProtocol when destroying a browser during redirect (issue #1941) 2016-07-08 15:31:54 -04:00
Marshall Greenblatt
48b9fd38ab CefBrowserHost::Invalidate should call OnPaint unconditionally (issue #1871) 2016-07-08 13:56:48 -04:00
Marshall Greenblatt
8a351d1d42 Update to Chromium version 52.0.2743.60 2016-07-05 12:56:32 -04:00
Marshall Greenblatt
da5b00c3dd Fix unreferenced variable error 2016-06-21 13:19:37 -04:00
Marshall Greenblatt
51ba965d4e Update to Chromium version 52.0.2743.41 2016-06-17 14:03:35 -04:00
Marshall Greenblatt
1fbc5c4393 Fix crash in CefTaskRunnerImpl::GetTaskRunner when CEF is not initialized (issue #1925) 2016-06-15 14:13:07 -04:00
Marshall Greenblatt
6ee1922b2c Mac: Fix file dialog behavior (issue #1919) 2016-06-15 14:12:58 -04:00
Marshall Greenblatt
1658648fe1 Improve binary distribution CMake macros (issue #1923) 2016-06-14 18:30:34 -04:00
Marshall Greenblatt
ee28b94e1e Linux: Don't add version script in Debug build (issue #1765) 2016-06-14 13:48:20 -04:00
Marshall Greenblatt
daac89badd cefclient: Don't create multiple DevTools windows (issue #1920) 2016-06-10 14:42:13 -04:00
Marshall Greenblatt
a11780730b ShowDevTools should inspect element in existing window (issue #1487) 2016-06-10 13:16:06 -04:00
Marshall Greenblatt
c90cd8da3f Mac: Fix window sharing type (issue #1884) 2016-06-09 16:35:40 -04:00
Marshall Greenblatt
c9d0a7f7a5 Linux: Don't add version script when using ASAN build (issue #1765) 2016-06-07 15:18:43 -04:00
Marshall Greenblatt
f73d23d847 Add Google SafeSearch support (issue #1917) 2016-06-07 15:09:40 -04:00
Marshall Greenblatt
976502eab1 Linux: Include cefsimple instead of cefclient in client distribution (issue #1916) 2016-06-06 18:27:37 -04:00
Marshall Greenblatt
aa727705b8 Windows: Remove wow_helper.exe which is no longer required (issue #1915) 2016-06-06 12:50:15 -04:00
Marshall Greenblatt
b1517ab47d Linux: Add version script to restrict exported symbols (issue #1765) 2016-06-06 12:34:33 -04:00
Marshall Greenblatt
b4e81659a4 Update to Chromium version 52.0.2743.24 2016-06-03 15:43:53 -04:00
Marshall Greenblatt
aca12b004c Linux: Fix warn_unused_result error (issue #1911) 2016-06-03 11:37:00 -04:00
Marshall Greenblatt
a7837aa070 Windows: Set CEF_VCVARS=none when using a custom VS install location 2016-05-28 22:04:31 -04:00
Marshall Greenblatt
4786cb735e Update to Chromium version 52.0.2743.10 2016-05-27 22:00:18 -04:00
66 changed files with 653 additions and 452 deletions

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{ {
'chromium_checkout': '2b3ae3b8090361f8af5a611712fc1a5ab2de53cb', 'chromium_checkout': 'refs/tags/52.0.2743.116',
} }

17
cef.gyp
View File

@@ -968,6 +968,7 @@
'<(DEPTH)/components/components.gyp:data_use_measurement_core', '<(DEPTH)/components/components.gyp:data_use_measurement_core',
'<(DEPTH)/components/components.gyp:devtools_discovery', '<(DEPTH)/components/components.gyp:devtools_discovery',
'<(DEPTH)/components/components.gyp:devtools_http_handler', '<(DEPTH)/components/components.gyp:devtools_http_handler',
'<(DEPTH)/components/components.gyp:google_core_browser',
'<(DEPTH)/components/components.gyp:keyed_service_content', '<(DEPTH)/components/components.gyp:keyed_service_content',
'<(DEPTH)/components/components.gyp:keyed_service_core', '<(DEPTH)/components/components.gyp:keyed_service_core',
'<(DEPTH)/components/components.gyp:navigation_interception', '<(DEPTH)/components/components.gyp:navigation_interception',
@@ -1505,6 +1506,9 @@
# Include sources for permissions support. # Include sources for permissions support.
'<(DEPTH)/chrome/browser/permissions/permission_request_id.h', '<(DEPTH)/chrome/browser/permissions/permission_request_id.h',
'<(DEPTH)/chrome/browser/permissions/permission_request_id.cc', '<(DEPTH)/chrome/browser/permissions/permission_request_id.cc',
# Include sources for SafeSearch support.
'<(DEPTH)/chrome/browser/net/safe_search_util.cc',
'<(DEPTH)/chrome/browser/net/safe_search_util.h',
], ],
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
@@ -2090,6 +2094,19 @@
}, },
}, },
}], }],
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and asan==0 and use_allocator=="none"', {
'link_settings': {
'configurations': {
'Release': {
'ldflags': [
# Only export necessary symbols from libcef.so.
# Don't do this in Debug builds because it causes the resulting application to crash.
'-Wl,--version-script=<!(cd <(DEPTH) && pwd -P)/cef/libcef_dll/libcef.lst',
],
},
},
},
}],
], ],
}], }],
}], # OS!="mac" }], # OS!="mac"

View File

@@ -81,11 +81,15 @@ endmacro()
# Determine the target output directory based on platform and generator. # Determine the target output directory based on platform and generator.
macro(SET_CEF_TARGET_OUT_DIR) macro(SET_CEF_TARGET_OUT_DIR)
if(${CMAKE_GENERATOR} STREQUAL "Ninja") if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
# Ninja does not create a subdirectory named after the configuration. ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") # By default Ninja and Make builds don't create a subdirectory named after
elseif(OS_LINUX) # the configuration.
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
# Output binaries (executables, libraries) to the correct directory.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
else() else()
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>") set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif() endif()
@@ -256,13 +260,13 @@ endif(OS_MACOSX)
if(OS_WINDOWS) if(OS_WINDOWS)
# Add custom manifest files to an executable target. # Add custom manifest files to an executable target.
macro(ADD_WINDOWS_MANIFEST manifest_path target) macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
add_custom_command( add_custom_command(
TARGET ${target} TARGET ${target}
POST_BUILD POST_BUILD
COMMAND "mt.exe" -nologo COMMAND "mt.exe" -nologo
-manifest \"${manifest_path}/${target}.exe.manifest\" \"${manifest_path}/compatibility.manifest\" -manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\"
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.exe"\;\#1 -outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1
COMMENT "Adding manifest..." COMMENT "Adding manifest..."
) )
endmacro() endmacro()

View File

@@ -383,12 +383,6 @@ if(OS_WINDOWS)
natives_blob.bin natives_blob.bin
snapshot_blob.bin snapshot_blob.bin
) )
if(PROJECT_ARCH STREQUAL "x86")
# Only used on 32-bit platforms.
list(APPEND CEF_BINARY_FILES
wow_helper.exe
)
endif()
# List of CEF resource files. # List of CEF resource files.
set(CEF_RESOURCE_FILES set(CEF_RESOURCE_FILES

View File

@@ -448,10 +448,13 @@ typedef struct _cef_browser_host_t {
int clearSelection); int clearSelection);
/// ///
// Open developer tools in its own window. If |inspect_element_at| is non- // Open developer tools (DevTools) in its own browser. The DevTools browser
// NULL the element at the specified (x,y) location will be inspected. The // will remain associated with this browser. If the DevTools browser is
// |windowInfo| parameter will be ignored if this browser is wrapped in a // already open then it will be focused, in which case the |windowInfo|,
// cef_browser_view_t. // |client| and |settings| parameters will be ignored. If |inspect_element_at|
// is non-NULL then the element at the specified (x,y) location will be
// inspected. The |windowInfo| parameter will be ignored if this browser is
// wrapped in a cef_browser_view_t.
/// ///
void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self, void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self,
const struct _cef_window_info_t* windowInfo, const struct _cef_window_info_t* windowInfo,
@@ -460,11 +463,16 @@ typedef struct _cef_browser_host_t {
const cef_point_t* inspect_element_at); const cef_point_t* inspect_element_at);
/// ///
// Explicitly close the developer tools window if one exists for this browser // Explicitly close the associated DevTools browser, if any.
// instance.
/// ///
void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_host_t* self); void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_host_t* self);
///
// Returns true (1) if this browser currently has an associated DevTools
// browser. Must be called on the browser process UI thread.
///
int (CEF_CALLBACK *has_dev_tools)(struct _cef_browser_host_t* self);
/// ///
// Retrieve a snapshot of current navigation entries as values sent to the // Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true (1) only the current // specified visitor. If |current_only| is true (1) only the current

View File

@@ -72,14 +72,17 @@ typedef struct _cef_load_handler_t {
/// ///
// Called when the browser begins loading a frame. The |frame| value will // Called when the browser begins loading a frame. The |frame| value will
// never be NULL -- call the is_main() function to check if this frame is the // 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 // main frame. |transition_type| provides information about the source of the
// start or continue loading after the main frame load has ended. This // navigation and an accurate value is only available in the browser process.
// function will always be called for all frames irrespective of whether the // Multiple frames may be loading at the same time. Sub-frames may start or
// request completes successfully. For notification of overall browser load // continue loading after the main frame load has ended. This function will
// status use OnLoadingStateChange instead. // 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, void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame); struct _cef_browser_t* browser, struct _cef_frame_t* frame,
cef_transition_type_t transition_type);
/// ///
// Called when the browser is done loading a frame. The |frame| value will // Called when the browser is done loading a frame. The |frame| value will

View File

@@ -279,7 +279,7 @@ CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
// Creates a new context object that shares storage with |other| and uses an // Creates a new context object that shares storage with |other| and uses an
// optional |handler|. // optional |handler|.
/// ///
CEF_EXPORT cef_request_context_t* create_context_shared( CEF_EXPORT cef_request_context_t* cef_create_context_shared(
cef_request_context_t* other, cef_request_context_t* other,
struct _cef_request_context_handler_t* handler); struct _cef_request_context_handler_t* handler);

View File

@@ -490,24 +490,34 @@ class CefBrowserHost : public virtual CefBase {
virtual void StopFinding(bool clearSelection) =0; virtual void StopFinding(bool clearSelection) =0;
/// ///
// Open developer tools in its own window. If |inspect_element_at| is non- // Open developer tools (DevTools) in its own browser. The DevTools browser
// empty the element at the specified (x,y) location will be inspected. The // will remain associated with this browser. If the DevTools browser is
// |windowInfo| parameter will be ignored if this browser is wrapped in a // already open then it will be focused, in which case the |windowInfo|,
// CefBrowserView. // |client| and |settings| parameters will be ignored. If |inspect_element_at|
// is non-empty then the element at the specified (x,y) location will be
// inspected. The |windowInfo| parameter will be ignored if this browser is
// wrapped in a CefBrowserView.
/// ///
/*--cef(optional_param=inspect_element_at)--*/ /*--cef(optional_param=windowInfo,optional_param=client,
optional_param=settings,optional_param=inspect_element_at)--*/
virtual void ShowDevTools(const CefWindowInfo& windowInfo, virtual void ShowDevTools(const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) =0; const CefPoint& inspect_element_at) =0;
/// ///
// Explicitly close the developer tools window if one exists for this browser // Explicitly close the associated DevTools browser, if any.
// instance.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void CloseDevTools() =0; virtual void CloseDevTools() =0;
///
// Returns true if this browser currently has an associated DevTools browser.
// Must be called on the browser process UI thread.
///
/*--cef()--*/
virtual bool HasDevTools() =0;
/// ///
// Retrieve a snapshot of current navigation entries as values sent to the // Retrieve a snapshot of current navigation entries as values sent to the
// specified visitor. If |current_only| is true only the current navigation // specified visitor. If |current_only| is true only the current navigation

View File

@@ -51,6 +51,7 @@
class CefLoadHandler : public virtual CefBase { class CefLoadHandler : public virtual CefBase {
public: public:
typedef cef_errorcode_t ErrorCode; typedef cef_errorcode_t ErrorCode;
typedef cef_transition_type_t TransitionType;
/// ///
// Called when the loading state has changed. This callback will be executed // Called when the loading state has changed. This callback will be executed
@@ -68,15 +69,18 @@ class CefLoadHandler : public virtual CefBase {
/// ///
// Called when the browser begins loading a frame. The |frame| value will // Called when the browser begins loading a frame. The |frame| value will
// never be empty -- call the IsMain() method to check if this frame is the // 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 // main frame. |transition_type| provides information about the source of the
// start or continue loading after the main frame load has ended. This method // navigation and an accurate value is only available in the browser process.
// will always be called for all frames irrespective of whether the request // 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. For notification of overall browser load status use // completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead. // OnLoadingStateChange instead.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser, virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) {} CefRefPtr<CefFrame> frame,
TransitionType transition_type) {}
/// ///
// Called when the browser is done loading a frame. The |frame| value will // Called when the browser is done loading a frame. The |frame| value will

View File

@@ -104,7 +104,7 @@ class CefRequestContext : public virtual CefBase {
// Creates a new context object that shares storage with |other| and uses an // Creates a new context object that shares storage with |other| and uses an
// optional |handler|. // optional |handler|.
/// ///
/*--cef(capi_name=create_context_shared,optional_param=handler)--*/ /*--cef(capi_name=cef_create_context_shared,optional_param=handler)--*/
static CefRefPtr<CefRequestContext> CreateContext( static CefRefPtr<CefRequestContext> CreateContext(
CefRefPtr<CefRequestContext> other, CefRefPtr<CefRequestContext> other,
CefRefPtr<CefRequestContextHandler> handler); CefRefPtr<CefRequestContextHandler> handler);

View File

@@ -209,12 +209,14 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
pref_proxy_config_tracker_->DetachFromPrefService(); pref_proxy_config_tracker_->DetachFromPrefService();
if (host_content_settings_map_.get()) if (url_request_getter_)
url_request_getter_->ShutdownOnUIThread();
if (host_content_settings_map_)
host_content_settings_map_->ShutdownOnUIThread(); host_content_settings_map_->ShutdownOnUIThread();
// Delete the download manager delegate here because otherwise we'll crash // Delete the download manager delegate here because otherwise we'll crash
// when it's accessed from the content::BrowserContext destructor. // when it's accessed from the content::BrowserContext destructor.
if (download_manager_delegate_.get()) if (download_manager_delegate_)
download_manager_delegate_.reset(NULL); download_manager_delegate_.reset(NULL);
g_manager.Get().RemoveImpl(this, cache_path_); g_manager.Get().RemoveImpl(this, cache_path_);

View File

@@ -596,7 +596,7 @@ void CefBrowserHostImpl::SetFocus(bool focus) {
if (focus) if (focus)
OnSetFocus(FOCUS_SOURCE_SYSTEM); OnSetFocus(FOCUS_SOURCE_SYSTEM);
else else if (platform_delegate_)
platform_delegate_->SendFocusEvent(false); platform_delegate_->SendFocusEvent(false);
} }
@@ -805,6 +805,10 @@ void CefBrowserHostImpl::ShowDevTools(
return; return;
if (devtools_frontend_) { if (devtools_frontend_) {
if (!inspect_element_at.IsEmpty()) {
devtools_frontend_->InspectElementAt(inspect_element_at.x,
inspect_element_at.y);
}
devtools_frontend_->Focus(); devtools_frontend_->Focus();
return; return;
} }
@@ -832,6 +836,15 @@ void CefBrowserHostImpl::CloseDevTools() {
} }
} }
bool CefBrowserHostImpl::HasDevTools() {
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
return (devtools_frontend_ != nullptr);
}
void CefBrowserHostImpl::GetNavigationEntries( void CefBrowserHostImpl::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor, CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) { bool current_only) {
@@ -926,7 +939,7 @@ void CefBrowserHostImpl::WasResized() {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->WasResized(); platform_delegate_->WasResized();
@@ -944,7 +957,7 @@ void CefBrowserHostImpl::WasHidden(bool hidden) {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->WasHidden(hidden); platform_delegate_->WasHidden(hidden);
@@ -962,7 +975,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->NotifyScreenInfoChanged(); platform_delegate_->NotifyScreenInfoChanged();
@@ -980,7 +993,7 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->Invalidate(type); platform_delegate_->Invalidate(type);
@@ -993,7 +1006,7 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
content::NativeWebKeyboardEvent web_event; content::NativeWebKeyboardEvent web_event;
@@ -1010,7 +1023,7 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
blink::WebMouseEvent web_event; blink::WebMouseEvent web_event;
@@ -1028,7 +1041,7 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
blink::WebMouseEvent web_event; blink::WebMouseEvent web_event;
@@ -1045,7 +1058,7 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
blink::WebMouseWheelEvent web_event; blink::WebMouseWheelEvent web_event;
@@ -1064,7 +1077,7 @@ void CefBrowserHostImpl::SendCaptureLostEvent() {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->SendCaptureLostEvent(); platform_delegate_->SendCaptureLostEvent();
@@ -1078,7 +1091,7 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->NotifyMoveOrResizeStarted(); platform_delegate_->NotifyMoveOrResizeStarted();
@@ -1104,7 +1117,9 @@ void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
} }
settings_.windowless_frame_rate = frame_rate; settings_.windowless_frame_rate = frame_rate;
platform_delegate_->SetWindowlessFrameRate(frame_rate);
if (platform_delegate_)
platform_delegate_->SetWindowlessFrameRate(frame_rate);
} }
// CefBrowser methods. // CefBrowser methods.
@@ -1407,12 +1422,14 @@ void CefBrowserHostImpl::DestroyBrowser() {
#if defined(USE_AURA) #if defined(USE_AURA)
views::Widget* CefBrowserHostImpl::GetWindowWidget() const { views::Widget* CefBrowserHostImpl::GetWindowWidget() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!platform_delegate_)
return nullptr;
return platform_delegate_->GetWindowWidget(); return platform_delegate_->GetWindowWidget();
} }
CefRefPtr<CefBrowserView> CefBrowserHostImpl::GetBrowserView() const { CefRefPtr<CefBrowserView> CefBrowserHostImpl::GetBrowserView() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (IsViewsHosted()) if (IsViewsHosted() && platform_delegate_)
return platform_delegate_->GetBrowserView(); return platform_delegate_->GetBrowserView();
return nullptr; return nullptr;
} }
@@ -1651,7 +1668,8 @@ void CefBrowserHostImpl::ViewText(const std::string& text) {
return; return;
} }
platform_delegate_->ViewText(text); if (platform_delegate_)
platform_delegate_->ViewText(text);
} }
void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) { void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
@@ -1664,7 +1682,7 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
handler->OnProtocolExecution(this, url.spec(), allow_os_execution); handler->OnProtocolExecution(this, url.spec(), allow_os_execution);
} }
if (allow_os_execution) if (allow_os_execution && platform_delegate_)
platform_delegate_->HandleExternalProtocol(url); platform_delegate_->HandleExternalProtocol(url);
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
@@ -1694,7 +1712,8 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
} }
} }
platform_delegate_->SendFocusEvent(true); if (platform_delegate_)
platform_delegate_->SendFocusEvent(true);
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source)); base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
@@ -1766,7 +1785,7 @@ CefTextInputContext CefBrowserHostImpl::GetNSTextInputContext() {
return nullptr; return nullptr;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return nullptr; return nullptr;
return platform_delegate_->GetNSTextInputContext(); return platform_delegate_->GetNSTextInputContext();
@@ -1788,7 +1807,7 @@ void CefBrowserHostImpl::HandleKeyEventBeforeTextInputClient(
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->HandleKeyEventBeforeTextInputClient(keyEvent); platform_delegate_->HandleKeyEventBeforeTextInputClient(keyEvent);
@@ -1808,7 +1827,7 @@ void CefBrowserHostImpl::HandleKeyEventAfterTextInputClient(
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
return platform_delegate_->HandleKeyEventAfterTextInputClient(keyEvent); return platform_delegate_->HandleKeyEventAfterTextInputClient(keyEvent);
@@ -1835,7 +1854,7 @@ void CefBrowserHostImpl::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->DragTargetDragEnter(drag_data, event, allowed_ops); platform_delegate_->DragTargetDragEnter(drag_data, event, allowed_ops);
@@ -1855,7 +1874,7 @@ void CefBrowserHostImpl::DragTargetDragOver(const CefMouseEvent& event,
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->DragTargetDragOver(event, allowed_ops); platform_delegate_->DragTargetDragOver(event, allowed_ops);
@@ -1873,7 +1892,7 @@ void CefBrowserHostImpl::DragTargetDragLeave() {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->DragTargetDragLeave(); platform_delegate_->DragTargetDragLeave();
@@ -1891,7 +1910,7 @@ void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->DragTargetDrop(event); platform_delegate_->DragTargetDrop(event);
@@ -1909,6 +1928,9 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() {
return; return;
} }
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->DragSourceSystemDragEnded(); platform_delegate_->DragSourceSystemDragEnded();
} }
@@ -1925,7 +1947,7 @@ void CefBrowserHostImpl::DragSourceEndedAt(
return; return;
} }
if (!web_contents()) if (!web_contents() || !platform_delegate_)
return; return;
platform_delegate_->DragSourceEndedAt(x, y, op); platform_delegate_->DragSourceEndedAt(x, y, op);
@@ -2095,6 +2117,9 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent(
content::WebContents* source, content::WebContents* source,
const content::NativeWebKeyboardEvent& event, const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) { bool* is_keyboard_shortcut) {
if (!platform_delegate_)
return false;
if (client_.get()) { if (client_.get()) {
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler(); CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) { if (handler.get()) {
@@ -2120,6 +2145,9 @@ void CefBrowserHostImpl::HandleKeyboardEvent(
if (event.skip_in_browser) if (event.skip_in_browser)
return; return;
if (!platform_delegate_)
return;
if (client_.get()) { if (client_.get()) {
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler(); CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) { if (handler.get()) {
@@ -2221,7 +2249,7 @@ void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
content::JavaScriptDialogManager* content::JavaScriptDialogManager*
CefBrowserHostImpl::GetJavaScriptDialogManager( CefBrowserHostImpl::GetJavaScriptDialogManager(
content::WebContents* source) { content::WebContents* source) {
if (!javascript_dialog_manager_.get()) { if (!javascript_dialog_manager_.get() && platform_delegate_) {
javascript_dialog_manager_.reset( javascript_dialog_manager_.reset(
new CefJavaScriptDialogManager(this, new CefJavaScriptDialogManager(this,
platform_delegate_->CreateJavaScriptDialogRunner())); platform_delegate_->CreateJavaScriptDialogRunner()));
@@ -2240,7 +2268,7 @@ bool CefBrowserHostImpl::HandleContextMenu(
content::WebContents* web_contents, content::WebContents* web_contents,
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!menu_manager_.get()) { if (!menu_manager_.get() && platform_delegate_) {
menu_manager_.reset( menu_manager_.reset(
new CefMenuManager(this, new CefMenuManager(this,
platform_delegate_->CreateMenuRunner())); platform_delegate_->CreateMenuRunner()));
@@ -2252,7 +2280,8 @@ void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
const gfx::Size& pref_size) { const gfx::Size& pref_size) {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
platform_delegate_->SizeTo(pref_size.width(), pref_size.height()); if (platform_delegate_)
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
#endif #endif
} }
@@ -2918,7 +2947,7 @@ void CefBrowserHostImpl::SetFocusedFrame(int64 frame_id) {
gfx::Point CefBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const { gfx::Point CefBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (platform_delegate_.get()) if (platform_delegate_)
return platform_delegate_->GetScreenPoint(view); return platform_delegate_->GetScreenPoint(view);
return gfx::Point(); return gfx::Point();
} }
@@ -2941,7 +2970,8 @@ void CefBrowserHostImpl::OnLoadStart(CefRefPtr<CefFrame> frame,
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler(); CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
if (handler.get()) { if (handler.get()) {
// Notify the handler that loading has started. // Notify the handler that loading has started.
handler->OnLoadStart(this, frame); handler->OnLoadStart(this, frame,
static_cast<cef_transition_type_t>(transition_type));
} }
} }
} }
@@ -3003,7 +3033,7 @@ void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
void CefBrowserHostImpl::EnsureFileDialogManager() { void CefBrowserHostImpl::EnsureFileDialogManager() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!file_dialog_manager_.get()) { if (!file_dialog_manager_.get() && platform_delegate_) {
file_dialog_manager_.reset( file_dialog_manager_.reset(
new CefFileDialogManager(this, new CefFileDialogManager(this,
platform_delegate_->CreateFileDialogRunner())); platform_delegate_->CreateFileDialogRunner()));

View File

@@ -180,6 +180,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) override; const CefPoint& inspect_element_at) override;
void CloseDevTools() override; void CloseDevTools() override;
bool HasDevTools() override;
void GetNavigationEntries( void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor, CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) override; bool current_only) override;

View File

@@ -5,91 +5,16 @@
#include "libcef/browser/component_updater/cef_component_updater_configurator.h" #include "libcef/browser/component_updater/cef_component_updater_configurator.h"
#include "include/cef_version.h" #include "include/cef_version.h"
#include <algorithm>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/strings/stringprintf.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/version.h" #include "base/version.h"
#include "build/build_config.h" #include "components/component_updater/configurator_impl.h"
#include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
#include "components/update_client/component_patcher_operation.h" #include "components/update_client/component_patcher_operation.h"
#include "components/component_updater/component_updater_switches.h"
#include "components/component_updater/component_updater_url_constants.h"
#include "components/update_client/configurator.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h"
#if defined(OS_WIN)
#include "base/win/win_util.h"
#endif // OS_WIN
using update_client::Configurator;
namespace component_updater { namespace component_updater {
namespace { namespace {
// Default time constants. class CefConfigurator : public update_client::Configurator {
const int kDelayOneMinute = 60;
const int kDelayOneHour = kDelayOneMinute * 60;
// Debug values you can pass to --component-updater=value1,value2.
// Speed up component checking.
const char kSwitchFastUpdate[] = "fast-update";
// Add "testrequest=1" attribute to the update check request.
const char kSwitchRequestParam[] = "test-request";
// Disables pings. Pings are the requests sent to the update server that report
// the success or the failure of component install or update attempts.
extern const char kSwitchDisablePings[] = "disable-pings";
// Sets the URL for updates.
const char kSwitchUrlSource[] = "url-source";
// Disables differential updates.
const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates";
#if defined(OS_WIN)
// Disables background downloads.
const char kSwitchDisableBackgroundDownloads[] = "disable-background-downloads";
#endif // defined(OS_WIN)
// Returns true if and only if |test| is contained in |vec|.
bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) {
if (vec.empty())
return 0;
return (std::find(vec.begin(), vec.end(), test) != vec.end());
}
// If there is an element of |vec| of the form |test|=.*, returns the right-
// hand side of that assignment. Otherwise, returns an empty string.
// The right-hand side may contain additional '=' characters, allowing for
// further nesting of switch arguments.
std::string GetSwitchArgument(const std::vector<std::string>& vec,
const char* test) {
if (vec.empty())
return std::string();
for (std::vector<std::string>::const_iterator it = vec.begin();
it != vec.end();
++it) {
const std::size_t found = it->find("=");
if (found != std::string::npos) {
if (it->substr(0, found) == test) {
return it->substr(found + 1);
}
}
}
return std::string();
}
class CefConfigurator : public Configurator {
public: public:
CefConfigurator(const base::CommandLine* cmdline, CefConfigurator(const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter, net::URLRequestContextGetter* url_request_getter,
@@ -124,134 +49,68 @@ class CefConfigurator : public Configurator {
~CefConfigurator() override {} ~CefConfigurator() override {}
net::URLRequestContextGetter* url_request_getter_; ConfiguratorImpl configurator_impl_;
PrefService* pref_service_; PrefService* pref_service_;
std::string extra_info_;
GURL url_source_override_;
bool fast_update_;
bool pings_enabled_;
bool deltas_enabled_;
bool background_downloads_enabled_;
}; };
CefConfigurator::CefConfigurator( CefConfigurator::CefConfigurator(
const base::CommandLine* cmdline, const base::CommandLine* cmdline,
net::URLRequestContextGetter* url_request_getter, net::URLRequestContextGetter* url_request_getter,
PrefService* pref_service) PrefService* pref_service)
: url_request_getter_(url_request_getter), : configurator_impl_(cmdline, url_request_getter, false),
pref_service_(pref_service), pref_service_(pref_service) {
fast_update_(false),
pings_enabled_(false),
deltas_enabled_(false),
background_downloads_enabled_(false) {
// Parse comma-delimited debug flags.
std::vector<std::string> switch_values = base::SplitString(
cmdline->GetSwitchValueASCII(switches::kComponentUpdater),
",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate);
pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings);
deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates);
// TODO(dberger): Pull this (and possibly the various hard-coded
// delay params in this file) from cef settings.
fast_update_ = true;
#if defined(OS_WIN)
background_downloads_enabled_ =
!HasSwitchValue(switch_values, kSwitchDisableBackgroundDownloads);
#else
background_downloads_enabled_ = false;
#endif
const std::string switch_url_source =
GetSwitchArgument(switch_values, kSwitchUrlSource);
if (!switch_url_source.empty()) {
url_source_override_ = GURL(switch_url_source);
DCHECK(url_source_override_.is_valid());
}
if (HasSwitchValue(switch_values, kSwitchRequestParam))
extra_info_ += "testrequest=\"1\"";
} }
int CefConfigurator::InitialDelay() const { int CefConfigurator::InitialDelay() const {
return fast_update_ ? 10 : (6 * kDelayOneMinute); return configurator_impl_.InitialDelay();
} }
int CefConfigurator::NextCheckDelay() const { int CefConfigurator::NextCheckDelay() const {
return fast_update_ ? 60 : (6 * kDelayOneHour); return configurator_impl_.NextCheckDelay();
} }
int CefConfigurator::StepDelay() const { int CefConfigurator::StepDelay() const {
return fast_update_ ? 1 : 1; return configurator_impl_.StepDelay();
} }
int CefConfigurator::OnDemandDelay() const { int CefConfigurator::OnDemandDelay() const {
return fast_update_ ? 2 : (30 * kDelayOneMinute); return configurator_impl_.OnDemandDelay();
} }
int CefConfigurator::UpdateDelay() const { int CefConfigurator::UpdateDelay() const {
return fast_update_ ? 10 : (15 * kDelayOneMinute); return configurator_impl_.UpdateDelay();
} }
std::vector<GURL> CefConfigurator::UpdateUrl() const { std::vector<GURL> CefConfigurator::UpdateUrl() const {
std::vector<GURL> urls; return configurator_impl_.UpdateUrl();
if (url_source_override_.is_valid()) {
urls.push_back(GURL(url_source_override_));
} else {
urls.push_back(GURL(kUpdaterDefaultUrl));
}
return urls;
} }
std::vector<GURL> CefConfigurator::PingUrl() const { std::vector<GURL> CefConfigurator::PingUrl() const {
return pings_enabled_ ? UpdateUrl() : std::vector<GURL>(); return configurator_impl_.PingUrl();
} }
base::Version CefConfigurator::GetBrowserVersion() const { base::Version CefConfigurator::GetBrowserVersion() const {
return base::Version(base::StringPrintf("%d.%d.%d.%d", return configurator_impl_.GetBrowserVersion();
CHROME_VERSION_MAJOR,
CHROME_VERSION_MINOR,
CHROME_VERSION_BUILD,
CHROME_VERSION_PATCH));
} }
std::string CefConfigurator::GetChannel() const { std::string CefConfigurator::GetChannel() const {
return ""; return std::string();
} }
std::string CefConfigurator::GetBrand() const { std::string CefConfigurator::GetBrand() const {
return ""; return std::string();
} }
std::string CefConfigurator::GetLang() const { std::string CefConfigurator::GetLang() const {
return ""; return std::string();
} }
std::string CefConfigurator::GetOSLongName() const { std::string CefConfigurator::GetOSLongName() const {
#if defined(OS_WIN) return configurator_impl_.GetOSLongName();
return "Windows";
#elif defined(OS_MACOSX)
return "Mac OS X";
#elif defined(OS_CHROMEOS)
return "Chromium OS";
#elif defined(OS_ANDROID)
return "Android";
#elif defined(OS_LINUX)
return "Linux";
#elif defined(OS_FREEBSD)
return "FreeBSD";
#elif defined(OS_OPENBSD)
return "OpenBSD";
#elif defined(OS_SOLARIS)
return "Solaris";
#else
return "Unknown";
#endif
} }
std::string CefConfigurator::ExtraRequestParams() const { std::string CefConfigurator::ExtraRequestParams() const {
return extra_info_; return configurator_impl_.ExtraRequestParams();
} }
std::string CefConfigurator::GetDownloadPreference() const { std::string CefConfigurator::GetDownloadPreference() const {
@@ -259,32 +118,36 @@ std::string CefConfigurator::GetDownloadPreference() const {
} }
net::URLRequestContextGetter* CefConfigurator::RequestContext() const { net::URLRequestContextGetter* CefConfigurator::RequestContext() const {
return url_request_getter_; return configurator_impl_.RequestContext();
} }
scoped_refptr<update_client::OutOfProcessPatcher> scoped_refptr<update_client::OutOfProcessPatcher>
CefConfigurator::CreateOutOfProcessPatcher() const { CefConfigurator::CreateOutOfProcessPatcher() const {
return NULL; return nullptr;
} }
bool CefConfigurator::DeltasEnabled() const { bool CefConfigurator::DeltasEnabled() const {
return deltas_enabled_; return configurator_impl_.DeltasEnabled();
} }
bool CefConfigurator::UseBackgroundDownloader() const { bool CefConfigurator::UseBackgroundDownloader() const {
return background_downloads_enabled_; return configurator_impl_.UseBackgroundDownloader();
} }
bool CefConfigurator::UseCupSigning() const { bool CefConfigurator::UseCupSigning() const {
return true; return configurator_impl_.UseCupSigning();
} }
// Returns a task runner to run blocking tasks. The task runner continues to run
// after the browser shuts down, until the OS terminates the process. This
// imposes certain requirements for the code using the task runner, such as
// not accessing any global browser state while the code is running.
scoped_refptr<base::SequencedTaskRunner> scoped_refptr<base::SequencedTaskRunner>
CefConfigurator::GetSequencedTaskRunner() const { CefConfigurator::GetSequencedTaskRunner() const {
return content::BrowserThread::GetBlockingPool() return content::BrowserThread::GetBlockingPool()
->GetSequencedTaskRunnerWithShutdownBehavior( ->GetSequencedTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::GetSequenceToken(), base::SequencedWorkerPool::GetSequenceToken(),
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
} }
PrefService* CefConfigurator::GetPrefService() const { PrefService* CefConfigurator::GetPrefService() const {

View File

@@ -123,38 +123,28 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
CefBrowserHostImpl::Create(create_params); CefBrowserHostImpl::Create(create_params);
content::WebContents* inspected_contents = inspected_browser->web_contents(); content::WebContents* inspected_contents = inspected_browser->web_contents();
if (!inspect_element_at.IsEmpty()) {
scoped_refptr<content::DevToolsAgentHost> agent_host =
content::DevToolsAgentHost::GetOrCreateFor(inspected_contents);
agent_host->InspectElement(inspect_element_at.x, inspect_element_at.y);
}
// CefDevToolsFrontend will delete itself when the frontend WebContents is // CefDevToolsFrontend will delete itself when the frontend WebContents is
// destroyed. // destroyed.
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend( CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
static_cast<CefBrowserHostImpl*>(frontend_browser.get()), static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
inspected_contents); inspected_contents, inspect_element_at);
// Need to load the URL after creating the DevTools objects. // Need to load the URL after creating the DevTools objects.
CefDevToolsDelegate* delegate = CefDevToolsDelegate* delegate =
CefContentBrowserClient::Get()->devtools_delegate(); CefContentBrowserClient::Get()->devtools_delegate();
frontend_browser->GetMainFrame()->LoadURL(delegate->GetChromeDevToolsURL()); frontend_browser->GetMainFrame()->LoadURL(delegate->GetChromeDevToolsURL());
devtools_frontend->Activate();
devtools_frontend->Focus();
return devtools_frontend; return devtools_frontend;
} }
void CefDevToolsFrontend::Activate() {
frontend_browser_->ActivateContents(web_contents());
}
void CefDevToolsFrontend::Focus() { void CefDevToolsFrontend::Focus() {
web_contents()->Focus(); frontend_browser_->SetFocus(true);
} }
void CefDevToolsFrontend::InspectElementAt(int x, int y) { void CefDevToolsFrontend::InspectElementAt(int x, int y) {
if (inspect_element_at_.x != x || inspect_element_at_.y != y)
inspect_element_at_.Set(x, y);
if (agent_host_) if (agent_host_)
agent_host_->InspectElement(x, y); agent_host_->InspectElement(x, y);
} }
@@ -174,10 +164,12 @@ void CefDevToolsFrontend::DisconnectFromTarget() {
CefDevToolsFrontend::CefDevToolsFrontend( CefDevToolsFrontend::CefDevToolsFrontend(
CefRefPtr<CefBrowserHostImpl> frontend_browser, CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents) content::WebContents* inspected_contents,
const CefPoint& inspect_element_at)
: WebContentsObserver(frontend_browser->web_contents()), : WebContentsObserver(frontend_browser->web_contents()),
frontend_browser_(frontend_browser), frontend_browser_(frontend_browser),
inspected_contents_(inspected_contents), inspected_contents_(inspected_contents),
inspect_element_at_(inspect_element_at),
weak_factory_(this) { weak_factory_(this) {
} }
@@ -206,6 +198,9 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
if (agent_host != agent_host_) { if (agent_host != agent_host_) {
agent_host_ = agent_host; agent_host_ = agent_host;
agent_host_->AttachClient(this); agent_host_->AttachClient(this);
if (!inspect_element_at_.IsEmpty())
InspectElementAt(inspect_element_at_.x, inspect_element_at_.y);
} }
} }

View File

@@ -36,7 +36,6 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at); const CefPoint& inspect_element_at);
void Activate();
void Focus(); void Focus();
void InspectElementAt(int x, int y); void InspectElementAt(int x, int y);
void Close(); void Close();
@@ -54,7 +53,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
private: private:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser, CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents); content::WebContents* inspected_contents,
const CefPoint& inspect_element_at);
~CefDevToolsFrontend() override; ~CefDevToolsFrontend() override;
// content::DevToolsAgentHostClient implementation. // content::DevToolsAgentHostClient implementation.
@@ -79,6 +79,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
CefRefPtr<CefBrowserHostImpl> frontend_browser_; CefRefPtr<CefBrowserHostImpl> frontend_browser_;
content::WebContents* inspected_contents_; content::WebContents* inspected_contents_;
CefPoint inspect_element_at_;
scoped_refptr<content::DevToolsAgentHost> agent_host_; scoped_refptr<content::DevToolsAgentHost> agent_host_;
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_; std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
using PendingRequestsMap = std::map<const net::URLFetcher*, int>; using PendingRequestsMap = std::map<const net::URLFetcher*, int>;

View File

@@ -232,7 +232,8 @@ void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
std::string openCommand("xdg-open "); std::string openCommand("xdg-open ");
openCommand += newName; openCommand += newName;
system(openCommand.c_str()); int result = system(openCommand.c_str());
ALLOW_UNUSED_LOCAL(result);
} }
void CefBrowserPlatformDelegateNativeLinux::HandleKeyboardEvent( void CefBrowserPlatformDelegateNativeLinux::HandleKeyboardEvent(

View File

@@ -92,18 +92,6 @@
[super dealloc]; [super dealloc];
} }
// Called when we are activated (when we gain focus).
- (void)windowDidBecomeKey:(NSNotification*)notification {
if (browser_)
browser_->SetFocus(true);
}
// Called when we are deactivated (when we lose focus).
- (void)windowDidResignKey:(NSNotification*)notification {
if (browser_)
browser_->SetFocus(false);
}
- (BOOL)windowShouldClose:(id)window { - (BOOL)windowShouldClose:(id)window {
if (browser_ && !browser_->TryCloseBrowser()) { if (browser_ && !browser_->TryCloseBrowser()) {
// Cancel the close. // Cancel the close.
@@ -217,12 +205,12 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
parentView = [newWnd contentView]; parentView = [newWnd contentView];
window_info_.parent_view = parentView; window_info_.parent_view = parentView;
}
// Make the content view for the window have a layer. This will make all // Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer // sub-views have layers. This is necessary to ensure correct layer
// ordering of all child views and their layers. // ordering of all child views and their layers.
[[[parentView window] contentView] setWantsLayer:YES]; [parentView setWantsLayer:YES];
}
host_window_created_ = true; host_window_created_ = true;

View File

@@ -235,8 +235,8 @@ namespace {
void RunOpenFileDialog( void RunOpenFileDialog(
const CefFileDialogRunner::FileChooserParams& params, const CefFileDialogRunner::FileChooserParams& params,
NSView* view, NSView* view,
int* filter_index, int filter_index,
std::vector<base::FilePath>* files) { CefFileDialogRunner::RunFileChooserCallback callback) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel]; NSOpenPanel* openPanel = [NSOpenPanel openPanel];
base::string16 title; base::string16 title;
@@ -277,8 +277,8 @@ void RunOpenFileDialog(
// Add the file filter control. // Add the file filter control.
filter_delegate = filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:openPanel [[CefFilterDelegate alloc] initWithPanel:openPanel
andAcceptFilters:params.accept_types andAcceptFilters:params.accept_types
andFilterIndex:*filter_index]; andFilterIndex:filter_index];
} }
// Further panel configuration. // Further panel configuration.
@@ -294,28 +294,27 @@ void RunOpenFileDialog(
// Show panel. // Show panel.
[openPanel beginSheetModalForWindow:[view window] [openPanel beginSheetModalForWindow:[view window]
completionHandler:^(NSInteger returnCode) { completionHandler:^(NSInteger returnCode) {
[NSApp stopModalWithCode:returnCode]; int filter_index_to_use =
}]; (filter_delegate != nil) ? [filter_delegate filter] : filter_index;
NSInteger result = [NSApp runModalForWindow:[view window]]; if (returnCode == NSFileHandlingPanelOKButton) {
if (result == NSFileHandlingPanelOKButton) { std::vector<base::FilePath> files;
NSArray *urls = [openPanel URLs]; files.reserve(openPanel.URLs.count);
int i, count = [urls count]; for (NSURL* url in openPanel.URLs) {
for (i=0; i<count; i++) { if (url.isFileURL)
NSURL* url = [urls objectAtIndex:i]; files.push_back(base::FilePath(url.path.UTF8String));
if ([url isFileURL]) }
files->push_back(base::FilePath(base::SysNSStringToUTF8([url path]))); callback.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use, std::vector<base::FilePath>());
} }
} }];
if (filter_delegate != nil)
*filter_index = [filter_delegate filter];
} }
bool RunSaveFileDialog( void RunSaveFileDialog(
const CefFileDialogRunner::FileChooserParams& params, const CefFileDialogRunner::FileChooserParams& params,
NSView* view, NSView* view,
int* filter_index, int filter_index,
base::FilePath* file) { CefFileDialogRunner::RunFileChooserCallback callback) {
NSSavePanel* savePanel = [NSSavePanel savePanel]; NSSavePanel* savePanel = [NSSavePanel savePanel];
base::string16 title; base::string16 title;
@@ -349,32 +348,27 @@ bool RunSaveFileDialog(
// Add the file filter control. // Add the file filter control.
filter_delegate = filter_delegate =
[[CefFilterDelegate alloc] initWithPanel:savePanel [[CefFilterDelegate alloc] initWithPanel:savePanel
andAcceptFilters:params.accept_types andAcceptFilters:params.accept_types
andFilterIndex:*filter_index]; andFilterIndex:filter_index];
} }
[savePanel setAllowsOtherFileTypes:YES]; [savePanel setAllowsOtherFileTypes:YES];
[savePanel setShowsHiddenFiles:!params.hidereadonly]; [savePanel setShowsHiddenFiles:!params.hidereadonly];
bool success = false;
// Show panel. // Show panel.
[savePanel beginSheetModalForWindow:[view window] [savePanel beginSheetModalForWindow:view.window
completionHandler:^(NSInteger resultCode) { completionHandler:^(NSInteger resultCode) {
[NSApp stopModalWithCode:resultCode]; int filter_index_to_use =
(filter_delegate != nil) ? [filter_delegate filter] : filter_index;
if (resultCode == NSFileHandlingPanelOKButton) {
NSURL* url = savePanel.URL;
const char* path = url.path.UTF8String;
std::vector<base::FilePath> files(1, base::FilePath(path));
callback.Run(filter_index_to_use, files);
} else {
callback.Run(filter_index_to_use, std::vector<base::FilePath>());
}
}]; }];
NSInteger result = [NSApp runModalForWindow:[view window]];
if (result == NSFileHandlingPanelOKButton) {
NSURL* url = [savePanel URL];
NSString* path = [url path];
*file = base::FilePath([path UTF8String]);
success = true;
}
if (filter_delegate != nil)
*filter_index = [filter_delegate filter];
return success;
} }
} // namespace } // namespace
@@ -385,22 +379,16 @@ CefFileDialogRunnerMac::CefFileDialogRunnerMac() {
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser, void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
const FileChooserParams& params, const FileChooserParams& params,
RunFileChooserCallback callback) { RunFileChooserCallback callback) {
std::vector<base::FilePath> files;
int filter_index = params.selected_accept_filter; int filter_index = params.selected_accept_filter;
NSView* owner = browser->GetWindowHandle(); NSView* owner = browser->GetWindowHandle();
if (params.mode == content::FileChooserParams::Open || if (params.mode == content::FileChooserParams::Open ||
params.mode == content::FileChooserParams::OpenMultiple || params.mode == content::FileChooserParams::OpenMultiple ||
params.mode == content::FileChooserParams::UploadFolder) { params.mode == content::FileChooserParams::UploadFolder) {
RunOpenFileDialog(params, owner, &filter_index, &files); RunOpenFileDialog(params, owner, filter_index, callback);
} else if (params.mode == content::FileChooserParams::Save) { } else if (params.mode == content::FileChooserParams::Save) {
base::FilePath file; RunSaveFileDialog(params, owner, filter_index, callback);
if (RunSaveFileDialog(params, owner, &filter_index, &file)) {
files.push_back(file);
}
} else { } else {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
callback.Run(filter_index, files);
} }

View File

@@ -258,16 +258,15 @@ class NativeMenuWin::MenuHostWindow {
gfx::Image icon; gfx::Image icon;
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) { if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
// We currently don't support items with both icons and checkboxes. // We currently don't support items with both icons and checkboxes.
const gfx::ImageSkia* skia_icon = icon.ToImageSkia(); const gfx::ImageSkia skia_icon = icon.AsImageSkia();
DCHECK(type != ui::MenuModel::TYPE_CHECK); DCHECK(type != ui::MenuModel::TYPE_CHECK);
gfx::Canvas canvas( gfx::Canvas canvas(skia_icon.size(), 1.0f, false);
skia_icon->GetRepresentation(1.0f), canvas.DrawImageInt(skia_icon, 0, 0);
false);
skia::DrawToNativeContext( skia::DrawToNativeContext(
canvas.sk_canvas(), dc, canvas.sk_canvas(), dc,
draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.left + kItemLeftMargin,
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
draw_item_struct->rcItem.top - skia_icon->height()) / 2, NULL); draw_item_struct->rcItem.top - skia_icon.height()) / 2, NULL);
} else if (type == ui::MenuModel::TYPE_CHECK && } else if (type == ui::MenuModel::TYPE_CHECK &&
data->native_menu_win->model_->IsItemCheckedAt( data->native_menu_win->model_->IsItemCheckedAt(
data->model_index)) { data->model_index)) {

View File

@@ -18,6 +18,9 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/browser/net/safe_search_util.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "net/filter/filter.h" #include "net/filter/filter.h"
@@ -38,10 +41,12 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
CefRefPtr<CefRequestImpl> cef_request, CefRefPtr<CefRequestImpl> cef_request,
GURL* new_url, GURL* new_url,
net::URLRequest* url_request, net::URLRequest* url_request,
bool force_google_safesearch,
const CallbackType& callback) const CallbackType& callback)
: cef_request_(cef_request), : cef_request_(cef_request),
new_url_(new_url), new_url_(new_url),
url_request_(url_request), url_request_(url_request),
force_google_safesearch_(force_google_safesearch),
callback_(callback) { callback_(callback) {
DCHECK(new_url); DCHECK(new_url);
DCHECK(url_request_); DCHECK(url_request_);
@@ -54,11 +59,13 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_IOT()) { if (CEF_CURRENTLY_ON_IOT()) {
RunNow(cef_request_, new_url_, url_request_, callback_, false); RunNow(cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, false);
} else { } else {
CEF_POST_TASK(CEF_IOT, CEF_POST_TASK(CEF_IOT,
base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow, base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
cef_request_, new_url_, url_request_, callback_, false)); cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, false));
} }
} }
} }
@@ -77,7 +84,8 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
void ContinueNow(bool allow) { void ContinueNow(bool allow) {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
if (!callback_.is_null()) { if (!callback_.is_null()) {
RunNow(cef_request_, new_url_, url_request_, callback_, allow); RunNow(cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, allow);
Disconnect(); Disconnect();
} }
} }
@@ -115,6 +123,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
GURL* new_url, GURL* new_url,
net::URLRequest* request, net::URLRequest* request,
const CallbackType& callback, const CallbackType& callback,
bool force_google_safesearch,
bool allow) { bool allow) {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
@@ -139,8 +148,12 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
request->RemoveUserData(UserDataKey()); request->RemoveUserData(UserDataKey());
// Only execute the callback if the request has not been canceled. // Only execute the callback if the request has not been canceled.
if (request->status().status() != net::URLRequestStatus::CANCELED) if (request->status().status() != net::URLRequestStatus::CANCELED) {
if (force_google_safesearch && allow && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
callback.Run(allow ? net::OK : net::ERR_ABORTED); callback.Run(allow ? net::OK : net::ERR_ABORTED);
}
} }
static inline void* UserDataKey() { static inline void* UserDataKey() {
@@ -151,6 +164,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
const GURL old_url_; const GURL old_url_;
GURL* new_url_; GURL* new_url_;
net::URLRequest* url_request_; net::URLRequest* url_request_;
bool force_google_safesearch_;
CallbackType callback_; CallbackType callback_;
// The user data key. // The user data key.
@@ -224,7 +238,8 @@ class CefAuthCallbackImpl : public CefAuthCallback {
} // namespace } // namespace
CefNetworkDelegate::CefNetworkDelegate() { CefNetworkDelegate::CefNetworkDelegate()
: force_google_safesearch_(nullptr) {
} }
CefNetworkDelegate::~CefNetworkDelegate() { CefNetworkDelegate::~CefNetworkDelegate() {
@@ -255,6 +270,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
net::URLRequest* request, net::URLRequest* request,
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
GURL* new_url) { GURL* new_url) {
const bool force_google_safesearch =
(force_google_safesearch_ && force_google_safesearch_->GetValue());
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(request); CefBrowserHostImpl::GetBrowserForRequest(request);
if (browser.get()) { if (browser.get()) {
@@ -279,6 +297,7 @@ int CefNetworkDelegate::OnBeforeURLRequest(
CefRefPtr<CefBeforeResourceLoadCallbackImpl> callbackImpl( CefRefPtr<CefBeforeResourceLoadCallbackImpl> callbackImpl(
new CefBeforeResourceLoadCallbackImpl(requestPtr, new_url, request, new CefBeforeResourceLoadCallbackImpl(requestPtr, new_url, request,
force_google_safesearch,
callback)); callback));
// Give the client an opportunity to evaluate the request. // Give the client an opportunity to evaluate the request.
@@ -298,6 +317,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
} }
} }
if (force_google_safesearch && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
// Continue the request immediately. // Continue the request immediately.
return net::OK; return net::OK;
} }

View File

@@ -9,6 +9,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "net/base/network_delegate_impl.h" #include "net/base/network_delegate_impl.h"
template<class T> class PrefMember;
typedef PrefMember<bool> BooleanPrefMember;
// Used for intercepting resource requests, redirects and responses. The single // Used for intercepting resource requests, redirects and responses. The single
// instance of this class is managed by CefURLRequestContextGetter. // instance of this class is managed by CefURLRequestContextGetter.
class CefNetworkDelegate : public net::NetworkDelegateImpl { class CefNetworkDelegate : public net::NetworkDelegateImpl {
@@ -21,6 +24,11 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
static bool AreExperimentalCookieFeaturesEnabled(); static bool AreExperimentalCookieFeaturesEnabled();
static bool AreStrictSecureCookiesEnabled(); static bool AreStrictSecureCookiesEnabled();
void set_force_google_safesearch(
BooleanPrefMember* force_google_safesearch) {
force_google_safesearch_ = force_google_safesearch;
}
private: private:
// net::NetworkDelegate methods. // net::NetworkDelegate methods.
int OnBeforeURLRequest(net::URLRequest* request, int OnBeforeURLRequest(net::URLRequest* request,
@@ -39,6 +47,9 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
net::Filter* SetupFilter(net::URLRequest* request, net::Filter* SetupFilter(net::URLRequest* request,
net::Filter* filter_list) override; net::Filter* filter_list) override;
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
BooleanPrefMember* force_google_safesearch_;
DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate); DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate);
}; };

View File

@@ -27,6 +27,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/net/proxy_service_factory.h" #include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
@@ -120,6 +121,19 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
std::swap(protocol_handlers_, *protocol_handlers); std::swap(protocol_handlers_, *protocol_handlers);
auto io_thread_proxy =
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
quick_check_enabled_.Init(prefs::kQuickCheckEnabled, pref_service);
quick_check_enabled_.MoveToThread(io_thread_proxy);
pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled,
pref_service);
pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy);
force_google_safesearch_.Init(prefs::kForceGoogleSafeSearch, pref_service);
force_google_safesearch_.MoveToThread(io_thread_proxy);
#if defined(OS_POSIX) && !defined(OS_ANDROID) #if defined(OS_POSIX) && !defined(OS_ANDROID)
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName); gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
#endif #endif
@@ -134,6 +148,27 @@ CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
storage_->set_proxy_service(NULL); storage_->set_proxy_service(NULL);
} }
// static
void CefURLRequestContextGetterImpl::RegisterPrefs(
PrefRegistrySimple* registry) {
// Based on IOThread::RegisterPrefs.
#if defined(OS_POSIX) && !defined(OS_ANDROID)
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
#endif
registry->RegisterBooleanPref(prefs::kQuickCheckEnabled, true);
registry->RegisterBooleanPref(prefs::kPacHttpsUrlStrippingEnabled, true);
// Based on ProfileImpl::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kForceGoogleSafeSearch, false);
}
void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
CEF_REQUIRE_UIT();
quick_check_enabled_.Destroy();
pac_https_url_stripping_enabled_.Destroy();
force_google_safesearch_.Destroy();
}
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() { net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
@@ -152,7 +187,10 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
SetCookieStoragePath(cache_path, SetCookieStoragePath(cache_path,
settings_.persist_session_cookies ? true : false); settings_.persist_session_cookies ? true : false);
storage_->set_network_delegate(base::WrapUnique(new CefNetworkDelegate)); std::unique_ptr<CefNetworkDelegate> network_delegate(
new CefNetworkDelegate());
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
storage_->set_network_delegate(std::move(network_delegate));
storage_->set_channel_id_service(base::WrapUnique( storage_->set_channel_id_service(base::WrapUnique(
new net::ChannelIDService( new net::ChannelIDService(
@@ -177,7 +215,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
url_request_context_->network_delegate(), url_request_context_->network_delegate(),
std::move(proxy_config_service_), std::move(proxy_config_service_),
*command_line, *command_line,
true); quick_check_enabled_.GetValue(),
pac_https_url_stripping_enabled_.GetValue());
storage_->set_proxy_service(std::move(system_proxy_service)); storage_->set_proxy_service(std::move(system_proxy_service));
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
@@ -202,11 +241,14 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
storage_->set_http_server_properties(base::WrapUnique( storage_->set_http_server_properties(base::WrapUnique(
new net::HttpServerPropertiesImpl)); new net::HttpServerPropertiesImpl));
base::FilePath http_cache_path;
if (!cache_path.empty())
http_cache_path = cache_path.Append(FILE_PATH_LITERAL("Cache"));
std::unique_ptr<net::HttpCache::DefaultBackend> main_backend( std::unique_ptr<net::HttpCache::DefaultBackend> main_backend(
new net::HttpCache::DefaultBackend( new net::HttpCache::DefaultBackend(
cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
net::CACHE_BACKEND_DEFAULT, net::CACHE_BACKEND_DEFAULT,
cache_path, http_cache_path,
0, 0,
BrowserThread::GetMessageLoopProxyForThread( BrowserThread::GetMessageLoopProxyForThread(
BrowserThread::CACHE))); BrowserThread::CACHE)));

View File

@@ -17,9 +17,11 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "components/prefs/pref_member.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "net/url_request/url_request_job_factory.h" #include "net/url_request/url_request_job_factory.h"
class PrefRegistrySimple;
class PrefService; class PrefService;
namespace base { namespace base {
@@ -52,6 +54,12 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
content::URLRequestInterceptorScopedVector request_interceptors); content::URLRequestInterceptorScopedVector request_interceptors);
~CefURLRequestContextGetterImpl() override; ~CefURLRequestContextGetterImpl() override;
// Register preferences. Called from browser_prefs::CreatePrefService().
static void RegisterPrefs(PrefRegistrySimple* registry);
// Called when the BrowserContextImpl is destroyed.
void ShutdownOnUIThread();
// net::URLRequestContextGetter implementation. // net::URLRequestContextGetter implementation.
net::URLRequestContext* GetURLRequestContext() override; net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> scoped_refptr<base::SingleThreadTaskRunner>
@@ -102,6 +110,12 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_; std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
BooleanPrefMember quick_check_enabled_;
BooleanPrefMember pac_https_url_stripping_enabled_;
// Member variables which are pointed to by the various context objects.
mutable BooleanPrefMember force_google_safesearch_;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterImpl); DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterImpl);
}; };

View File

@@ -1085,6 +1085,10 @@ void CefRenderWidgetHostViewOSR::SetBeginFrameSource(
// See https://codereview.chromium.org/1841083007. // See https://codereview.chromium.org/1841083007.
} }
bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
return render_widget_host_->auto_resize_enabled();
}
bool CefRenderWidgetHostViewOSR::InstallTransparency() { bool CefRenderWidgetHostViewOSR::InstallTransparency() {
if (transparent_) { if (transparent_) {
SetBackgroundColor(SkColor()); SetBackgroundColor(SkColor());
@@ -1137,13 +1141,7 @@ void CefRenderWidgetHostViewOSR::Invalidate(
const gfx::Rect& bounds_in_pixels = gfx::Rect(GetPhysicalBackingSize()); const gfx::Rect& bounds_in_pixels = gfx::Rect(GetPhysicalBackingSize());
if (software_output_device_) { if (software_output_device_) {
if (IsFramePending()) { software_output_device_->OnPaint(bounds_in_pixels);
// Include the invalidated region in the next frame generated.
software_output_device_->Invalidate(bounds_in_pixels);
} else {
// Call OnPaint immediately.
software_output_device_->OnPaint(bounds_in_pixels);
}
} else if (copy_frame_generator_.get()) { } else if (copy_frame_generator_.get()) {
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels); copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
} }
@@ -1377,18 +1375,7 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
root_layer_->SetBounds(gfx::Rect(size)); root_layer_->SetBounds(gfx::Rect(size));
compositor_->SetScaleAndSize(scale_factor_, size_in_pixels); compositor_->SetScaleAndSize(scale_factor_, size_in_pixels);
} PlatformResizeCompositorWidget(size_in_pixels);
bool CefRenderWidgetHostViewOSR::IsFramePending() {
if (!IsShowing())
return false;
if (begin_frame_timer_.get())
return begin_frame_timer_->IsActive();
else if (copy_frame_generator_.get())
return copy_frame_generator_->frame_pending();
return false;
} }
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() { void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {

View File

@@ -220,6 +220,7 @@ class CefRenderWidgetHostViewOSR
const base::TimeTicks& timebase, const base::TimeTicks& timebase,
const base::TimeDelta& interval) override; const base::TimeDelta& interval) override;
void SetBeginFrameSource(cc::BeginFrameSource* source) override; void SetBeginFrameSource(cc::BeginFrameSource* source) override;
bool IsAutoResizeEnabled() const override;
bool InstallTransparency(); bool InstallTransparency();
@@ -282,9 +283,6 @@ class CefRenderWidgetHostViewOSR
void SetDeviceScaleFactor(); void SetDeviceScaleFactor();
void ResizeRootLayer(); void ResizeRootLayer();
// Returns a best guess whether a frame is currently pending.
bool IsFramePending();
// Called by CefBeginFrameTimer to send a BeginFrame request. // Called by CefBeginFrameTimer to send a BeginFrame request.
void OnBeginFrameTimerTick(); void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time, void SendBeginFrame(base::TimeTicks frame_time,
@@ -317,6 +315,7 @@ class CefRenderWidgetHostViewOSR
#endif // defined(OS_MACOSX) #endif // defined(OS_MACOSX)
void PlatformCreateCompositorWidget(); void PlatformCreateCompositorWidget();
void PlatformResizeCompositorWidget(const gfx::Size& size);
void PlatformDestroyCompositorWidget(); void PlatformDestroyCompositorWidget();
#if defined(USE_AURA) #if defined(USE_AURA)

View File

@@ -123,6 +123,9 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
compositor_widget_ = window_->xwindow(); compositor_widget_ = window_->xwindow();
} }
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
DCHECK(window_); DCHECK(window_);
window_->Close(); window_->Close();

View File

@@ -318,6 +318,9 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
browser_compositor_->Unsuspend(); browser_compositor_->Unsuspend();
} }
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
DCHECK(window_); DCHECK(window_);

View File

@@ -149,6 +149,12 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
compositor_widget_ = window_->hwnd(); compositor_widget_ = window_->hwnd();
} }
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) {
DCHECK(window_);
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
window_.reset(NULL); window_.reset(NULL);
compositor_widget_ = gfx::kNullAcceleratedWidget; compositor_widget_ = gfx::kNullAcceleratedWidget;

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/prefs/browser_prefs.h" #include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/prefs/renderer_prefs.h" #include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/common/cef_switches.h" #include "libcef/common/cef_switches.h"
@@ -126,6 +127,7 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get()); extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get()); HostContentSettingsMap::RegisterProfilePrefs(registry.get());
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
renderer_prefs::RegisterProfilePrefs(registry.get()); renderer_prefs::RegisterProfilePrefs(registry.get());
update_client::RegisterPrefs(registry.get()); update_client::RegisterPrefs(registry.get());
@@ -160,12 +162,6 @@ std::unique_ptr<PrefService> CreatePrefService(const base::FilePath& pref_path)
registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false); registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false);
registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false); registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false);
// Network preferences.
// Based on IOThread::RegisterPrefs.
#if defined(OS_POSIX) && !defined(OS_ANDROID)
registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
#endif
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) { if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
// Preferences used with unit tests. // Preferences used with unit tests.
registry->RegisterBooleanPref("test.bool", true); registry->RegisterBooleanPref("test.bool", true);

View File

@@ -87,10 +87,12 @@ bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
bool has_user_gesture) { bool has_user_gesture) {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
content::WebContents* web_contents = web_contents_getter.Run(); content::WebContents* web_contents = web_contents_getter.Run();
CefRefPtr<CefBrowserHostImpl> browser = if (web_contents) {
CefBrowserHostImpl::GetBrowserForContents(web_contents); CefRefPtr<CefBrowserHostImpl> browser =
if (browser.get()) CefBrowserHostImpl::GetBrowserForContents(web_contents);
browser->HandleExternalProtocol(url); if (browser.get())
browser->HandleExternalProtocol(url);
}
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate:: base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate::

View File

@@ -200,7 +200,7 @@ display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
find_bounds); find_bounds);
} }
#endif #endif
return display::Screen::GetScreen()->GetDisplayMatching(bounds); return display::Screen::GetScreen()->GetDisplayMatching(find_bounds);
} }
void ConvertPointFromPixels(gfx::Point* point, void ConvertPointFromPixels(gfx::Point* point,

View File

@@ -27,6 +27,7 @@
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/content_settings_pattern.h"
#include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
@@ -559,21 +560,23 @@ void CefMainDelegate::PreSandboxStartup() {
false, // May not be an absolute path. false, // May not be an absolute path.
true); // Create if necessary. true); // Create if necessary.
const base::FilePath& resources_path = GetResourcesFilePath();
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
const base::FilePath& widevine_plugin_path = const base::FilePath& widevine_plugin_path =
GetResourcesFilePath().AppendASCII(kWidevineCdmAdapterFileName); resources_path.AppendASCII(kWidevineCdmAdapterFileName);
if (base::PathExists(widevine_plugin_path)) { if (base::PathExists(widevine_plugin_path)) {
PathService::Override(chrome::FILE_WIDEVINE_CDM_ADAPTER, PathService::Override(chrome::FILE_WIDEVINE_CDM_ADAPTER,
widevine_plugin_path); widevine_plugin_path);
} }
#if defined(WIDEVINE_CDM_IS_COMPONENT)
if (command_line->HasSwitch(switches::kEnableWidevineCdm)) {
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) #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
// Paths to find pre-installed components.
PathService::Override(chrome::DIR_COMPONENTS, resources_path);
// Register paths to be used by the component updater.
component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS,
chrome::DIR_USER_DATA);
} }
if (command_line->HasSwitch(switches::kDisablePackLoading)) if (command_line->HasSwitch(switches::kDisablePackLoading))

View File

@@ -85,7 +85,8 @@ scoped_refptr<base::SequencedTaskRunner>
break; break;
}; };
if (id >= 0 && CefContentClient::Get()->browser() && if (id >= 0 && CefContentClient::Get() &&
CefContentClient::Get()->browser() &&
BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) { BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) {
// Don't use BrowserThread::GetMessageLoopProxyForThread because it returns // Don't use BrowserThread::GetMessageLoopProxyForThread because it returns
// a new MessageLoopProxy object for each call and makes pointer equality // a new MessageLoopProxy object for each call and makes pointer equality

View File

@@ -689,7 +689,7 @@ void CefBrowserImpl::OnLoadStart(blink::WebLocalFrame* frame) {
CefRefPtr<CefLoadHandler> load_handler = handler->GetLoadHandler(); CefRefPtr<CefLoadHandler> load_handler = handler->GetLoadHandler();
if (load_handler.get()) { if (load_handler.get()) {
CefRefPtr<CefFrameImpl> cef_frame = GetWebFrameImpl(frame); CefRefPtr<CefFrameImpl> cef_frame = GetWebFrameImpl(frame);
load_handler->OnLoadStart(this, cef_frame.get()); load_handler->OnLoadStart(this, cef_frame.get(), TT_EXPLICIT);
} }
} }
} }

View File

@@ -425,19 +425,7 @@ void CEF_CALLBACK browser_host_show_dev_tools(struct _cef_browser_host_t* self,
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return; return;
// Verify param: windowInfo; type: struct_byref_const // Unverified params: windowInfo, client, settings, inspect_element_at
DCHECK(windowInfo);
if (!windowInfo)
return;
// Verify param: client; type: refptr_diff
DCHECK(client);
if (!client)
return;
// Verify param: settings; type: struct_byref_const
DCHECK(settings);
if (!settings)
return;
// Unverified params: inspect_element_at
// Translate param: windowInfo; type: struct_byref_const // Translate param: windowInfo; type: struct_byref_const
CefWindowInfo windowInfoObj; CefWindowInfo windowInfoObj;
@@ -471,6 +459,20 @@ void CEF_CALLBACK browser_host_close_dev_tools(
CefBrowserHostCppToC::Get(self)->CloseDevTools(); CefBrowserHostCppToC::Get(self)->CloseDevTools();
} }
int CEF_CALLBACK browser_host_has_dev_tools(struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->HasDevTools();
// Return type: bool
return _retval;
}
void CEF_CALLBACK browser_host_get_navigation_entries( void CEF_CALLBACK browser_host_get_navigation_entries(
struct _cef_browser_host_t* self, cef_navigation_entry_visitor_t* visitor, struct _cef_browser_host_t* self, cef_navigation_entry_visitor_t* visitor,
int current_only) { int current_only) {
@@ -962,6 +964,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->stop_finding = browser_host_stop_finding; GetStruct()->stop_finding = browser_host_stop_finding;
GetStruct()->show_dev_tools = browser_host_show_dev_tools; GetStruct()->show_dev_tools = browser_host_show_dev_tools;
GetStruct()->close_dev_tools = browser_host_close_dev_tools; GetStruct()->close_dev_tools = browser_host_close_dev_tools;
GetStruct()->has_dev_tools = browser_host_has_dev_tools;
GetStruct()->get_navigation_entries = browser_host_get_navigation_entries; GetStruct()->get_navigation_entries = browser_host_get_navigation_entries;
GetStruct()->set_mouse_cursor_change_disabled = GetStruct()->set_mouse_cursor_change_disabled =
browser_host_set_mouse_cursor_change_disabled; browser_host_set_mouse_cursor_change_disabled;

View File

@@ -41,7 +41,8 @@ void CEF_CALLBACK load_handler_on_loading_state_change(
} }
void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self, void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self,
cef_browser_t* browser, cef_frame_t* frame) { cef_browser_t* browser, cef_frame_t* frame,
cef_transition_type_t transition_type) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@@ -59,7 +60,8 @@ void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self,
// Execute // Execute
CefLoadHandlerCppToC::Get(self)->OnLoadStart( CefLoadHandlerCppToC::Get(self)->OnLoadStart(
CefBrowserCToCpp::Wrap(browser), CefBrowserCToCpp::Wrap(browser),
CefFrameCToCpp::Wrap(frame)); CefFrameCToCpp::Wrap(frame),
transition_type);
} }
void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self, void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self,

View File

@@ -58,7 +58,7 @@ CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
return CefRequestContextCppToC::Wrap(_retval); return CefRequestContextCppToC::Wrap(_retval);
} }
CEF_EXPORT cef_request_context_t* create_context_shared( CEF_EXPORT cef_request_context_t* cef_create_context_shared(
cef_request_context_t* other, cef_request_context_t* other,
struct _cef_request_context_handler_t* handler) { struct _cef_request_context_handler_t* handler) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@@ -375,11 +375,7 @@ void CefBrowserHostCToCpp::ShowDevTools(const CefWindowInfo& windowInfo,
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: client; type: refptr_diff // Unverified params: windowInfo, client, settings, inspect_element_at
DCHECK(client.get());
if (!client.get())
return;
// Unverified params: inspect_element_at
// Execute // Execute
_struct->show_dev_tools(_struct, _struct->show_dev_tools(_struct,
@@ -400,6 +396,20 @@ void CefBrowserHostCToCpp::CloseDevTools() {
_struct->close_dev_tools(_struct); _struct->close_dev_tools(_struct);
} }
bool CefBrowserHostCToCpp::HasDevTools() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_dev_tools))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->has_dev_tools(_struct);
// Return type: bool
return _retval?true:false;
}
void CefBrowserHostCToCpp::GetNavigationEntries( void CefBrowserHostCToCpp::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor, bool current_only) { CefRefPtr<CefNavigationEntryVisitor> visitor, bool current_only) {
cef_browser_host_t* _struct = GetStruct(); cef_browser_host_t* _struct = GetStruct();

View File

@@ -63,6 +63,7 @@ class CefBrowserHostCToCpp
CefRefPtr<CefClient> client, const CefBrowserSettings& settings, CefRefPtr<CefClient> client, const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) OVERRIDE; const CefPoint& inspect_element_at) OVERRIDE;
void CloseDevTools() OVERRIDE; void CloseDevTools() OVERRIDE;
bool HasDevTools() OVERRIDE;
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor, void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) OVERRIDE; bool current_only) OVERRIDE;
void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE; void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;

View File

@@ -39,7 +39,7 @@ void CefLoadHandlerCToCpp::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
} }
void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr<CefBrowser> browser, void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) { CefRefPtr<CefFrame> frame, TransitionType transition_type) {
cef_load_handler_t* _struct = GetStruct(); cef_load_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_load_start)) if (CEF_MEMBER_MISSING(_struct, on_load_start))
return; return;
@@ -58,7 +58,8 @@ void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr<CefBrowser> browser,
// Execute // Execute
_struct->on_load_start(_struct, _struct->on_load_start(_struct,
CefBrowserCppToC::Wrap(browser), CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame)); CefFrameCppToC::Wrap(frame),
transition_type);
} }
void CefLoadHandlerCToCpp::OnLoadEnd(CefRefPtr<CefBrowser> browser, void CefLoadHandlerCToCpp::OnLoadEnd(CefRefPtr<CefBrowser> browser,

View File

@@ -33,8 +33,8 @@ class CefLoadHandlerCToCpp
// CefLoadHandler methods. // CefLoadHandler methods.
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser, bool isLoading, void OnLoadingStateChange(CefRefPtr<CefBrowser> browser, bool isLoading,
bool canGoBack, bool canGoForward) override; bool canGoBack, bool canGoForward) override;
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefFrame> frame) override; TransitionType transition_type) override;
void OnLoadEnd(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, void OnLoadEnd(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
int httpStatusCode) override; int httpStatusCode) override;
void OnLoadError(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, void OnLoadError(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,

View File

@@ -61,7 +61,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
// Unverified params: handler // Unverified params: handler
// Execute // Execute
cef_request_context_t* _retval = create_context_shared( cef_request_context_t* _retval = cef_create_context_shared(
CefRequestContextCToCpp::Unwrap(other), CefRequestContextCToCpp::Unwrap(other),
CefRequestContextHandlerCppToC::Wrap(handler)); CefRequestContextHandlerCppToC::Wrap(handler));

9
libcef_dll/libcef.lst Normal file
View File

@@ -0,0 +1,9 @@
# Copyright 2016 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.
{
/* Only export necessary symbols from libcef.so. */
global: cef_*;
local: *;
};

View File

@@ -33,6 +33,9 @@ patches = [
{ {
# Fix ninja output for localization directories on OS X. # Fix ninja output for localization directories on OS X.
# https://bugs.chromium.org/p/gyp/issues/detail?id=331 # https://bugs.chromium.org/p/gyp/issues/detail?id=331
#
# Write environment.* files with the correct SDK version on Windows.
# https://bugs.chromium.org/p/chromium/issues/detail?id=634788
'name': 'gyp_331', 'name': 'gyp_331',
'path': '../tools/gyp/pylib/', 'path': '../tools/gyp/pylib/',
}, },
@@ -248,4 +251,11 @@ patches = [
'name': 'render_view_host_impl_1392', 'name': 'render_view_host_impl_1392',
'path': '../content/browser/renderer_host/', 'path': '../content/browser/renderer_host/',
}, },
{
# Fix crash when scrolling to the bottom of an iframe with
# --root-layer-scrolls
# https://codereview.chromium.org/2150153002
'name': 'viewport_2150153002',
'path': '../',
},
] ]

View File

@@ -1,8 +1,8 @@
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
index 54d6c4c..4a5268d 100644 index 839f8ff..b65a1b4 100644
--- render_widget_host_view_guest.cc --- render_widget_host_view_guest.cc
+++ render_widget_host_view_guest.cc +++ render_widget_host_view_guest.cc
@@ -212,6 +212,9 @@ void RenderWidgetHostViewGuest::Destroy() { @@ -243,6 +243,9 @@ void RenderWidgetHostViewGuest::Destroy() {
} }
gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const { gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const {

View File

@@ -1,5 +1,5 @@
diff --git common.gypi common.gypi diff --git common.gypi common.gypi
index 3724f2f..5eb9cde 100644 index 2850490..a00882f 100644
--- common.gypi --- common.gypi
+++ common.gypi +++ common.gypi
@@ -9,6 +9,9 @@ @@ -9,6 +9,9 @@

View File

@@ -39,10 +39,10 @@ index d96adc9..348ae16 100644
// built in media player for the given |url|. Defaults to false. // built in media player for the given |url|. Defaults to false.
virtual bool ShouldUseMediaPlayerForURL(const GURL& url); virtual bool ShouldUseMediaPlayerForURL(const GURL& url);
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index 4ff6aaa..4309775 100644 index 400a60c..2c9fe67 100644
--- renderer/render_frame_impl.cc --- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc +++ renderer/render_frame_impl.cc
@@ -4771,7 +4771,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( @@ -4779,7 +4779,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
(pending_navigation_params_ && (pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty()); !pending_navigation_params_->request_params.redirects.empty());
@@ -50,7 +50,7 @@ index 4ff6aaa..4309775 100644
// The handlenavigation API is deprecated and will be removed once // The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved. // crbug.com/325351 is resolved.
if (GetContentClient()->renderer()->HandleNavigation( if (GetContentClient()->renderer()->HandleNavigation(
@@ -4780,7 +4779,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( @@ -4788,7 +4787,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
is_redirect)) { is_redirect)) {
return blink::WebNavigationPolicyIgnore; return blink::WebNavigationPolicyIgnore;
} }

View File

@@ -1,3 +1,26 @@
diff --git gyp/MSVSVersion.py gyp/MSVSVersion.py
index edaf6ee..c213df8 100644
--- gyp/MSVSVersion.py
+++ gyp/MSVSVersion.py
@@ -92,7 +92,8 @@ class VisualStudioVersion(object):
# VS2013 and later, non-Express have a x64-x86 cross that we want
# to prefer.
return [os.path.normpath(
- os.path.join(self.path, 'VC/vcvarsall.bat')), 'amd64_x86']
+ os.path.join(self.path, 'VC/vcvarsall.bat')), 'amd64_x86', \
+ '10.0.10586.0']
# Otherwise, the standard x86 compiler.
return [os.path.normpath(
os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))]
@@ -106,7 +107,7 @@ class VisualStudioVersion(object):
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'):
arg = 'amd64'
return [os.path.normpath(
- os.path.join(self.path, 'VC/vcvarsall.bat')), arg]
+ os.path.join(self.path, 'VC/vcvarsall.bat')), arg, '10.0.10586.0']
def SetupScript(self, target_arch):
script_data = self._SetupScriptInternal(target_arch)
diff --git gyp/generator/ninja.py gyp/generator/ninja.py diff --git gyp/generator/ninja.py gyp/generator/ninja.py
index 9cfc706..932dc86 100644 index 9cfc706..932dc86 100644
--- gyp/generator/ninja.py --- gyp/generator/ninja.py

View File

@@ -35,10 +35,10 @@ index 54b8ed4..160991f 100644
bool inert_visual_viewport; bool inert_visual_viewport;
bool record_whole_document; bool record_whole_document;
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 71c52a3..cef247f 100644 index c6c6a49..3b57491 100644
--- renderer/render_view_impl.cc --- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc +++ renderer/render_view_impl.cc
@@ -1475,6 +1475,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( @@ -1478,6 +1478,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
blink::WebView* web_view, blink::WebView* web_view,
CompositorDependencies* compositor_deps) { CompositorDependencies* compositor_deps) {
ApplyWebPreferences(prefs, web_view); ApplyWebPreferences(prefs, web_view);

View File

@@ -1,8 +1,8 @@
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index 86481a9..e2e56c0 100644 index bc7ed53..b673bd4 100644
--- render_widget_host_view_mac.mm --- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm
@@ -572,9 +572,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, @@ -577,9 +577,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
// Paint this view host with |background_color_| when there is no content // Paint this view host with |background_color_| when there is no content
// ready to draw. // ready to draw.
background_layer_.reset([[CALayer alloc] init]); background_layer_.reset([[CALayer alloc] init]);

View File

@@ -0,0 +1,24 @@
diff --git cc/layers/viewport.cc cc/layers/viewport.cc
index d80d40c..30984592 100644
--- cc/layers/viewport.cc
+++ cc/layers/viewport.cc
@@ -36,6 +36,9 @@ Viewport::ScrollResult Viewport::ScrollBy(const gfx::Vector2dF& delta,
const gfx::Point& viewport_point,
bool is_direct_manipulation,
bool affect_top_controls) {
+ if (!OuterScrollLayer())
+ return ScrollResult();
+
gfx::Vector2dF content_delta = delta;
if (affect_top_controls && ShouldTopControlsConsumeScroll(delta))
@@ -74,6 +77,9 @@ bool Viewport::ShouldAnimateViewport(const gfx::Vector2dF& viewport_delta,
}
gfx::Vector2dF Viewport::ScrollAnimated(const gfx::Vector2dF& delta) {
+ if (!OuterScrollLayer())
+ return gfx::Vector2dF(0, 0);
+
ScrollTree& scroll_tree =
host_impl_->active_tree()->property_trees()->scroll_tree;

View File

@@ -1,8 +1,8 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index c33e325c..04ad7d9 100644 index 8737a71..6bf3224 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc --- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -695,6 +695,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() { @@ -685,6 +685,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
} }
} }
#endif #endif
@@ -473,7 +473,7 @@ index b843416..8b81a51 100644
} }
case Widget::InitParams::TYPE_CONTROL: case Widget::InitParams::TYPE_CONTROL:
diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc
index 921b838..954d426 100644 index 3d77ea4..aaefc0a 100644
--- ui/views/win/hwnd_message_handler.cc --- ui/views/win/hwnd_message_handler.cc
+++ ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc
@@ -852,6 +852,8 @@ void HWNDMessageHandler::SizeConstraintsChanged() { @@ -852,6 +852,8 @@ void HWNDMessageHandler::SizeConstraintsChanged() {

View File

@@ -1,8 +1,8 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index ab5b0e7..c977d57 100644 index 3d0bf95..e58379a 100644
--- Source/web/ChromeClientImpl.cpp --- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp
@@ -880,7 +880,7 @@ bool ChromeClientImpl::hasOpenedPopup() const @@ -883,7 +883,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select) PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select)
{ {
notifyPopupOpeningObservers(); notifyPopupOpeningObservers();
@@ -12,7 +12,7 @@ index ab5b0e7..c977d57 100644
DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); DCHECK(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index 218f70f..24824fd 100644 index 8f60abf..910ba9a 100644
--- Source/web/WebViewImpl.cpp --- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp
@@ -415,6 +415,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) @@ -415,6 +415,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)

View File

@@ -246,7 +246,7 @@ if(OS_WINDOWS)
endif() endif()
# Add the custom manifest files to the executable. # Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}") ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}" "exe")
# Copy CEF binary and resource files to the target output directory. # Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@@ -60,10 +60,12 @@ void BrowserWindowStdMac::ShowPopup(ClientWindowHandle parent_handle,
void BrowserWindowStdMac::Show() { void BrowserWindowStdMac::Show() {
REQUIRE_MAIN_THREAD(); REQUIRE_MAIN_THREAD();
// Nothing to do here. Chromium internally handles window show/hide.
} }
void BrowserWindowStdMac::Hide() { void BrowserWindowStdMac::Hide() {
REQUIRE_MAIN_THREAD(); REQUIRE_MAIN_THREAD();
// Nothing to do here. Chromium internally handles window show/hide.
} }
void BrowserWindowStdMac::SetBounds(int x, int y, size_t width, size_t height) { void BrowserWindowStdMac::SetBounds(int x, int y, size_t width, size_t height) {
@@ -73,9 +75,7 @@ void BrowserWindowStdMac::SetBounds(int x, int y, size_t width, size_t height) {
void BrowserWindowStdMac::SetFocus(bool focus) { void BrowserWindowStdMac::SetFocus(bool focus) {
REQUIRE_MAIN_THREAD(); REQUIRE_MAIN_THREAD();
// Nothing to do here. Chromium internally handles window focus assignment.
if (browser_)
browser_->GetHost()->SetFocus(focus);
} }
ClientWindowHandle BrowserWindowStdMac::GetWindowHandle() const { ClientWindowHandle BrowserWindowStdMac::GetWindowHandle() const {

View File

@@ -356,9 +356,12 @@ bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefDragHandler::DragOperationsMask mask) { CefDragHandler::DragOperationsMask mask) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
// Forbid dragging of link URLs. // Forbid dragging of URLs and files.
if (mask & DRAG_OPERATION_LINK) if ((mask & DRAG_OPERATION_LINK) && !dragData->IsFragment()) {
test_runner::Alert(
browser, "cefclient blocks dragging of URLs and files");
return true; return true;
}
return false; return false;
} }
@@ -687,14 +690,33 @@ int ClientHandler::GetBrowserCount() const {
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser, void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser,
const CefPoint& inspect_element_at) { const CefPoint& inspect_element_at) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.
CefPostTask(TID_UI, base::Bind(&ClientHandler::ShowDevTools, this, browser,
inspect_element_at));
return;
}
CefWindowInfo windowInfo; CefWindowInfo windowInfo;
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;
CefBrowserSettings settings; CefBrowserSettings settings;
if (CreatePopupWindow(browser, true, CefPopupFeatures(), windowInfo, client, CefRefPtr<CefBrowserHost> host = browser->GetHost();
settings)) {
browser->GetHost()->ShowDevTools(windowInfo, client, settings, // Test if the DevTools browser already exists.
inspect_element_at); bool has_devtools = host->HasDevTools();
if (!has_devtools) {
// Create a new RootWindow for the DevTools browser that will be created
// by ShowDevTools().
has_devtools = CreatePopupWindow(browser, true, CefPopupFeatures(),
windowInfo, client, settings);
}
if (has_devtools) {
// Create the DevTools browser if it doesn't already exist.
// Otherwise, focus the existing DevTools browser and inspect the element
// at |inspect_element_at| if non-empty.
host->ShowDevTools(windowInfo, client, settings, inspect_element_at);
} }
} }

View File

@@ -150,6 +150,12 @@ void RootWindowGtk::Show(ShowMode mode) {
MinimizeWindow(GTK_WINDOW(window_)); MinimizeWindow(GTK_WINDOW(window_));
else if (mode == ShowMaximized) else if (mode == ShowMaximized)
MaximizeWindow(GTK_WINDOW(window_)); MaximizeWindow(GTK_WINDOW(window_));
// Flush the display to make sure the underlying X11 window gets created
// immediately.
GdkWindow* gdk_window = gtk_widget_get_window(window_);
GdkDisplay* display = gdk_window_get_display(gdk_window);
gdk_display_flush(display);
} }
void RootWindowGtk::Hide() { void RootWindowGtk::Hide() {

View File

@@ -468,7 +468,8 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings) {
styleMask:(NSTitledWindowMask | styleMask:(NSTitledWindowMask |
NSClosableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSMiniaturizableWindowMask |
NSResizableWindowMask ) NSResizableWindowMask |
NSUnifiedTitleAndToolbarWindowMask )
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
defer:NO]; defer:NO];
[window_ setTitle:@"cefclient"]; [window_ setTitle:@"cefclient"];
@@ -494,6 +495,13 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings) {
NSView* contentView = [window_ contentView]; NSView* contentView = [window_ contentView];
NSRect contentBounds = [contentView bounds]; NSRect contentBounds = [contentView bounds];
if (!with_osr_) {
// Make the content view for the window have a layer. This will make all
// sub-views have layers. This is necessary to ensure correct layer
// ordering of all child views and their layers.
[contentView setWantsLayer:YES];
}
if (with_controls_) { if (with_controls_) {
// Create the buttons. // Create the buttons.
NSRect button_rect = contentBounds; NSRect button_rect = contentBounds;

View File

@@ -157,7 +157,7 @@ if(OS_WINDOWS)
endif() endif()
# Add the custom manifest files to the executable. # Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}") ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "exe")
# Copy binary and resource files to the target output directory. # Copy binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@@ -355,7 +355,8 @@ class FrameNavRendererTest : public ClientAppRenderer::Delegate,
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
CreateExpectationsIfNecessary(); CreateExpectationsIfNecessary();
EXPECT_TRUE(expectations_->OnLoadStart(browser, frame)) << "nav = " << nav_; EXPECT_TRUE(expectations_->OnLoadStart(browser, frame)) << "nav = " << nav_;
} }
@@ -522,7 +523,8 @@ class FrameNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
EXPECT_TRUE(expectations_->OnLoadStart(browser, frame)) << "nav = " << nav_; EXPECT_TRUE(expectations_->OnLoadStart(browser, frame)) << "nav = " << nav_;
} }

View File

@@ -145,7 +145,8 @@ class HistoryNavRendererTest : public ClientAppRenderer::Delegate,
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
const NavListItem& item = kHNavList[nav_]; const NavListItem& item = kHNavList[nav_];
got_load_start_.yes(); got_load_start_.yes();
@@ -153,6 +154,8 @@ class HistoryNavRendererTest : public ClientAppRenderer::Delegate,
const std::string& url = frame->GetURL(); const std::string& url = frame->GetURL();
EXPECT_STREQ(item.target, url.c_str()); EXPECT_STREQ(item.target, url.c_str());
EXPECT_EQ(TT_EXPLICIT, transition_type);
EXPECT_EQ(item.can_go_back, browser->CanGoBack()); EXPECT_EQ(item.can_go_back, browser->CanGoBack());
EXPECT_EQ(item.can_go_forward, browser->CanGoForward()); EXPECT_EQ(item.can_go_forward, browser->CanGoForward());
} }
@@ -487,7 +490,8 @@ class HistoryNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
if(browser->IsPopup() || !frame->IsMain()) if(browser->IsPopup() || !frame->IsMain())
return; return;
@@ -495,6 +499,11 @@ class HistoryNavTestHandler : public TestHandler {
got_load_start_[nav_].yes(); got_load_start_[nav_].yes();
if (item.action == NA_LOAD)
EXPECT_EQ(TT_EXPLICIT, transition_type);
else if (item.action == NA_BACK || item.action == NA_FORWARD)
EXPECT_EQ(TT_EXPLICIT | TT_FORWARD_BACK_FLAG, transition_type);
std::string url1 = browser->GetMainFrame()->GetURL(); std::string url1 = browser->GetMainFrame()->GetURL();
std::string url2 = frame->GetURL(); std::string url2 = frame->GetURL();
if (url1 == item.target && url2 == item.target) if (url1 == item.target && url2 == item.target)
@@ -713,7 +722,12 @@ class RedirectSchemeHandler : public CefResourceHandler {
class RedirectSchemeHandlerFactory : public CefSchemeHandlerFactory { class RedirectSchemeHandlerFactory : public CefSchemeHandlerFactory {
public: public:
RedirectSchemeHandlerFactory() {} RedirectSchemeHandlerFactory() {
g_got_nav1_request = false;
g_got_nav3_request = false;
g_got_nav4_request = false;
g_got_invalid_request = false;
}
CefRefPtr<CefResourceHandler> Create( CefRefPtr<CefResourceHandler> Create(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
@@ -788,10 +802,13 @@ class RedirectTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
// Should only be called for the final loaded URL. // Should only be called for the final loaded URL.
std::string url = frame->GetURL(); std::string url = frame->GetURL();
EXPECT_EQ(TT_EXPLICIT, transition_type);
if (url == kRNav4) { if (url == kRNav4) {
got_nav4_load_start_.yes(); got_nav4_load_start_.yes();
} else { } else {
@@ -829,6 +846,41 @@ class RedirectTestHandler : public TestHandler {
IMPLEMENT_REFCOUNTING(RedirectTestHandler); IMPLEMENT_REFCOUNTING(RedirectTestHandler);
}; };
// Like above but destroy the WebContents while the redirect is in-progress.
class RedirectDestroyTestHandler : public TestHandler {
public:
RedirectDestroyTestHandler() {}
void RunTest() override {
// Create the browser.
CreateBrowser(kRNav1);
// Time out the test after a reasonable period of time.
SetTestTimeout();
}
void OnResourceRedirect(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefString& new_url) override {
const std::string& old_url = request->GetURL();
if (old_url == kRNav1 && new_url == kRNav2) {
// Called due to the nav1 redirect response.
got_nav1_redirect_.yes();
new_url = "about:blank";
// Destroy the test (and the underlying WebContents) while the redirect
// is still pending.
DestroyTest();
}
}
TrackCallback got_nav1_redirect_;
IMPLEMENT_REFCOUNTING(RedirectDestroyTestHandler);
};
} // namespace } // namespace
// Verify frame names and identifiers. // Verify frame names and identifiers.
@@ -864,6 +916,28 @@ TEST(NavigationTest, Redirect) {
ReleaseAndWaitForDestructor(handler); ReleaseAndWaitForDestructor(handler);
} }
// Verify that destroying the WebContents while the redirect is in-progress does
// not result in a crash.
TEST(NavigationTest, RedirectDestroy) {
CefRegisterSchemeHandlerFactory("http", "tests",
new RedirectSchemeHandlerFactory());
WaitForIOThread();
CefRefPtr<RedirectDestroyTestHandler> handler =
new RedirectDestroyTestHandler();
handler->ExecuteTest();
CefClearSchemeHandlerFactories();
WaitForIOThread();
ASSERT_TRUE(handler->got_nav1_redirect_);
ASSERT_TRUE(g_got_nav1_request);
ASSERT_FALSE(g_got_nav3_request);
ASSERT_FALSE(g_got_nav4_request);
ASSERT_FALSE(g_got_invalid_request);
ReleaseAndWaitForDestructor(handler);
}
namespace { namespace {
@@ -1136,7 +1210,8 @@ class OrderNavRendererTest : public ClientAppRenderer::Delegate,
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
EXPECT_TRUE(got_render_thread_created_); EXPECT_TRUE(got_render_thread_created_);
EXPECT_TRUE(got_webkit_initialized_); EXPECT_TRUE(got_webkit_initialized_);
@@ -1347,10 +1422,13 @@ class OrderNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
if (browser->IsPopup()) { if (browser->IsPopup()) {
EXPECT_EQ(TT_LINK, transition_type);
state_popup_.OnLoadStart(browser, frame); state_popup_.OnLoadStart(browser, frame);
} else { } else {
EXPECT_EQ(TT_EXPLICIT, transition_type);
state_main_.OnLoadStart(browser, frame); state_main_.OnLoadStart(browser, frame);
} }
} }
@@ -1790,10 +1868,16 @@ class LoadNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
EXPECT_GT(browser_id_current_, 0); EXPECT_GT(browser_id_current_, 0);
EXPECT_EQ(browser_id_current_, browser->GetIdentifier()); EXPECT_EQ(browser_id_current_, browser->GetIdentifier());
if (mode_ == LOAD || frame->GetURL() == kLoadNav1)
EXPECT_EQ(TT_EXPLICIT, transition_type);
else
EXPECT_EQ(TT_LINK, transition_type);
got_load_start_.yes(); got_load_start_.yes();
} }
@@ -2071,7 +2155,8 @@ class PopupNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
const std::string& url = frame->GetURL(); const std::string& url = frame->GetURL();
if (url == kPopupNavPageUrl) { if (url == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_start_); EXPECT_FALSE(got_load_start_);
@@ -2498,7 +2583,8 @@ class BrowseNavTestHandler : public TestHandler {
} }
void OnLoadStart(CefRefPtr<CefBrowser> browser, void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override { CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
const std::string& url = frame->GetURL(); const std::string& url = frame->GetURL();
EXPECT_STREQ(kBrowseNavPageUrl, url.c_str()); EXPECT_STREQ(kBrowseNavPageUrl, url.c_str());
EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); EXPECT_EQ(GetBrowserId(), browser->GetIdentifier());

View File

@@ -1,7 +1,7 @@
CONTENTS CONTENTS
-------- --------
Release Contains a release build of the cefclient sample application. Release Contains a release build of the sample application.
USAGE USAGE

View File

@@ -62,8 +62,3 @@ run but any related functionality may become broken or disabled.
* libGLESv2.dll * libGLESv2.dll
Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL
will not function. will not function.
* Windows Vista 64-bit sandbox support (32-bit distributions only)
* wow_helper.exe
Without this file the 32-bit build of CEF will not run on 64-bit Vista
machines with the sandbox enabled.

View File

@@ -133,7 +133,11 @@ def create_readme():
'the LICENSING section of this document for licensing terms and conditions.' 'the LICENSING section of this document for licensing terms and conditions.'
elif mode == 'client': elif mode == 'client':
distrib_type = 'Client' distrib_type = 'Client'
distrib_desc = 'This distribution contains a release build of the cefclient sample application\n' \ if platform == 'linux':
client_app = 'cefsimple'
else:
client_app = 'cefclient'
distrib_desc = 'This distribution contains a release build of the ' + client_app + ' sample application\n' \
'for the ' + platform_str + ' platform. Please see the LICENSING section of this document for\n' \ 'for the ' + platform_str + ' platform. Please see the LICENSING section of this document for\n' \
'licensing terms and conditions.' 'licensing terms and conditions.'
@@ -263,7 +267,7 @@ parser.add_option('--minimal',
help='include only release build binary files') help='include only release build binary files')
parser.add_option('--client', parser.add_option('--client',
action='store_true', dest='client', default=False, action='store_true', dest='client', default=False,
help='include only the cefclient application') help='include only the sample application')
parser.add_option('-q', '--quiet', parser.add_option('-q', '--quiet',
action='store_true', dest='quiet', default=False, action='store_true', dest='quiet', default=False,
help='do not output detailed status information') help='do not output detailed status information')
@@ -486,8 +490,6 @@ if platform == 'windows':
'snapshot_blob.bin', 'snapshot_blob.bin',
'widevinecdmadapter.dll', 'widevinecdmadapter.dll',
] ]
if not options.x64build:
binaries.append('wow_helper.exe')
out_dir = os.path.join(src_dir, 'out') out_dir = os.path.join(src_dir, 'out')
libcef_dll_file = 'libcef.dll.lib' libcef_dll_file = 'libcef.dll.lib'
@@ -704,7 +706,7 @@ elif platform == 'linux':
lib_dst_dir = os.path.join(dst_dir, lib_dir_name) lib_dst_dir = os.path.join(dst_dir, lib_dir_name)
make_dir(lib_dst_dir, options.quiet) make_dir(lib_dst_dir, options.quiet)
copy_file(libcef_path, lib_dst_dir, options.quiet) copy_file(libcef_path, lib_dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cefsimple'), dst_dir, options.quiet)
else: else:
copy_file(libcef_path, dst_dir, options.quiet) copy_file(libcef_path, dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'chrome_sandbox'), os.path.join(dst_dir, 'chrome-sandbox'), options.quiet) copy_file(os.path.join(build_dir, 'chrome_sandbox'), os.path.join(dst_dir, 'chrome-sandbox'), options.quiet)
@@ -718,7 +720,6 @@ elif platform == 'linux':
build_dir = valid_build_dir build_dir = valid_build_dir
if mode == 'client': if mode == 'client':
dst_dir = os.path.join(output_dir, 'Release') dst_dir = os.path.join(output_dir, 'Release')
copy_dir(os.path.join(build_dir, 'files'), os.path.join(dst_dir, 'files'), options.quiet)
else: else:
dst_dir = os.path.join(output_dir, 'Resources') dst_dir = os.path.join(output_dir, 'Resources')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)

View File

@@ -22,6 +22,7 @@ if "%ARGSOK%" == "F" (
:: In case vcvars is already provided via the environment. :: In case vcvars is already provided via the environment.
set vcvars="%CEF_VCVARS%" set vcvars="%CEF_VCVARS%"
if exist %vcvars% goto found_vcvars if exist %vcvars% goto found_vcvars
if %vcvars% == "none" goto found_vcvars
if "%1" == "win64" goto check_win64 if "%1" == "win64" goto check_win64
@@ -47,7 +48,7 @@ goto end
:found_vcvars :found_vcvars
echo vcvars: echo vcvars:
echo %vcvars% echo %vcvars%
call %vcvars% if not %vcvars% == "none" call %vcvars%
echo PATH: echo PATH:
echo %PATH% echo %PATH%