Compare commits

...

31 Commits
4638 ... 3202

Author SHA1 Message Date
Marshall Greenblatt
f061c231e6 Fix OSR accessibility tests (issue #2312) 2017-12-12 15:59:57 -05:00
Marshall Greenblatt
6adf85553e Fix crash database size calculation 2017-12-05 16:59:25 -05:00
Marshall Greenblatt
18a939d16b Fix accessibility information (issue #2312) 2017-12-04 14:18:52 -05:00
Marshall Greenblatt
e40b500177 macOS: Fix build of widevinecdmadapter.plugin (issue #2314) 2017-12-04 12:32:51 -05:00
amaitland
cd6b88f7e4 cmake: Don't require test projects with minimal distribution (issue #2169) 2017-11-30 19:39:46 -05:00
Tamas Lustyik
3669215da0 Making it possible to bridge C++ wrapper classes to C (issue #2311). 2017-11-28 11:59:17 -05:00
Tamas Lustyik
7a4b9a4f44 macOS: Added guard to previously overlooked C++ include (issue #2297) 2017-11-28 11:59:08 -05:00
Marshall Greenblatt
cd93b44380 cmake: Add v8_context_snapshot.bin binary file 2017-11-27 12:16:23 -05:00
Marshall Greenblatt
d665578c51 Enable Brotli encoding (issue #2303) 2017-11-15 17:23:58 -05:00
Lk Xf
a07174604d Allow inclusion of cef_application_mac.h from pure C/ObjC (issue #2297) 2017-11-15 14:58:23 -05:00
Marshall Greenblatt
cd829e9719 Update to Chromium version 62.0.3202.94 2017-11-14 19:52:25 -05:00
Marshall Greenblatt
b09552470c Linux: Fix missing ui::Service symbols while avoiding macOS build error (issue #2294) 2017-11-08 11:43:27 -05:00
Marshall Greenblatt
ab7e7f026f Update to Chromium version 62.0.3202.89 2017-11-07 17:52:41 -05:00
Marshall Greenblatt
9672a06796 Linux: Fix missing ui::Service symbols (issue #2294) 2017-11-03 14:57:34 -04:00
Marshall Greenblatt
700054b108 Windows: Add VS2017.4 build support 2017-11-01 16:24:16 -04:00
Marshall Greenblatt
858eae3fe5 cmake: Fix accidental version dependency break (issue #2293) 2017-11-01 16:23:21 -04:00
Marshall Greenblatt
28f27be9ca Update to Chromium version 62.0.3202.75 2017-10-31 22:48:51 -04:00
Marshall Greenblatt
d04a869149 Don't create 'GPUCache' and 'databases' directories when cache-path is unspecified (issue #2289) 2017-10-30 17:10:28 -04:00
Marshall Greenblatt
197494e4ae Windows: Add missing swiftshader binaries to distribution (issue #2291) 2017-10-30 14:42:12 -04:00
Marshall Greenblatt
c0182e05c3 macOS: Fix bundle structure in sample apps 2017-10-27 16:55:51 -04:00
Marshall Greenblatt
2a991c4018 Update to Chromium version 62.0.3202.62 2017-10-24 14:01:55 -04:00
Marshall Greenblatt
cd60f7c7be Add "win-rt-app" command-line flag to disable MITIGATION_STRICT_HANDLE_CHECKS
and avoid sandboxed renderer process crash in WinRT apps (issue #2274)
2017-09-29 11:20:05 +02:00
Marshall Greenblatt
531f5a30ef Add chrome.tabs.create API support (issue #1947) 2017-09-28 17:21:05 +02:00
Marshall Greenblatt
264fa662c4 Simplify PrefService initialization (issue #1947) 2017-09-25 15:16:01 +02:00
Marshall Greenblatt
157ad1d57d Linux: Fix client termination (issue #2268) 2017-09-21 16:07:38 +02:00
Marshall Greenblatt
f60fdc6d87 Fix task runner checking 2017-09-21 14:01:02 +02:00
Marshall Greenblatt
f23a512bed Windows: Add missing pe_image.lib to cef_sandbox.lib (issue #2266) 2017-09-20 11:33:44 +02:00
Kaustubh Vats
3789326a42 macOS: Fix horizontal scrolling with trackpad (issue #2261) 2017-09-13 13:05:13 -04:00
Ryan Shetley
ff8b4aa7b5 Add support for Chrome Storage Extension API (issue #1947)
- Supports chrome.storage.local and chrome.storage.sync
- chrome.storage.sync behaves identically to chrome.storage.local
2017-09-13 13:05:02 -04:00
Marshall Greenblatt
88ebd4373f Linux: Fix 32-bit build fails with ld.gold: internal error in get_section_contents, at icf.cc:467 (issue #2256) 2017-09-12 13:21:18 -04:00
Marshall Greenblatt
31e07ace1b Update to Chromium version 62.0.3202.9 2017-09-07 21:28:11 -04:00
77 changed files with 2173 additions and 209 deletions

View File

@@ -241,7 +241,7 @@ config("libcef_static_config") {
} }
# Target for building code that accesses Blink internals. Included from the # Target for building code that accesses Blink internals. Included from the
# //third_party/WebKit/Source/web target. # //third_party/WebKit/Source/controller target.
source_set("webkit_set") { source_set("webkit_set") {
sources = [ sources = [
"libcef/renderer/webkit_glue.cc", "libcef/renderer/webkit_glue.cc",
@@ -274,10 +274,10 @@ source_set("webkit_set") {
] ]
deps = [ deps = [
"//skia", "//services/network/public/interfaces",
"//third_party/icu",
"//third_party/boringssl", "//third_party/boringssl",
"//v8", "//third_party/icu",
"//third_party/WebKit/Source/core:core_generated",
] ]
} }
@@ -375,6 +375,8 @@ static_library("libcef_static") {
"libcef/browser/download_manager_delegate.h", "libcef/browser/download_manager_delegate.h",
"libcef/browser/extension_impl.cc", "libcef/browser/extension_impl.cc",
"libcef/browser/extension_impl.h", "libcef/browser/extension_impl.h",
"libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
"libcef/browser/extensions/api/tabs/tabs_api.cc", "libcef/browser/extensions/api/tabs/tabs_api.cc",
"libcef/browser/extensions/api/tabs/tabs_api.h", "libcef/browser/extensions/api/tabs/tabs_api.h",
"libcef/browser/extensions/browser_context_keyed_service_factories.cc", "libcef/browser/extensions/browser_context_keyed_service_factories.cc",
@@ -411,6 +413,10 @@ static_library("libcef_static") {
"libcef/browser/extensions/pdf_extension_util.h", "libcef/browser/extensions/pdf_extension_util.h",
"libcef/browser/extensions/pdf_web_contents_helper_client.cc", "libcef/browser/extensions/pdf_web_contents_helper_client.cc",
"libcef/browser/extensions/pdf_web_contents_helper_client.h", "libcef/browser/extensions/pdf_web_contents_helper_client.h",
"libcef/browser/extensions/value_store/cef_value_store.cc",
"libcef/browser/extensions/value_store/cef_value_store.h",
"libcef/browser/extensions/value_store/cef_value_store_factory.cc",
"libcef/browser/extensions/value_store/cef_value_store_factory.h",
"libcef/browser/file_dialog_runner.h", "libcef/browser/file_dialog_runner.h",
"libcef/browser/file_dialog_manager.cc", "libcef/browser/file_dialog_manager.cc",
"libcef/browser/file_dialog_manager.h", "libcef/browser/file_dialog_manager.h",
@@ -778,6 +784,7 @@ static_library("libcef_static") {
"//third_party/libxml", "//third_party/libxml",
"//third_party/WebKit/public:blink", "//third_party/WebKit/public:blink",
"//third_party/widevine/cdm:headers", "//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm:widevinecdmadapter",
"//third_party/icu", "//third_party/icu",
"//third_party/zlib:minizip", "//third_party/zlib:minizip",
"//tools/v8_context_snapshot:v8_context_snapshot", "//tools/v8_context_snapshot:v8_context_snapshot",
@@ -794,11 +801,6 @@ static_library("libcef_static") {
"//v8", "//v8",
] ]
if (!is_mac) {
# TODO(cef): Enable for Mac once Widevine build errors are resolved.
deps += [ "//third_party/widevine/cdm:widevinecdmadapter" ]
}
if (is_win) { if (is_win) {
sources += gypi_paths2.includes_win + [ sources += gypi_paths2.includes_win + [
"libcef/browser/browser_main_win.cc", "libcef/browser/browser_main_win.cc",
@@ -856,6 +858,7 @@ static_library("libcef_static") {
deps += [ deps += [
"//build/config/freetype", "//build/config/freetype",
"//services/ui:lib",
"//third_party/fontconfig", "//third_party/fontconfig",
] ]
} }
@@ -1354,8 +1357,7 @@ if (is_mac) {
"$root_out_dir/cef_extensions.pak", "$root_out_dir/cef_extensions.pak",
"$root_out_dir/devtools_resources.pak", "$root_out_dir/devtools_resources.pak",
"$root_out_dir/v8_context_snapshot.bin", "$root_out_dir/v8_context_snapshot.bin",
# TODO(cef): Restore this line once Widevine build errors are resolved. "$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
# "$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
] ]
public_deps = [ public_deps = [
@@ -1364,8 +1366,7 @@ if (is_mac) {
":pak_200_percent", ":pak_200_percent",
":pak_devtools", ":pak_devtools",
":pak_extensions", ":pak_extensions",
# TODO(cef): Restore this line once Widevine build errors are resolved. "//third_party/widevine/cdm:widevinecdmadapter",
# "//third_party/widevine/cdm:widevinecdmadapter",
"//tools/v8_context_snapshot:v8_context_snapshot", "//tools/v8_context_snapshot:v8_context_snapshot",
] ]
@@ -1541,7 +1542,7 @@ if (is_mac) {
] ]
outputs = [ outputs = [
"{{bundle_root_dir}}/Frameworks/{{source_file_part}}", "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
] ]
} }

View File

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

View File

@@ -199,10 +199,12 @@ add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
# Include application targets. # Include application targets.
# Comes from the <target>/CMakeLists.txt file in the current directory. # Comes from the <target>/CMakeLists.txt file in the current directory.
# TODO: Change these lines to match your project target when you copy this file. # TODO: Change these lines to match your project target when you copy this file.
add_subdirectory(tests/cefclient) if(EXISTS tests)
add_subdirectory(tests/cefsimple) add_subdirectory(tests/cefclient)
add_subdirectory(tests/gtest) add_subdirectory(tests/cefsimple)
add_subdirectory(tests/ceftests) add_subdirectory(tests/gtest)
add_subdirectory(tests/ceftests)
endif()
# Display configuration settings. # Display configuration settings.
PRINT_CEF_CONFIG() PRINT_CEF_CONFIG()

View File

@@ -431,6 +431,7 @@
'tests/ceftests/draggable_regions_unittest.cc', 'tests/ceftests/draggable_regions_unittest.cc',
'tests/ceftests/extensions/background_unittest.cc', 'tests/ceftests/extensions/background_unittest.cc',
'tests/ceftests/extensions/chrome_alarms_unittest.cc', 'tests/ceftests/extensions/chrome_alarms_unittest.cc',
'tests/ceftests/extensions/chrome_storage_unittest.cc',
'tests/ceftests/extensions/chrome_tabs_unittest.cc', 'tests/ceftests/extensions/chrome_tabs_unittest.cc',
'tests/ceftests/extensions/extension_test_handler.cc', 'tests/ceftests/extensions/extension_test_handler.cc',
'tests/ceftests/extensions/extension_test_handler.h', 'tests/ceftests/extensions/extension_test_handler.h',

View File

@@ -101,7 +101,19 @@ macro(COPY_FILES target file_list source_dir target_dir)
set(source_file ${source_dir}/${FILENAME}) set(source_file ${source_dir}/${FILENAME})
get_filename_component(target_name ${FILENAME} NAME) get_filename_component(target_name ${FILENAME} NAME)
set(target_file ${target_dir}/${target_name}) set(target_file ${target_dir}/${target_name})
if(IS_DIRECTORY ${source_file})
string(FIND ${source_file} "$<CONFIGURATION>" _pos)
if(NOT ${_pos} EQUAL -1)
# Must test with an actual configuration directory.
string(REPLACE "$<CONFIGURATION>" "Release" existing_source_file ${source_file})
if(NOT EXISTS ${existing_source_file})
string(REPLACE "$<CONFIGURATION>" "Debug" existing_source_file ${source_file})
endif()
else()
set(existing_source_file ${source_file})
endif()
if(IS_DIRECTORY ${existing_source_file})
add_custom_command( add_custom_command(
TARGET ${target} TARGET ${target}
POST_BUILD POST_BUILD

View File

@@ -199,6 +199,7 @@ if(OS_LINUX)
libcef.so libcef.so
natives_blob.bin natives_blob.bin
snapshot_blob.bin snapshot_blob.bin
v8_context_snapshot.bin
) )
# List of CEF resource files. # List of CEF resource files.
@@ -329,12 +330,20 @@ if(OS_WINDOWS)
# Configure use of the sandbox. # Configure use of the sandbox.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON) option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900 AND NOT MSVC_VERSION EQUAL 1910) if(USE_SANDBOX)
# The cef_sandbox.lib static library is currently built with VS2015, which # Check if the current MSVC version is compatible with the cef_sandbox.lib
# is compatible with VS2015 and VS2017. It will not link successfully with # static library.
# other VS versions. list(APPEND supported_msvc_versions
1900 # VS2015
1910 # VS2017 <= 15.2
1911 # VS2017 >= 15.3
)
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
if (${_index} EQUAL -1)
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
set(USE_SANDBOX OFF) set(USE_SANDBOX OFF)
endif() endif()
endif()
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385). # Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use") set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
@@ -415,6 +424,8 @@ if(OS_WINDOWS)
libGLESv2.dll libGLESv2.dll
natives_blob.bin natives_blob.bin
snapshot_blob.bin snapshot_blob.bin
v8_context_snapshot.bin
swiftshader
) )
# List of CEF resource files. # List of CEF resource files.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=b49f4c91db8eccdfe9ded503d8bb32ee0e433f60$ // $hash=b6311a69fc01fa19d3c49230f412a5963633ce27$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
@@ -129,6 +129,33 @@ typedef struct _cef_extension_handler_t {
struct _cef_client_t** client, struct _cef_client_t** client,
struct _cef_browser_settings_t* settings); struct _cef_browser_settings_t* settings);
///
// Called when an extension API (e.g. chrome.tabs.create) requests creation of
// a new browser. |extension| and |browser| are the source of the API call.
// |active_browser| may optionally be specified via the windowId property or
// returned via the get_active_browser() callback and provides the default
// |client| and |settings| values for the new browser. |index| is the position
// value optionally specified via the index property. |url| is the URL that
// will be loaded in the browser. |active| is true (1) if the new browser
// should be active when opened. To allow creation of the browser optionally
// modify |windowInfo|, |client| and |settings| and return false (0). To
// cancel creation of the browser return true (1). Successful creation will be
// indicated by a call to cef_life_span_handler_t::OnAfterCreated. Any
// modifications to |windowInfo| will be ignored if |active_browser| is
// wrapped in a cef_browser_view_t.
///
int(CEF_CALLBACK* on_before_browser)(
struct _cef_extension_handler_t* self,
struct _cef_extension_t* extension,
struct _cef_browser_t* browser,
struct _cef_browser_t* active_browser,
int index,
const cef_string_t* url,
int active,
struct _cef_window_info_t* windowInfo,
struct _cef_client_t** client,
struct _cef_browser_settings_t* settings);
/// ///
// Called when no tabId is specified to an extension API call that accepts a // Called when no tabId is specified to an extension API call that accepts a
// tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the // tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the

View File

@@ -31,7 +31,9 @@
#define CEF_INCLUDE_CEF_APPLICATION_MAC_H_ #define CEF_INCLUDE_CEF_APPLICATION_MAC_H_
#pragma once #pragma once
#ifdef __cplusplus
#include "include/cef_base.h" #include "include/cef_base.h"
#endif // __cplusplus
#if defined(OS_MACOSX) && defined(__OBJC__) #if defined(OS_MACOSX) && defined(__OBJC__)
@@ -82,6 +84,8 @@
@protocol CefAppProtocol<CrAppControlProtocol> @protocol CefAppProtocol<CrAppControlProtocol>
@end @end
#ifdef __cplusplus
// Controls the state of |isHandlingSendEvent| in the event loop so that it is // Controls the state of |isHandlingSendEvent| in the event loop so that it is
// reset properly. // reset properly.
class CefScopedSendingEvent { class CefScopedSendingEvent {
@@ -99,6 +103,8 @@ class CefScopedSendingEvent {
BOOL handling_; BOOL handling_;
}; };
#endif // __cplusplus
#endif // defined(OS_MACOSX) && defined(__OBJC__) #endif // defined(OS_MACOSX) && defined(__OBJC__)
#endif // CEF_INCLUDE_CEF_APPLICATION_MAC_H_ #endif // CEF_INCLUDE_CEF_APPLICATION_MAC_H_

View File

@@ -116,6 +116,33 @@ class CefExtensionHandler : public virtual CefBaseRefCounted {
return false; return false;
} }
///
// Called when an extension API (e.g. chrome.tabs.create) requests creation of
// a new browser. |extension| and |browser| are the source of the API call.
// |active_browser| may optionally be specified via the windowId property or
// returned via the GetActiveBrowser() callback and provides the default
// |client| and |settings| values for the new browser. |index| is the position
// value optionally specified via the index property. |url| is the URL that
// will be loaded in the browser. |active| is true if the new browser should
// be active when opened. To allow creation of the browser optionally modify
// |windowInfo|, |client| and |settings| and return false. To cancel creation
// of the browser return true. Successful creation will be indicated by a call
// to CefLifeSpanHandler::OnAfterCreated. Any modifications to |windowInfo|
// will be ignored if |active_browser| is wrapped in a CefBrowserView.
///
/*--cef()--*/
virtual bool OnBeforeBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefBrowser> active_browser,
int index,
const CefString& url,
bool active,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
return false;
}
/// ///
// Called when no tabId is specified to an extension API call that accepts a // Called when no tabId is specified to an extension API call that accepts a
// tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the // tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the

View File

@@ -265,17 +265,12 @@ void CefBrowserContextImpl::Initialize() {
CefString(&CefContext::Get()->settings().accept_language_list); CefString(&CefContext::Get()->settings().accept_language_list);
} }
// Initialize a temporary PrefService object that may be referenced during // Initialize the PrefService object.
// BrowserContextServices initialization. pref_service_ = browser_prefs::CreatePrefService(
pref_service_ = this, cache_path_, !!settings_.persist_user_preferences);
browser_prefs::CreatePrefService(this, base::FilePath(), false, true);
CefBrowserContext::Initialize(); CefBrowserContext::Initialize();
// Initialize the real PrefService object.
pref_service_ = browser_prefs::CreatePrefService(
this, cache_path_, !!settings_.persist_user_preferences, false);
// Initialize visited links management. // Initialize visited links management.
base::FilePath visited_link_path; base::FilePath visited_link_path;
if (!cache_path_.empty()) if (!cache_path_.empty())

View File

@@ -987,8 +987,7 @@ void CefBrowserHostImpl::SetAccessibilityState(
// In windowless mode set accessibility to TreeOnly mode. Else native // In windowless mode set accessibility to TreeOnly mode. Else native
// accessibility APIs, specific to each platform, are also created. // accessibility APIs, specific to each platform, are also created.
if (accessibility_state == STATE_ENABLED) { if (accessibility_state == STATE_ENABLED) {
accMode = accMode = IsWindowless() ? ui::kAXModeWebContentsOnly : ui::kAXModeComplete;
IsWindowless() ? ui::AXMode::kWebContents : ui::AXMode::kNativeAPIs;
} }
web_contents_impl->SetAccessibilityMode(accMode); web_contents_impl->SetAccessibilityMode(accMode);
} }

View File

@@ -14,6 +14,7 @@
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/request_impl.h" #include "libcef/common/request_impl.h"
#include "libcef/common/response_impl.h" #include "libcef/common/response_impl.h"
#include "libcef/common/task_runner_impl.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
@@ -75,7 +76,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread, base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread,
url_request_, scoped_refptr<net::IOBuffer>(buffer), url_request_, scoped_refptr<net::IOBuffer>(buffer),
num_bytes, callback, num_bytes, callback,
base::MessageLoop::current()->task_runner())); CefTaskRunnerImpl::GetCurrentTaskRunner()));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }
return num_bytes; return num_bytes;
@@ -135,7 +136,7 @@ class CefBrowserURLRequest::Context
request_(request), request_(request),
client_(client), client_(client),
request_context_(request_context), request_context_(request_context),
task_runner_(base::MessageLoop::current()->task_runner()), task_runner_(CefTaskRunnerImpl::GetCurrentTaskRunner()),
status_(UR_IO_PENDING), status_(UR_IO_PENDING),
error_code_(ERR_NONE), error_code_(ERR_NONE),
upload_data_size_(0), upload_data_size_(0),
@@ -391,7 +392,7 @@ CefURLFetcherDelegate::~CefURLFetcherDelegate() {}
void CefURLFetcherDelegate::OnURLFetchComplete(const net::URLFetcher* source) { void CefURLFetcherDelegate::OnURLFetchComplete(const net::URLFetcher* source) {
// Complete asynchronously so as not to delete the URLFetcher while it's still // Complete asynchronously so as not to delete the URLFetcher while it's still
// in the call stack. // in the call stack.
base::MessageLoop::current()->task_runner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&CefBrowserURLRequest::Context::OnComplete, context_)); base::Bind(&CefBrowserURLRequest::Context::OnComplete, context_));
} }

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/content_browser_client.h" #include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/net/network_delegate.h" #include "libcef/browser/net/network_delegate.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/common/time_util.h" #include "libcef/common/time_util.h"
#include "base/bind.h" #include "base/bind.h"
@@ -144,7 +145,7 @@ void CefCookieManagerImpl::GetCookieStore(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const CookieStoreCallback& callback) { const CookieStoreCallback& callback) {
if (!task_runner.get()) if (!task_runner.get())
task_runner = base::MessageLoop::current()->task_runner(); task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
if (!CEF_CURRENTLY_ON_IOT()) { if (!CEF_CURRENTLY_ON_IOT()) {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefCookieManagerImpl::GetCookieStore, CEF_POST_TASK(CEF_IOT, base::Bind(&CefCookieManagerImpl::GetCookieStore,

View File

@@ -0,0 +1,97 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/extensions/api/storage/sync_value_store_cache.h"
#include <stddef.h>
#include <limits>
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/backend_task_runner.h"
#include "extensions/browser/api/storage/weak_unlimited_settings_storage.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/api/storage.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permissions_data.h"
using content::BrowserThread;
namespace extensions {
namespace cef {
namespace {
// Returns the quota limit for local storage, taken from the schema in
// extensions/common/api/storage.json.
SettingsStorageQuotaEnforcer::Limits GetLocalQuotaLimits() {
SettingsStorageQuotaEnforcer::Limits limits = {
static_cast<size_t>(api::storage::local::QUOTA_BYTES),
std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max()};
return limits;
}
} // namespace
SyncValueStoreCache::SyncValueStoreCache(
const scoped_refptr<ValueStoreFactory>& factory)
: storage_factory_(factory), quota_(GetLocalQuotaLimits()) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
SyncValueStoreCache::~SyncValueStoreCache() {
DCHECK(IsOnBackendSequence());
}
void SyncValueStoreCache::RunWithValueStoreForExtension(
const StorageCallback& callback,
scoped_refptr<const Extension> extension) {
DCHECK(IsOnBackendSequence());
ValueStore* storage = GetStorage(extension.get());
// A neat way to implement unlimited storage; if the extension has the
// unlimited storage permission, force through all calls to Set().
if (extension->permissions_data()->HasAPIPermission(
APIPermission::kUnlimitedStorage)) {
WeakUnlimitedSettingsStorage unlimited_storage(storage);
callback.Run(&unlimited_storage);
} else {
callback.Run(storage);
}
}
void SyncValueStoreCache::DeleteStorageSoon(const std::string& extension_id) {
DCHECK(IsOnBackendSequence());
storage_map_.erase(extension_id);
storage_factory_->DeleteSettings(settings_namespace::SYNC,
ValueStoreFactory::ModelType::APP,
extension_id);
storage_factory_->DeleteSettings(settings_namespace::SYNC,
ValueStoreFactory::ModelType::EXTENSION,
extension_id);
}
ValueStore* SyncValueStoreCache::GetStorage(const Extension* extension) {
StorageMap::iterator iter = storage_map_.find(extension->id());
if (iter != storage_map_.end())
return iter->second.get();
ValueStoreFactory::ModelType model_type =
extension->is_app() ? ValueStoreFactory::ModelType::APP
: ValueStoreFactory::ModelType::EXTENSION;
std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore(
settings_namespace::SYNC, model_type, extension->id());
std::unique_ptr<SettingsStorageQuotaEnforcer> storage(
new SettingsStorageQuotaEnforcer(quota_, std::move(store)));
DCHECK(storage.get());
ValueStore* storage_ptr = storage.get();
storage_map_[extension->id()] = std::move(storage);
return storage_ptr;
}
} // namespace cef
} // namespace extensions

View File

@@ -0,0 +1,56 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
#include <memory>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/value_store_cache.h"
namespace extensions {
class ValueStoreFactory;
namespace cef {
// Based on LocalValueStoreCache
// ValueStoreCache for the SYNC namespace. It owns a backend for apps and
// another for extensions. Each backend takes care of persistence.
class SyncValueStoreCache : public ValueStoreCache {
public:
explicit SyncValueStoreCache(const scoped_refptr<ValueStoreFactory>& factory);
~SyncValueStoreCache() override;
// ValueStoreCache implementation:
void RunWithValueStoreForExtension(
const StorageCallback& callback,
scoped_refptr<const Extension> extension) override;
void DeleteStorageSoon(const std::string& extension_id) override;
private:
using StorageMap = std::map<std::string, std::unique_ptr<ValueStore>>;
ValueStore* GetStorage(const Extension* extension);
// The Factory to use for creating new ValueStores.
const scoped_refptr<ValueStoreFactory> storage_factory_;
// Quota limits (see SettingsStorageQuotaEnforcer).
const SettingsStorageQuotaEnforcer::Limits quota_;
// The collection of ValueStores for local storage.
StorageMap storage_map_;
DISALLOW_COPY_AND_ASSIGN(SyncValueStoreCache);
};
} // namespace cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_

View File

@@ -52,12 +52,49 @@ void ZoomModeToZoomSettings(zoom::ZoomController::ZoomMode zoom_mode,
} }
} }
template <typename T>
void AssignOptionalValue(const std::unique_ptr<T>& source,
std::unique_ptr<T>& destination) {
if (source.get()) {
destination.reset(new T(*source));
}
}
} // namespace } // namespace
ExtensionFunction::ResponseAction TabsGetFunction::Run() { ExtensionFunction::ResponseAction TabsGetFunction::Run() {
return RespondNow(Error(kNotImplementedError)); return RespondNow(Error(kNotImplementedError));
} }
TabsCreateFunction::TabsCreateFunction() : cef_details_(this) {}
ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
std::unique_ptr<tabs::Create::Params> params(
tabs::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
CefExtensionFunctionDetails::OpenTabParams options;
AssignOptionalValue(params->create_properties.window_id, options.window_id);
AssignOptionalValue(params->create_properties.opener_tab_id,
options.opener_tab_id);
AssignOptionalValue(params->create_properties.selected, options.active);
// The 'active' property has replaced the 'selected' property.
AssignOptionalValue(params->create_properties.active, options.active);
AssignOptionalValue(params->create_properties.pinned, options.pinned);
AssignOptionalValue(params->create_properties.index, options.index);
AssignOptionalValue(params->create_properties.url, options.url);
std::string error;
std::unique_ptr<base::DictionaryValue> result(
cef_details_.OpenTab(options, user_gesture(), &error));
if (!result)
return RespondNow(Error(error));
// Return data about the newly created tab.
return RespondNow(has_callback() ? OneArgument(std::move(result))
: NoArguments());
}
ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() ExecuteCodeInTabFunction::ExecuteCodeInTabFunction()
: cef_details_(this), execute_tab_id_(-1) {} : cef_details_(this), execute_tab_id_(-1) {}

View File

@@ -29,6 +29,19 @@ class TabsGetFunction : public UIThreadExtensionFunction {
DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET) DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET)
}; };
class TabsCreateFunction : public UIThreadExtensionFunction {
public:
TabsCreateFunction();
~TabsCreateFunction() override {}
ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.create", TABS_CREATE)
private:
const CefExtensionFunctionDetails cef_details_;
};
// Implement API call tabs.executeScript and tabs.insertCSS. // Implement API call tabs.executeScript and tabs.insertCSS.
class ExecuteCodeInTabFunction : public ExecuteCodeFunction { class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
public: public:

View File

@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "extensions/browser/api/alarms/alarm_manager.h" #include "extensions/browser/api/alarms/alarm_manager.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/renderer_startup_helper.h" #include "extensions/browser/renderer_startup_helper.h"
namespace extensions { namespace extensions {
@@ -18,6 +19,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
CookieSettingsFactory::GetInstance(); CookieSettingsFactory::GetInstance();
PrefsTabHelper::GetServiceInstance(); PrefsTabHelper::GetServiceInstance();
RendererStartupHelperFactory::GetInstance(); RendererStartupHelperFactory::GetInstance();
StorageFrontend::GetFactoryInstance();
StreamsPrivateAPI::GetFactoryInstance(); StreamsPrivateAPI::GetFactoryInstance();
} }

View File

@@ -137,7 +137,7 @@ CefRefPtr<CefBrowserHostImpl> GetBrowserForTabId(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK(browser_context); DCHECK(browser_context);
if (tab_id == -1 || !browser_context) if (tab_id < 0 || !browser_context)
return nullptr; return nullptr;
CefBrowserContextImpl* browser_context_impl = CefBrowserContextImpl* browser_context_impl =

View File

@@ -53,7 +53,7 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForHost(
bool* is_guest_view); bool* is_guest_view);
// Returns the browser matching |tab_id| and |browser_context|. Returns false if // Returns the browser matching |tab_id| and |browser_context|. Returns false if
// |tab_id| is -1 or a matching browser cannot be found within // |tab_id| is < 0 or a matching browser cannot be found within
// |browser_context|. Similar in concept to ExtensionTabUtil::GetTabById. // |browser_context|. Similar in concept to ExtensionTabUtil::GetTabById.
CefRefPtr<CefBrowserHostImpl> GetBrowserForTabId( CefRefPtr<CefBrowserHostImpl> GetBrowserForTabId(
int tab_id, int tab_id,

View File

@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h" #include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "extensions/browser/api/alarms/alarms_api.h" #include "extensions/browser/api/alarms/alarms_api.h"
#include "extensions/browser/api/storage/storage_api.h"
#include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_function_registry.h"
namespace extensions { namespace extensions {
@@ -36,8 +37,15 @@ const char* const kSupportedAPIs[] = {
EXTENSION_FUNCTION_NAME(AlarmsGetAllFunction), EXTENSION_FUNCTION_NAME(AlarmsGetAllFunction),
EXTENSION_FUNCTION_NAME(AlarmsClearFunction), EXTENSION_FUNCTION_NAME(AlarmsClearFunction),
EXTENSION_FUNCTION_NAME(AlarmsClearAllFunction), EXTENSION_FUNCTION_NAME(AlarmsClearAllFunction),
"storage",
EXTENSION_FUNCTION_NAME(StorageStorageAreaGetFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaSetFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaRemoveFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaClearFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaGetBytesInUseFunction),
"tabs", "tabs",
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsCreateFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsInsertCSSFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsInsertCSSFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction),
@@ -67,9 +75,15 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<AlarmsGetAllFunction>(); registry->RegisterFunction<AlarmsGetAllFunction>();
registry->RegisterFunction<AlarmsClearFunction>(); registry->RegisterFunction<AlarmsClearFunction>();
registry->RegisterFunction<AlarmsClearAllFunction>(); registry->RegisterFunction<AlarmsClearAllFunction>();
registry->RegisterFunction<StorageStorageAreaGetFunction>();
registry->RegisterFunction<StorageStorageAreaSetFunction>();
registry->RegisterFunction<StorageStorageAreaRemoveFunction>();
registry->RegisterFunction<StorageStorageAreaClearFunction>();
registry->RegisterFunction<StorageStorageAreaGetBytesInUseFunction>();
registry->RegisterFunction<cefimpl::TabsExecuteScriptFunction>(); registry->RegisterFunction<cefimpl::TabsExecuteScriptFunction>();
registry->RegisterFunction<cefimpl::TabsInsertCSSFunction>(); registry->RegisterFunction<cefimpl::TabsInsertCSSFunction>();
registry->RegisterFunction<cefimpl::TabsGetFunction>(); registry->RegisterFunction<cefimpl::TabsGetFunction>();
registry->RegisterFunction<cefimpl::TabsCreateFunction>();
registry->RegisterFunction<cefimpl::TabsSetZoomFunction>(); registry->RegisterFunction<cefimpl::TabsSetZoomFunction>();
registry->RegisterFunction<cefimpl::TabsGetZoomFunction>(); registry->RegisterFunction<cefimpl::TabsGetZoomFunction>();
registry->RegisterFunction<cefimpl::TabsSetZoomSettingsFunction>(); registry->RegisterFunction<cefimpl::TabsSetZoomSettingsFunction>();

View File

@@ -7,11 +7,16 @@
#include "libcef/browser/browser_context_impl.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/navigate_params.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "extensions/browser/extension_function.h" #include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/common/error_utils.h" #include "extensions/common/error_utils.h"
@@ -208,13 +213,12 @@ CefRefPtr<CefBrowserHostImpl>
CefExtensionFunctionDetails::GetBrowserForTabIdFirstTime( CefExtensionFunctionDetails::GetBrowserForTabIdFirstTime(
int tab_id, int tab_id,
std::string* error_message) const { std::string* error_message) const {
DCHECK_GE(tab_id, -1);
DCHECK(!get_browser_called_first_time_); DCHECK(!get_browser_called_first_time_);
get_browser_called_first_time_ = true; get_browser_called_first_time_ = true;
CefRefPtr<CefBrowserHostImpl> browser; CefRefPtr<CefBrowserHostImpl> browser;
if (tab_id != -1) { if (tab_id >= 0) {
// May be an invalid tabId or in the wrong BrowserContext. // May be an invalid tabId or in the wrong BrowserContext.
browser = GetBrowserForTabId(tab_id, function_->browser_context()); browser = GetBrowserForTabId(tab_id, function_->browser_context());
if (!browser || !browser->web_contents() || !CanAccessBrowser(browser)) { if (!browser || !browser->web_contents() || !CanAccessBrowser(browser)) {
@@ -277,6 +281,184 @@ bool CefExtensionFunctionDetails::LoadFile(const std::string& file,
return false; return false;
} }
CefExtensionFunctionDetails::OpenTabParams::OpenTabParams() {}
CefExtensionFunctionDetails::OpenTabParams::~OpenTabParams() {}
base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
const OpenTabParams& params,
bool user_gesture,
std::string* error_message) const {
CefRefPtr<CefBrowserHostImpl> sender_browser = GetSenderBrowser();
if (!sender_browser)
return nullptr;
// windowId defaults to "current" window.
int window_id = extension_misc::kCurrentWindowId;
if (params.window_id.get())
window_id = *params.window_id;
// CEF doesn't have the concept of windows containing tab strips so we'll
// select an "active browser" for BrowserContext sharing instead.
CefRefPtr<CefBrowserHostImpl> active_browser =
GetBrowserForTabIdFirstTime(window_id, error_message);
if (!active_browser)
return nullptr;
// If an opener browser was specified then we expect it to exist.
int opener_browser_id = -1;
if (params.opener_tab_id.get() && *params.opener_tab_id >= 0) {
if (GetBrowserForTabIdAgain(*params.opener_tab_id, error_message)) {
opener_browser_id = *params.opener_tab_id;
} else {
return nullptr;
}
}
GURL url;
if (params.url.get()) {
std::string url_string = *params.url;
url = ExtensionTabUtil::ResolvePossiblyRelativeURL(url_string,
function()->extension());
if (!url.is_valid()) {
if (error_message) {
*error_message =
ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string);
}
return nullptr;
}
}
// Don't let extensions crash the browser or renderers.
if (ExtensionTabUtil::IsKillURL(url)) {
if (error_message)
*error_message = keys::kNoCrashBrowserError;
return nullptr;
}
// Default to foreground for the new tab. The presence of 'active' property
// will override this default.
bool active = true;
if (params.active.get())
active = *params.active;
// CEF doesn't use the index value but we let the client see/modify it.
int index = 0;
if (params.index.get())
index = *params.index;
CefBrowserContextImpl* browser_context_impl =
CefBrowserContextImpl::GetForContext(active_browser->GetBrowserContext());
// A CEF representation should always exist.
CefRefPtr<CefExtension> cef_extension =
browser_context_impl->extension_system()->GetExtension(
function()->extension()->id());
DCHECK(cef_extension);
if (!cef_extension)
return nullptr;
// Always use the same request context that the extension was registered with.
// May represent an *Impl or *Proxy BrowserContext.
// GetLoaderContext() will return NULL for internal extensions.
CefRefPtr<CefRequestContext> request_context =
cef_extension->GetLoaderContext();
if (!request_context)
return nullptr;
CefBrowserHostImpl::CreateParams create_params;
create_params.url = url;
create_params.request_context = request_context;
create_params.window_info.reset(new CefWindowInfo);
#if defined(OS_WIN)
create_params.window_info->SetAsPopup(NULL, CefString());
#endif
// Start with the active browser's settings.
create_params.client = active_browser->GetClient();
create_params.settings = active_browser->settings();
CefRefPtr<CefExtensionHandler> handler = cef_extension->GetHandler();
if (handler.get() &&
handler->OnBeforeBrowser(cef_extension, sender_browser.get(),
active_browser.get(), index, url.spec(), active,
*create_params.window_info, create_params.client,
create_params.settings)) {
// Cancel the browser creation.
return nullptr;
}
if (active_browser->IsViewsHosted()) {
// The new browser will also be Views hosted.
create_params.window_info.reset();
}
// Browser creation may fail under certain rare circumstances.
CefRefPtr<CefBrowserHostImpl> new_browser =
CefBrowserHostImpl::Create(create_params);
if (!new_browser)
return nullptr;
// Return data about the newly created tab.
auto result = CreateTabObject(new_browser, opener_browser_id, active, index);
ExtensionTabUtil::ScrubTabForExtension(
function()->extension(), new_browser->web_contents(), result.get());
return result->ToValue().release();
}
std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
CefRefPtr<CefBrowserHostImpl> new_browser,
int opener_browser_id,
bool active,
int index) const {
content::WebContents* contents = new_browser->web_contents();
bool is_loading = contents->IsLoading();
auto tab_object = base::MakeUnique<api::tabs::Tab>();
tab_object->id = base::MakeUnique<int>(new_browser->GetIdentifier());
tab_object->index = index;
tab_object->window_id = *tab_object->id;
tab_object->status = base::MakeUnique<std::string>(
is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete);
tab_object->active = active;
tab_object->selected = true;
tab_object->highlighted = true;
tab_object->pinned = false;
tab_object->audible = base::MakeUnique<bool>(contents->WasRecentlyAudible());
tab_object->discarded = false;
tab_object->auto_discardable = false;
tab_object->muted_info = CreateMutedInfo(contents);
tab_object->incognito = false;
gfx::Size contents_size = contents->GetContainerBounds().size();
tab_object->width = base::MakeUnique<int>(contents_size.width());
tab_object->height = base::MakeUnique<int>(contents_size.height());
tab_object->url = base::MakeUnique<std::string>(contents->GetURL().spec());
tab_object->title =
base::MakeUnique<std::string>(base::UTF16ToUTF8(contents->GetTitle()));
content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
if (entry && entry->GetFavicon().valid) {
tab_object->fav_icon_url =
base::MakeUnique<std::string>(entry->GetFavicon().url.spec());
}
if (opener_browser_id >= 0)
tab_object->opener_tab_id = base::MakeUnique<int>(opener_browser_id);
return tab_object;
}
// static
std::unique_ptr<api::tabs::MutedInfo>
CefExtensionFunctionDetails::CreateMutedInfo(content::WebContents* contents) {
DCHECK(contents);
std::unique_ptr<api::tabs::MutedInfo> info(new api::tabs::MutedInfo);
info->muted = contents->IsAudioMuted();
// TODO(cef): Maybe populate |info->reason|.
return info;
}
CefRefPtr<CefExtension> CefExtensionFunctionDetails::GetCefExtension() const { CefRefPtr<CefExtension> CefExtensionFunctionDetails::GetCefExtension() const {
if (!cef_extension_) { if (!cef_extension_) {
cef_extension_ = cef_extension_ =

View File

@@ -11,6 +11,7 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/common/extensions/api/tabs.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
class Profile; class Profile;
@@ -64,7 +65,7 @@ class CefExtensionFunctionDetails {
bool CanAccessBrowser(CefRefPtr<CefBrowserHostImpl> target) const; bool CanAccessBrowser(CefRefPtr<CefBrowserHostImpl> target) const;
// Returns the browser matching |tab_id| or NULL if the browser cannot be // Returns the browser matching |tab_id| or NULL if the browser cannot be
// found or does not have a WebContents. If |tab_id| is -1 the "current" // found or does not have a WebContents. If |tab_id| is < 0 the "current"
// browser will be returned. |error_message| can optionally be passed in and // browser will be returned. |error_message| can optionally be passed in and
// will be set with an appropriate message on error. This method should only // will be set with an appropriate message on error. This method should only
// be called one time per extension function and will check all necessary // be called one time per extension function and will check all necessary
@@ -89,6 +90,40 @@ class CefExtensionFunctionDetails {
base::OnceCallback<void(std::unique_ptr<std::string>)>; base::OnceCallback<void(std::unique_ptr<std::string>)>;
bool LoadFile(const std::string& file, LoadFileCallback callback) const; bool LoadFile(const std::string& file, LoadFileCallback callback) const;
struct OpenTabParams {
OpenTabParams();
~OpenTabParams();
std::unique_ptr<int> window_id;
std::unique_ptr<int> opener_tab_id;
std::unique_ptr<std::string> url;
std::unique_ptr<bool> active;
std::unique_ptr<bool> pinned;
std::unique_ptr<int> index;
};
// Opens a new tab given creation parameters |params|. Returns a Tab object
// if successful, or NULL and optionally sets |error_message| if an error
// occurs.
base::DictionaryValue* OpenTab(const OpenTabParams& params,
bool user_gesture,
std::string* error_message) const;
// Creates a Tab object (see chrome/common/extensions/api/tabs.json) with
// information about the state of a browser tab. Depending on the
// permissions of the extension, the object may or may not include sensitive
// data such as the tab's URL.
std::unique_ptr<api::tabs::Tab> CreateTabObject(
CefRefPtr<CefBrowserHostImpl> new_browser,
int opener_browser_id,
bool active,
int index) const;
// Creates a tab MutedInfo object (see chrome/common/extensions/api/tabs.json)
// with information about the mute state of a browser tab.
static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo(
content::WebContents* contents);
// Returns a pointer to the associated UIThreadExtensionFunction // Returns a pointer to the associated UIThreadExtensionFunction
UIThreadExtensionFunction* function() { return function_; } UIThreadExtensionFunction* function() { return function_; }
const UIThreadExtensionFunction* function() const { return function_; } const UIThreadExtensionFunction* function() const { return function_; }

View File

@@ -9,6 +9,7 @@
#include "libcef/browser/extension_impl.h" #include "libcef/browser/extension_impl.h"
#include "libcef/browser/extensions/pdf_extension_util.h" #include "libcef/browser/extensions/pdf_extension_util.h"
#include "libcef/browser/extensions/value_store/cef_value_store_factory.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
@@ -21,6 +22,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "components/crx_file/id_util.h" #include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
@@ -40,7 +42,7 @@
#include "extensions/browser/renderer_startup_helper.h" #include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/runtime_data.h" #include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h" #include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/value_store/value_store_factory.h" #include "extensions/browser/state_store.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h" #include "extensions/common/extension_messages.h"
#include "extensions/common/file_util.h" #include "extensions/common/file_util.h"
@@ -153,7 +155,9 @@ CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
renderer_helper_( renderer_helper_(
extensions::RendererStartupHelperFactory::GetForBrowserContext( extensions::RendererStartupHelperFactory::GetForBrowserContext(
browser_context)), browser_context)),
weak_ptr_factory_(this) {} weak_ptr_factory_(this) {
InitPrefs();
}
CefExtensionSystem::~CefExtensionSystem() {} CefExtensionSystem::~CefExtensionSystem() {}
@@ -384,15 +388,15 @@ SharedUserScriptMaster* CefExtensionSystem::shared_user_script_master() {
} }
StateStore* CefExtensionSystem::state_store() { StateStore* CefExtensionSystem::state_store() {
return nullptr; return state_store_.get();
} }
StateStore* CefExtensionSystem::rules_store() { StateStore* CefExtensionSystem::rules_store() {
return nullptr; return rules_store_.get();
} }
scoped_refptr<ValueStoreFactory> CefExtensionSystem::store_factory() { scoped_refptr<ValueStoreFactory> CefExtensionSystem::store_factory() {
return nullptr; return store_factory_;
} }
InfoMap* CefExtensionSystem::info_map() { InfoMap* CefExtensionSystem::info_map() {
@@ -467,6 +471,21 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
} }
} }
void CefExtensionSystem::InitPrefs() {
store_factory_ = new CefValueStoreFactory(browser_context_->GetPath());
Profile* profile = Profile::FromBrowserContext(browser_context_);
// Two state stores. The latter, which contains declarative rules, must be
// loaded immediately so that the rules are ready before we issue network
// requests.
state_store_.reset(new StateStore(
profile, store_factory_, ValueStoreFrontend::BackendType::STATE, true));
rules_store_.reset(new StateStore(
profile, store_factory_, ValueStoreFrontend::BackendType::RULES, false));
}
// Implementation based on ComponentLoader::CreateExtension. // Implementation based on ComponentLoader::CreateExtension.
scoped_refptr<const Extension> CefExtensionSystem::CreateExtension( scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
const ComponentExtensionInfo& info, const ComponentExtensionInfo& info,

View File

@@ -116,6 +116,8 @@ class CefExtensionSystem : public ExtensionSystem {
bool initialized() const { return initialized_; } bool initialized() const { return initialized_; }
private: private:
virtual void InitPrefs();
// Information about a registered component extension. // Information about a registered component extension.
struct ComponentExtensionInfo { struct ComponentExtensionInfo {
ComponentExtensionInfo(const base::DictionaryValue* manifest, ComponentExtensionInfo(const base::DictionaryValue* manifest,
@@ -169,6 +171,10 @@ class CefExtensionSystem : public ExtensionSystem {
std::unique_ptr<QuotaService> quota_service_; std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<AppSorting> app_sorting_; std::unique_ptr<AppSorting> app_sorting_;
std::unique_ptr<StateStore> state_store_;
std::unique_ptr<StateStore> rules_store_;
scoped_refptr<ValueStoreFactory> store_factory_;
// Signaled when the extension system has completed its startup tasks. // Signaled when the extension system has completed its startup tasks.
OneShotEvent ready_; OneShotEvent ready_;

View File

@@ -7,6 +7,7 @@
#include "include/internal/cef_types_wrappers.h" #include "include/internal/cef_types_wrappers.h"
#include "libcef/browser/browser_context_impl.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/extensions/api/storage/sync_value_store_cache.h"
#include "libcef/browser/extensions/extension_web_contents_observer.h" #include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "libcef/browser/extensions/mime_handler_view_guest_delegate.h" #include "libcef/browser/extensions/mime_handler_view_guest_delegate.h"
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h" #include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
@@ -66,4 +67,17 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
zoom::ZoomController::CreateForWebContents(web_contents); zoom::ZoomController::CreateForWebContents(web_contents);
} }
void CefExtensionsAPIClient::AddAdditionalValueStoreCaches(
content::BrowserContext* context,
const scoped_refptr<ValueStoreFactory>& factory,
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
observers,
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
// Add support for chrome.storage.sync.
// Because we don't support syncing with Google, we follow the behavior of
// chrome.storage.sync as if Chrome were permanently offline, by using a local
// store see: https://developer.chrome.com/apps/storage for more information
(*caches)[settings_namespace::SYNC] = new cef::SyncValueStoreCache(factory);
}
} // namespace extensions } // namespace extensions

View File

@@ -24,6 +24,18 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
MimeHandlerViewGuest* guest) const override; MimeHandlerViewGuest* guest) const override;
void AttachWebContentsHelpers( void AttachWebContentsHelpers(
content::WebContents* web_contents) const override; content::WebContents* web_contents) const override;
// Storage API support.
// Add any additional value store caches (e.g. for chrome.storage.managed)
// to |caches|. By default adds nothing.
void AddAdditionalValueStoreCaches(
content::BrowserContext* context,
const scoped_refptr<ValueStoreFactory>& factory,
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
observers,
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches)
override;
}; };
} // namespace extensions } // namespace extensions

View File

@@ -0,0 +1,110 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/extensions/value_store/cef_value_store.h"
#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
CefValueStore::~CefValueStore() {}
size_t CefValueStore::GetBytesInUse(const std::string& key) {
// Let SettingsStorageQuotaEnforcer implement this.
NOTREACHED();
return 0;
}
size_t CefValueStore::GetBytesInUse(const std::vector<std::string>& keys) {
// Let SettingsStorageQuotaEnforcer implement this.
NOTREACHED();
return 0;
}
size_t CefValueStore::GetBytesInUse() {
// Let SettingsStorageQuotaEnforcer implement this.
NOTREACHED();
return 0;
}
ValueStore::ReadResult CefValueStore::Get(const std::string& key) {
return Get(std::vector<std::string>(1, key));
}
ValueStore::ReadResult CefValueStore::Get(
const std::vector<std::string>& keys) {
read_count_++;
base::DictionaryValue* settings = new base::DictionaryValue();
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
base::Value* value = NULL;
if (storage_.GetWithoutPathExpansion(*it, &value)) {
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
}
}
return MakeReadResult(base::WrapUnique(settings), status_);
}
ValueStore::ReadResult CefValueStore::Get() {
read_count_++;
return MakeReadResult(storage_.CreateDeepCopy(), status_);
}
ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
const std::string& key,
const base::Value& value) {
base::DictionaryValue settings;
settings.SetWithoutPathExpansion(key, value.CreateDeepCopy());
return Set(options, settings);
}
ValueStore::WriteResult CefValueStore::Set(
WriteOptions options,
const base::DictionaryValue& settings) {
write_count_++;
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
it.Advance()) {
base::Value* old_value = NULL;
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
!old_value->Equals(&it.value())) {
changes->push_back(ValueStoreChange(
it.key(), old_value ? old_value->CreateDeepCopy() : nullptr,
it.value().CreateDeepCopy()));
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
return MakeWriteResult(std::move(changes), status_);
}
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
return Remove(std::vector<std::string>(1, key));
}
ValueStore::WriteResult CefValueStore::Remove(
const std::vector<std::string>& keys) {
write_count_++;
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
std::unique_ptr<base::Value> old_value;
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
}
}
return MakeWriteResult(std::move(changes), status_);
}
ValueStore::WriteResult CefValueStore::Clear() {
std::vector<std::string> keys;
for (base::DictionaryValue::Iterator it(storage_); !it.IsAtEnd();
it.Advance()) {
keys.push_back(it.key());
}
return Remove(keys);
}

View File

@@ -0,0 +1,59 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_H_
#include <stddef.h>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "extensions/browser/value_store/value_store.h"
// Implementation Based on TestingValueStore
// ValueStore with an in-memory storage but the ability to
// optionally fail all operations.
class CefValueStore : public ValueStore {
public:
CefValueStore();
~CefValueStore() override;
// Accessors for the number of reads/writes done by this value store. Each
// Get* operation (except for the BytesInUse ones) counts as one read, and
// each Set*/Remove/Clear operation counts as one write. This is useful in
// tests seeking to assert that some number of reads/writes to their
// underlying value store have (or have not) happened.
int read_count() const { return read_count_; }
int write_count() const { return write_count_; }
// ValueStore implementation.
size_t GetBytesInUse(const std::string& key) override;
size_t GetBytesInUse(const std::vector<std::string>& keys) override;
size_t GetBytesInUse() override;
ReadResult Get(const std::string& key) override;
ReadResult Get(const std::vector<std::string>& keys) override;
ReadResult Get() override;
WriteResult Set(WriteOptions options,
const std::string& key,
const base::Value& value) override;
WriteResult Set(WriteOptions options,
const base::DictionaryValue& values) override;
WriteResult Remove(const std::string& key) override;
WriteResult Remove(const std::vector<std::string>& keys) override;
WriteResult Clear() override;
private:
base::DictionaryValue storage_;
int read_count_;
int write_count_;
ValueStore::Status status_;
DISALLOW_COPY_AND_ASSIGN(CefValueStore);
};
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_H_

View File

@@ -0,0 +1,191 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/extensions/value_store/cef_value_store_factory.h"
#include "base/memory/ptr_util.h"
#include "extensions/browser/value_store/leveldb_value_store.h"
#include "libcef/browser/extensions/value_store/cef_value_store.h"
namespace {
const char kUMAClientName[] = "Cef";
} // namespace
namespace extensions {
using SettingsNamespace = settings_namespace::Namespace;
CefValueStoreFactory::StorageHelper::StorageHelper() = default;
CefValueStoreFactory::StorageHelper::~StorageHelper() = default;
std::set<ExtensionId> CefValueStoreFactory::StorageHelper::GetKnownExtensionIDs(
ModelType model_type) const {
std::set<ExtensionId> ids;
switch (model_type) {
case ValueStoreFactory::ModelType::APP:
for (const auto& key : app_stores_)
ids.insert(key.first);
break;
case ValueStoreFactory::ModelType::EXTENSION:
for (const auto& key : extension_stores_)
ids.insert(key.first);
break;
}
return ids;
}
void CefValueStoreFactory::StorageHelper::Reset() {
app_stores_.clear();
extension_stores_.clear();
}
ValueStore* CefValueStoreFactory::StorageHelper::AddValueStore(
const ExtensionId& extension_id,
ValueStore* value_store,
ModelType model_type) {
if (model_type == ValueStoreFactory::ModelType::APP) {
DCHECK(app_stores_.find(extension_id) == app_stores_.end());
app_stores_[extension_id] = value_store;
} else {
DCHECK(extension_stores_.find(extension_id) == extension_stores_.end());
extension_stores_[extension_id] = value_store;
}
return value_store;
}
void CefValueStoreFactory::StorageHelper::DeleteSettings(
const ExtensionId& extension_id,
ModelType model_type) {
switch (model_type) {
case ValueStoreFactory::ModelType::APP:
app_stores_.erase(extension_id);
break;
case ValueStoreFactory::ModelType::EXTENSION:
extension_stores_.erase(extension_id);
break;
}
}
bool CefValueStoreFactory::StorageHelper::HasSettings(
const ExtensionId& extension_id,
ModelType model_type) const {
switch (model_type) {
case ValueStoreFactory::ModelType::APP:
return app_stores_.find(extension_id) != app_stores_.end();
case ValueStoreFactory::ModelType::EXTENSION:
return extension_stores_.find(extension_id) != extension_stores_.end();
}
NOTREACHED();
return false;
}
ValueStore* CefValueStoreFactory::StorageHelper::GetExisting(
const ExtensionId& extension_id) const {
auto it = app_stores_.find(extension_id);
if (it != app_stores_.end())
return it->second;
it = extension_stores_.find(extension_id);
if (it != extension_stores_.end())
return it->second;
return nullptr;
}
CefValueStoreFactory::CefValueStoreFactory() = default;
CefValueStoreFactory::CefValueStoreFactory(const base::FilePath& db_path)
: db_path_(db_path) {}
CefValueStoreFactory::~CefValueStoreFactory() {}
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateRulesStore() {
if (db_path_.empty())
last_created_store_ = new CefValueStore();
else
last_created_store_ = new LeveldbValueStore(kUMAClientName, db_path_);
return base::WrapUnique(last_created_store_);
}
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateStateStore() {
return CreateRulesStore();
}
CefValueStoreFactory::StorageHelper& CefValueStoreFactory::GetStorageHelper(
SettingsNamespace settings_namespace) {
switch (settings_namespace) {
case settings_namespace::LOCAL:
return local_helper_;
case settings_namespace::SYNC:
return sync_helper_;
case settings_namespace::MANAGED:
return managed_helper_;
case settings_namespace::INVALID:
break;
}
NOTREACHED();
return local_helper_;
}
std::unique_ptr<ValueStore> CefValueStoreFactory::CreateSettingsStore(
SettingsNamespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
std::unique_ptr<ValueStore> settings_store(CreateRulesStore());
// Note: This factory is purposely keeping the raw pointers to each ValueStore
// created. Tests using CefValueStoreFactory must be careful to keep
// those ValueStore's alive for the duration of their test.
GetStorageHelper(settings_namespace)
.AddValueStore(extension_id, settings_store.get(), model_type);
return settings_store;
}
ValueStore* CefValueStoreFactory::LastCreatedStore() const {
return last_created_store_;
}
void CefValueStoreFactory::DeleteSettings(SettingsNamespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
GetStorageHelper(settings_namespace).DeleteSettings(extension_id, model_type);
}
bool CefValueStoreFactory::HasSettings(SettingsNamespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
return GetStorageHelper(settings_namespace)
.HasSettings(extension_id, model_type);
}
std::set<ExtensionId> CefValueStoreFactory::GetKnownExtensionIDs(
SettingsNamespace settings_namespace,
ModelType model_type) const {
return const_cast<CefValueStoreFactory*>(this)
->GetStorageHelper(settings_namespace)
.GetKnownExtensionIDs(model_type);
}
ValueStore* CefValueStoreFactory::GetExisting(
const ExtensionId& extension_id) const {
ValueStore* existing_store = local_helper_.GetExisting(extension_id);
if (existing_store)
return existing_store;
existing_store = sync_helper_.GetExisting(extension_id);
if (existing_store)
return existing_store;
existing_store = managed_helper_.GetExisting(extension_id);
DCHECK(existing_store != nullptr);
return existing_store;
}
void CefValueStoreFactory::Reset() {
last_created_store_ = nullptr;
local_helper_.Reset();
sync_helper_.Reset();
managed_helper_.Reset();
}
} // namespace extensions

View File

@@ -0,0 +1,97 @@
// Copyright 2017 The Chromium Embedded Framework Authors.
// Portions copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_FACTORY_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_FACTORY_H_
#include <map>
#include <memory>
#include <set>
#include "base/files/file_path.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/extension_id.h"
class ValueStore;
namespace extensions {
// Will either open a database on disk (if path provided) returning a
// |LeveldbValueStore|. Otherwise a new |CefValueStore| instance will be
// returned.
class CefValueStoreFactory : public ValueStoreFactory {
public:
CefValueStoreFactory();
explicit CefValueStoreFactory(const base::FilePath& db_path);
// ValueStoreFactory
std::unique_ptr<ValueStore> CreateRulesStore() override;
std::unique_ptr<ValueStore> CreateStateStore() override;
std::unique_ptr<ValueStore> CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
void DeleteSettings(settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
bool HasSettings(settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
std::set<ExtensionId> GetKnownExtensionIDs(
settings_namespace::Namespace settings_namespace,
ModelType model_type) const override;
// Return the last created |ValueStore|. Use with caution as this may return
// a dangling pointer since the creator now owns the ValueStore which can be
// deleted at any time.
ValueStore* LastCreatedStore() const;
// Return a previously created |ValueStore| for an extension.
ValueStore* GetExisting(const ExtensionId& extension_id) const;
// Reset this class (as if just created).
void Reset();
private:
// Manages a collection of |ValueStore|'s created for an app/extension.
// One of these exists for each setting type.
class StorageHelper {
public:
StorageHelper();
~StorageHelper();
std::set<ExtensionId> GetKnownExtensionIDs(ModelType model_type) const;
ValueStore* AddValueStore(const ExtensionId& extension_id,
ValueStore* value_store,
ModelType model_type);
void DeleteSettings(const ExtensionId& extension_id, ModelType model_type);
bool HasSettings(const ExtensionId& extension_id,
ModelType model_type) const;
void Reset();
ValueStore* GetExisting(const ExtensionId& extension_id) const;
private:
std::map<ExtensionId, ValueStore*> app_stores_;
std::map<ExtensionId, ValueStore*> extension_stores_;
DISALLOW_COPY_AND_ASSIGN(StorageHelper);
};
StorageHelper& GetStorageHelper(
settings_namespace::Namespace settings_namespace);
~CefValueStoreFactory() override;
base::FilePath db_path_;
ValueStore* last_created_store_ = nullptr;
// None of these value stores are owned by this factory, so care must be
// taken when calling GetExisting.
StorageHelper local_helper_;
StorageHelper sync_helper_;
StorageHelper managed_helper_;
DISALLOW_COPY_AND_ASSIGN(CefValueStoreFactory);
};
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_VALUE_STORE_CEF_VALUE_STORE_FACTORY_H_

View File

@@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/task_runner_impl.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
@@ -793,7 +794,7 @@ void CefMenuModelImpl::MouseOutsideMenu(const gfx::Point& screen_point) {
// Allow the callstack to unwind before notifying the delegate since it may // Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed. // result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&CefMenuModelImpl::OnMouseOutsideMenu, this, screen_point)); base::Bind(&CefMenuModelImpl::OnMouseOutsideMenu, this, screen_point));
} }
@@ -804,7 +805,7 @@ void CefMenuModelImpl::UnhandledOpenSubmenu(bool is_rtl) {
// Allow the callstack to unwind before notifying the delegate since it may // Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed. // result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&CefMenuModelImpl::OnUnhandledOpenSubmenu, this, is_rtl)); base::Bind(&CefMenuModelImpl::OnUnhandledOpenSubmenu, this, is_rtl));
} }
@@ -815,7 +816,7 @@ void CefMenuModelImpl::UnhandledCloseSubmenu(bool is_rtl) {
// Allow the callstack to unwind before notifying the delegate since it may // Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed. // result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&CefMenuModelImpl::OnUnhandledCloseSubmenu, this, is_rtl)); base::Bind(&CefMenuModelImpl::OnUnhandledCloseSubmenu, this, is_rtl));
} }
@@ -891,7 +892,7 @@ void CefMenuModelImpl::MenuWillClose() {
// Due to how menus work on the different platforms, ActivatedAt will be // Due to how menus work on the different platforms, ActivatedAt will be
// called after this. It's more convenient for the delegate to be called // called after this. It's more convenient for the delegate to be called
// afterwards, though, so post a task. // afterwards, though, so post a task.
base::MessageLoop::current()->task_runner()->PostTask( CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this)); FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this));
} }

View File

@@ -417,7 +417,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent(
result.SetType(blink::WebInputEvent::kMouseWheel); result.SetType(blink::WebInputEvent::kMouseWheel);
static const double scrollbarPixelsPerCocoaTick = 40.0; static const double scrollbarPixelsPerCocoaTick = 40.0;
result.delta_y = deltaX; result.delta_x = deltaX;
result.delta_y = deltaY; result.delta_y = deltaY;
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick; result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick; result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;

View File

@@ -314,6 +314,16 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
if (!browser_ || browser_->TryCloseBrowser()) { if (!browser_ || browser_->TryCloseBrowser()) {
// Allow the close. // Allow the close.
XDestroyWindow(xdisplay_, xwindow_); XDestroyWindow(xdisplay_, xwindow_);
xwindow_ = None;
if (browser_.get()) {
// Force the browser to be destroyed and release the reference
// added in PlatformCreateWindow().
browser_->WindowDestroyed();
}
delete this;
} }
} else if (protocol == gfx::GetAtom(kNetWMPing)) { } else if (protocol == gfx::GetAtom(kNetWMPing)) {
XEvent reply_event = *xev; XEvent reply_event = *xev;
@@ -327,17 +337,6 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
} }
break; break;
} }
case DestroyNotify:
xwindow_ = None;
if (browser_.get()) {
// Force the browser to be destroyed and release the reference added
// in PlatformCreateWindow().
browser_->WindowDestroyed();
}
delete this;
break;
case FocusIn: case FocusIn:
// This message is received first followed by a "_NET_ACTIVE_WINDOW" // This message is received first followed by a "_NET_ACTIVE_WINDOW"
// message sent to the root window. When X11DesktopHandler handles the // message sent to the root window. When X11DesktopHandler handles the

View File

@@ -271,6 +271,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
io_state_->url_request_context_.reset(new CefURLRequestContextImpl()); io_state_->url_request_context_.reset(new CefURLRequestContextImpl());
io_state_->url_request_context_->set_net_log(io_state_->net_log_); io_state_->url_request_context_->set_net_log(io_state_->net_log_);
io_state_->url_request_context_->set_enable_brotli(true);
io_state_->storage_.reset(new net::URLRequestContextStorage( io_state_->storage_.reset(new net::URLRequestContextStorage(
io_state_->url_request_context_.get())); io_state_->url_request_context_.get()));

View File

@@ -21,6 +21,7 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
// All other values refer to the parent request context. // All other values refer to the parent request context.
set_net_log(parent->net_log()); set_net_log(parent->net_log());
set_enable_brotli(parent->enable_brotli());
set_host_resolver(parent->host_resolver()); set_host_resolver(parent->host_resolver());
set_cert_verifier(parent->cert_verifier()); set_cert_verifier(parent->cert_verifier());
set_transport_security_state(parent->transport_security_state()); set_transport_security_state(parent->transport_security_state());

View File

@@ -97,8 +97,7 @@ const char kUserPrefsFileName[] = "UserPrefs.json";
std::unique_ptr<PrefService> CreatePrefService(Profile* profile, std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
const base::FilePath& cache_path, const base::FilePath& cache_path,
bool persist_user_preferences, bool persist_user_preferences) {
bool is_pre_initialization) {
const base::CommandLine* command_line = const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess(); base::CommandLine::ForCurrentProcess();
@@ -115,8 +114,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
factory.set_command_line_prefs(command_line_pref_store); factory.set_command_line_prefs(command_line_pref_store);
// True if preferences will be stored on disk. // True if preferences will be stored on disk.
const bool store_on_disk = const bool store_on_disk = !cache_path.empty() && persist_user_preferences;
!cache_path.empty() && persist_user_preferences && !is_pre_initialization;
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner; scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner;
if (store_on_disk) { if (store_on_disk) {
@@ -142,8 +140,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
} }
#if BUILDFLAG(ENABLE_SUPERVISED_USERS) #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
// Don't access factories during pre-initialization.
if (!is_pre_initialization) {
// Used to store supervised user preferences. // Used to store supervised user preferences.
SupervisedUserSettingsService* supervised_user_settings = SupervisedUserSettingsService* supervised_user_settings =
SupervisedUserSettingsServiceFactory::GetForProfile(profile); SupervisedUserSettingsServiceFactory::GetForProfile(profile);
@@ -157,11 +153,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
supervised_user_settings->Init(cef_pref_store); supervised_user_settings->Init(cef_pref_store);
} }
scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr( scoped_refptr<PrefStore> supervised_user_prefs =
new SupervisedUserPrefStore(supervised_user_settings)); make_scoped_refptr(new SupervisedUserPrefStore(supervised_user_settings));
DCHECK(supervised_user_prefs->IsInitializationComplete()); DCHECK(supervised_user_prefs->IsInitializationComplete());
factory.set_supervised_user_prefs(supervised_user_prefs); factory.set_supervised_user_prefs(supervised_user_prefs);
}
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
// Registry that will be populated with all known preferences. Preferences // Registry that will be populated with all known preferences. Preferences

View File

@@ -19,13 +19,10 @@ namespace browser_prefs {
// Name for the user prefs JSON file. // Name for the user prefs JSON file.
extern const char kUserPrefsFileName[]; extern const char kUserPrefsFileName[];
// Create the PrefService used to manage pref registration and storage. If // Create the PrefService used to manage pref registration and storage.
// |is_pre_initialization| is true a non-persistent PrefService will be created
// for temporary usage during BrowserContextServices initialization.
std::unique_ptr<PrefService> CreatePrefService(Profile* profile, std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
const base::FilePath& cache_path, const base::FilePath& cache_path,
bool persist_user_preferences, bool persist_user_preferences);
bool is_pre_initialization);
} // namespace browser_prefs } // namespace browser_prefs

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/common/values_impl.h" #include "libcef/common/values_impl.h"
#include "base/atomic_sequence_num.h" #include "base/atomic_sequence_num.h"
@@ -184,7 +185,7 @@ void CefRequestContextImpl::GetBrowserContext(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const BrowserContextCallback& callback) { const BrowserContextCallback& callback) {
if (!task_runner.get()) if (!task_runner.get())
task_runner = base::MessageLoop::current()->task_runner(); task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
GetBrowserContextOnUIThread(task_runner, callback); GetBrowserContextOnUIThread(task_runner, callback);
} }
@@ -192,7 +193,7 @@ void CefRequestContextImpl::GetRequestContextImpl(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const RequestContextCallback& callback) { const RequestContextCallback& callback) {
if (!task_runner.get()) if (!task_runner.get())
task_runner = base::MessageLoop::current()->task_runner(); task_runner = CefTaskRunnerImpl::GetCurrentTaskRunner();
if (request_context_getter_impl_) { if (request_context_getter_impl_) {
// The browser context already exists. // The browser context already exists.
DCHECK(browser_context()); DCHECK(browser_context());

View File

@@ -19,7 +19,7 @@ using content::BrowserThread;
// static // static
CefRefPtr<CefTaskRunner> CefTaskRunner::GetForCurrentThread() { CefRefPtr<CefTaskRunner> CefTaskRunner::GetForCurrentThread() {
scoped_refptr<base::SequencedTaskRunner> task_runner = scoped_refptr<base::SingleThreadTaskRunner> task_runner =
CefTaskRunnerImpl::GetCurrentTaskRunner(); CefTaskRunnerImpl::GetCurrentTaskRunner();
if (task_runner.get()) if (task_runner.get())
return new CefTaskRunnerImpl(task_runner); return new CefTaskRunnerImpl(task_runner);
@@ -28,7 +28,7 @@ CefRefPtr<CefTaskRunner> CefTaskRunner::GetForCurrentThread() {
// static // static
CefRefPtr<CefTaskRunner> CefTaskRunner::GetForThread(CefThreadId threadId) { CefRefPtr<CefTaskRunner> CefTaskRunner::GetForThread(CefThreadId threadId) {
scoped_refptr<base::SequencedTaskRunner> task_runner = scoped_refptr<base::SingleThreadTaskRunner> task_runner =
CefTaskRunnerImpl::GetTaskRunner(threadId); CefTaskRunnerImpl::GetTaskRunner(threadId);
if (task_runner.get()) if (task_runner.get())
return new CefTaskRunnerImpl(task_runner); return new CefTaskRunnerImpl(task_runner);
@@ -40,13 +40,13 @@ CefRefPtr<CefTaskRunner> CefTaskRunner::GetForThread(CefThreadId threadId) {
// CefTaskRunnerImpl // CefTaskRunnerImpl
CefTaskRunnerImpl::CefTaskRunnerImpl( CefTaskRunnerImpl::CefTaskRunnerImpl(
scoped_refptr<base::SequencedTaskRunner> task_runner) scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: task_runner_(task_runner) { : task_runner_(task_runner) {
DCHECK(task_runner_.get()); DCHECK(task_runner_.get());
} }
// static // static
scoped_refptr<base::SequencedTaskRunner> CefTaskRunnerImpl::GetTaskRunner( scoped_refptr<base::SingleThreadTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
CefThreadId threadId) { CefThreadId threadId) {
// Render process. // Render process.
if (threadId == TID_RENDERER) { if (threadId == TID_RENDERER) {
@@ -95,9 +95,9 @@ scoped_refptr<base::SequencedTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
} }
// static // static
scoped_refptr<base::SequencedTaskRunner> scoped_refptr<base::SingleThreadTaskRunner>
CefTaskRunnerImpl::GetCurrentTaskRunner() { CefTaskRunnerImpl::GetCurrentTaskRunner() {
scoped_refptr<base::SequencedTaskRunner> task_runner; scoped_refptr<base::SingleThreadTaskRunner> task_runner;
// For named browser process threads return the same TaskRunner as // For named browser process threads return the same TaskRunner as
// GetTaskRunner(). Otherwise BelongsToThread() will return incorrect results. // GetTaskRunner(). Otherwise BelongsToThread() will return incorrect results.
@@ -133,7 +133,7 @@ bool CefTaskRunnerImpl::BelongsToCurrentThread() {
} }
bool CefTaskRunnerImpl::BelongsToThread(CefThreadId threadId) { bool CefTaskRunnerImpl::BelongsToThread(CefThreadId threadId) {
scoped_refptr<base::SequencedTaskRunner> task_runner = scoped_refptr<base::SingleThreadTaskRunner> task_runner =
GetTaskRunner(threadId); GetTaskRunner(threadId);
return (task_runner_ == task_runner); return (task_runner_ == task_runner);
} }

View File

@@ -8,18 +8,18 @@
#include "include/cef_task.h" #include "include/cef_task.h"
#include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h"
class CefTaskRunnerImpl : public CefTaskRunner { class CefTaskRunnerImpl : public CefTaskRunner {
public: public:
explicit CefTaskRunnerImpl( explicit CefTaskRunnerImpl(
scoped_refptr<base::SequencedTaskRunner> task_runner); scoped_refptr<base::SingleThreadTaskRunner> task_runner);
// Returns the task runner associated with |threadId|. // Returns the task runner associated with |threadId|.
static scoped_refptr<base::SequencedTaskRunner> GetTaskRunner( static scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
CefThreadId threadId); CefThreadId threadId);
// Returns the current task runner. // Returns the current task runner.
static scoped_refptr<base::SequencedTaskRunner> GetCurrentTaskRunner(); static scoped_refptr<base::SingleThreadTaskRunner> GetCurrentTaskRunner();
// CefTaskRunner methods: // CefTaskRunner methods:
bool IsSame(CefRefPtr<CefTaskRunner> that) override; bool IsSame(CefRefPtr<CefTaskRunner> that) override;
@@ -29,7 +29,7 @@ class CefTaskRunnerImpl : public CefTaskRunner {
bool PostDelayedTask(CefRefPtr<CefTask> task, int64 delay_ms) override; bool PostDelayedTask(CefRefPtr<CefTask> task, int64 delay_ms) override;
private: private:
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
IMPLEMENT_REFCOUNTING(CefTaskRunnerImpl); IMPLEMENT_REFCOUNTING(CefTaskRunnerImpl);
DISALLOW_COPY_AND_ASSIGN(CefTaskRunnerImpl); DISALLOW_COPY_AND_ASSIGN(CefTaskRunnerImpl);

View File

@@ -5,6 +5,7 @@
#include "include/cef_urlrequest.h" #include "include/cef_urlrequest.h"
#include "libcef/browser/browser_urlrequest_impl.h" #include "libcef/browser/browser_urlrequest_impl.h"
#include "libcef/common/content_client.h" #include "libcef/common/content_client.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/renderer/render_urlrequest_impl.h" #include "libcef/renderer/render_urlrequest_impl.h"
#include "base/logging.h" #include "base/logging.h"
@@ -21,7 +22,7 @@ CefRefPtr<CefURLRequest> CefURLRequest::Create(
return NULL; return NULL;
} }
if (!base::MessageLoop::current()) { if (!CefTaskRunnerImpl::GetCurrentTaskRunner()) {
NOTREACHED() << "called on invalid thread"; NOTREACHED() << "called on invalid thread";
return NULL; return NULL;
} }

View File

@@ -350,7 +350,7 @@ void CefContentRendererClient::DevToolsAgentDetached() {
} }
} }
scoped_refptr<base::SequencedTaskRunner> scoped_refptr<base::SingleThreadTaskRunner>
CefContentRendererClient::GetCurrentTaskRunner() { CefContentRendererClient::GetCurrentTaskRunner() {
// Check if currently on the render thread. // Check if currently on the render thread.
if (CEF_CURRENTLY_ON_RT()) if (CEF_CURRENTLY_ON_RT())

View File

@@ -66,7 +66,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
void OnGuestViewDestroyed(CefGuestView* guest_view); void OnGuestViewDestroyed(CefGuestView* guest_view);
// Render thread task runner. // Render thread task runner.
base::SequencedTaskRunner* render_task_runner() const { base::SingleThreadTaskRunner* render_task_runner() const {
return render_task_runner_.get(); return render_task_runner_.get();
} }
@@ -82,7 +82,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
// Returns the task runner for the current thread. Returns NULL if the current // Returns the task runner for the current thread. Returns NULL if the current
// thread is not the main render process thread. // thread is not the main render process thread.
scoped_refptr<base::SequencedTaskRunner> GetCurrentTaskRunner(); scoped_refptr<base::SingleThreadTaskRunner> GetCurrentTaskRunner();
// Perform cleanup work that needs to occur before shutdown when running in // Perform cleanup work that needs to occur before shutdown when running in
// single-process mode. Blocks until cleanup is complete. // single-process mode. Blocks until cleanup is complete.
@@ -145,7 +145,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
// Perform cleanup work for single-process mode. // Perform cleanup work for single-process mode.
void RunSingleProcessCleanupOnUIThread(); void RunSingleProcessCleanupOnUIThread();
scoped_refptr<base::SequencedTaskRunner> render_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_;
std::unique_ptr<CefRenderThreadObserver> observer_; std::unique_ptr<CefRenderThreadObserver> observer_;
std::unique_ptr<web_cache::WebCacheImpl> web_cache_impl_; std::unique_ptr<web_cache::WebCacheImpl> web_cache_impl_;
std::unique_ptr<SpellCheck> spellcheck_; std::unique_ptr<SpellCheck> spellcheck_;

View File

@@ -8,6 +8,7 @@
#include "libcef/common/request_impl.h" #include "libcef/common/request_impl.h"
#include "libcef/common/response_impl.h" #include "libcef/common/response_impl.h"
#include "libcef/common/task_runner_impl.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
@@ -68,7 +69,7 @@ class CefRenderURLRequest::Context
: url_request_(url_request), : url_request_(url_request),
request_(request), request_(request),
client_(client), client_(client),
task_runner_(base::MessageLoop::current()->task_runner()), task_runner_(CefTaskRunnerImpl::GetCurrentTaskRunner()),
status_(UR_IO_PENDING), status_(UR_IO_PENDING),
error_code_(ERR_NONE), error_code_(ERR_NONE),
upload_data_size_(0), upload_data_size_(0),

View File

@@ -152,7 +152,7 @@ class CefV8IsolateManager {
} }
v8::Isolate* isolate() const { return isolate_; } v8::Isolate* isolate() const { return isolate_; }
scoped_refptr<base::SequencedTaskRunner> task_runner() const { scoped_refptr<base::SingleThreadTaskRunner> task_runner() const {
return task_runner_; return task_runner_;
} }
@@ -162,7 +162,7 @@ class CefV8IsolateManager {
private: private:
v8::Isolate* isolate_; v8::Isolate* isolate_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
typedef std::map<int, scoped_refptr<CefV8ContextState>> ContextMap; typedef std::map<int, scoped_refptr<CefV8ContextState>> ContextMap;
ContextMap context_map_; ContextMap context_map_;

View File

@@ -14,7 +14,7 @@
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
class CefTrackNode; class CefTrackNode;
@@ -103,7 +103,7 @@ class CefV8HandleBase
bool BelongsToCurrentThread() const; bool BelongsToCurrentThread() const;
v8::Isolate* isolate() const { return isolate_; } v8::Isolate* isolate() const { return isolate_; }
scoped_refptr<base::SequencedTaskRunner> task_runner() const { scoped_refptr<base::SingleThreadTaskRunner> task_runner() const {
return task_runner_; return task_runner_;
} }
@@ -120,7 +120,7 @@ class CefV8HandleBase
protected: protected:
v8::Isolate* isolate_; v8::Isolate* isolate_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<CefV8ContextState> context_state_; scoped_refptr<CefV8ContextState> context_state_;
}; };

View File

@@ -143,7 +143,7 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
// Increment/decrement reference counts on only the underlying class. // Increment/decrement reference counts on only the underlying class.
void UnderlyingAddRef() const { wrapper_struct_.object_->AddRef(); } void UnderlyingAddRef() const { wrapper_struct_.object_->AddRef(); }
bool UnderlyingRelease() const { return wrapper_struct_.object_->Release(); } void UnderlyingRelease() const { wrapper_struct_.object_->Release(); }
bool UnderlyingHasOneRef() const { bool UnderlyingHasOneRef() const {
return wrapper_struct_.object_->HasOneRef(); return wrapper_struct_.object_->HasOneRef();
} }

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=a4c5733b13d0513946314faf2ac0745c86419df7$ // $hash=05b6fa7134b9e58dcef8262b0b726e4afd6e3512$
// //
#include "libcef_dll/cpptoc/extension_handler_cpptoc.h" #include "libcef_dll/cpptoc/extension_handler_cpptoc.h"
@@ -133,6 +133,92 @@ int CEF_CALLBACK extension_handler_on_before_background_browser(
return _retval; return _retval;
} }
int CEF_CALLBACK
extension_handler_on_before_browser(struct _cef_extension_handler_t* self,
cef_extension_t* extension,
cef_browser_t* browser,
cef_browser_t* active_browser,
int index,
const cef_string_t* url,
int active,
cef_window_info_t* windowInfo,
cef_client_t** client,
struct _cef_browser_settings_t* settings) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: extension; type: refptr_diff
DCHECK(extension);
if (!extension)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: active_browser; type: refptr_diff
DCHECK(active_browser);
if (!active_browser)
return 0;
// Verify param: url; type: string_byref_const
DCHECK(url);
if (!url)
return 0;
// Verify param: windowInfo; type: struct_byref
DCHECK(windowInfo);
if (!windowInfo)
return 0;
// Verify param: client; type: refptr_same_byref
DCHECK(client);
if (!client)
return 0;
// Verify param: settings; type: struct_byref
DCHECK(settings);
if (!settings)
return 0;
// Translate param: windowInfo; type: struct_byref
CefWindowInfo windowInfoObj;
if (windowInfo)
windowInfoObj.AttachTo(*windowInfo);
// Translate param: client; type: refptr_same_byref
CefRefPtr<CefClient> clientPtr;
if (client && *client)
clientPtr = CefClientCppToC::Unwrap(*client);
CefClient* clientOrig = clientPtr.get();
// Translate param: settings; type: struct_byref
CefBrowserSettings settingsObj;
if (settings)
settingsObj.AttachTo(*settings);
// Execute
bool _retval = CefExtensionHandlerCppToC::Get(self)->OnBeforeBrowser(
CefExtensionCToCpp::Wrap(extension), CefBrowserCToCpp::Wrap(browser),
CefBrowserCToCpp::Wrap(active_browser), index, CefString(url),
active ? true : false, windowInfoObj, clientPtr, settingsObj);
// Restore param: windowInfo; type: struct_byref
if (windowInfo)
windowInfoObj.DetachTo(*windowInfo);
// Restore param: client; type: refptr_same_byref
if (client) {
if (clientPtr.get()) {
if (clientPtr.get() != clientOrig) {
*client = CefClientCppToC::Wrap(clientPtr);
}
} else {
*client = NULL;
}
}
// Restore param: settings; type: struct_byref
if (settings)
settingsObj.DetachTo(*settings);
// Return type: bool
return _retval;
}
cef_browser_t* CEF_CALLBACK cef_browser_t* CEF_CALLBACK
extension_handler_get_active_browser(struct _cef_extension_handler_t* self, extension_handler_get_active_browser(struct _cef_extension_handler_t* self,
cef_extension_t* extension, cef_extension_t* extension,
@@ -243,6 +329,7 @@ CefExtensionHandlerCppToC::CefExtensionHandlerCppToC() {
GetStruct()->on_extension_unloaded = extension_handler_on_extension_unloaded; GetStruct()->on_extension_unloaded = extension_handler_on_extension_unloaded;
GetStruct()->on_before_background_browser = GetStruct()->on_before_background_browser =
extension_handler_on_before_background_browser; extension_handler_on_before_background_browser;
GetStruct()->on_before_browser = extension_handler_on_before_browser;
GetStruct()->get_active_browser = extension_handler_get_active_browser; GetStruct()->get_active_browser = extension_handler_get_active_browser;
GetStruct()->can_access_browser = extension_handler_can_access_browser; GetStruct()->can_access_browser = extension_handler_can_access_browser;
GetStruct()->get_extension_resource = GetStruct()->get_extension_resource =

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=b8f2ada19624a72741d86b5d6ff5214a4b711dd6$ // $hash=0166cbfe3039f90a07fd2d9267178ad1fdb0d4f7$
// //
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h" #include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
@@ -109,6 +109,64 @@ bool CefExtensionHandlerCToCpp::OnBeforeBackgroundBrowser(
return _retval ? true : false; return _retval ? true : false;
} }
bool CefExtensionHandlerCToCpp::OnBeforeBrowser(
CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefBrowser> active_browser,
int index,
const CefString& url,
bool active,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
cef_extension_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_before_browser))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: extension; type: refptr_diff
DCHECK(extension.get());
if (!extension.get())
return false;
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: active_browser; type: refptr_diff
DCHECK(active_browser.get());
if (!active_browser.get())
return false;
// Verify param: url; type: string_byref_const
DCHECK(!url.empty());
if (url.empty())
return false;
// Translate param: client; type: refptr_same_byref
cef_client_t* clientStruct = NULL;
if (client.get())
clientStruct = CefClientCToCpp::Unwrap(client);
cef_client_t* clientOrig = clientStruct;
// Execute
int _retval = _struct->on_before_browser(
_struct, CefExtensionCppToC::Wrap(extension),
CefBrowserCppToC::Wrap(browser), CefBrowserCppToC::Wrap(active_browser),
index, url.GetStruct(), active, &windowInfo, &clientStruct, &settings);
// Restore param:client; type: refptr_same_byref
if (clientStruct) {
if (clientStruct != clientOrig) {
client = CefClientCToCpp::Wrap(clientStruct);
}
} else {
client = NULL;
}
// Return type: bool
return _retval ? true : false;
}
CefRefPtr<CefBrowser> CefExtensionHandlerCToCpp::GetActiveBrowser( CefRefPtr<CefBrowser> CefExtensionHandlerCToCpp::GetActiveBrowser(
CefRefPtr<CefExtension> extension, CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=369179037f2f6abc4d30e25099b52acf2f71e1e2$ // $hash=0d7d8e2694c5828bb5506fbb5737819b60094428$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_EXTENSION_HANDLER_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_EXTENSION_HANDLER_CTOCPP_H_
@@ -43,6 +43,15 @@ class CefExtensionHandlerCToCpp
const CefString& url, const CefString& url,
CefRefPtr<CefClient>& client, CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) override; CefBrowserSettings& settings) override;
bool OnBeforeBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefBrowser> active_browser,
int index,
const CefString& url,
bool active,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) override;
CefRefPtr<CefBrowser> GetActiveBrowser(CefRefPtr<CefExtension> extension, CefRefPtr<CefBrowser> GetActiveBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser, CefRefPtr<CefBrowser> browser,
bool include_incognito) override; bool include_incognito) override;

View File

@@ -159,6 +159,8 @@ enum CefWrapperType {
WT_X509CERTIFICATE, WT_X509CERTIFICATE,
WT_XML_READER, WT_XML_READER,
WT_ZIP_READER, WT_ZIP_READER,
WT_LAST
}; };
#endif // CEF_LIBCEF_DLL_WRAPPER_TYPES_H_ #endif // CEF_LIBCEF_DLL_WRAPPER_TYPES_H_

View File

@@ -247,6 +247,9 @@ patches = [
# Check RenderProcessHostImpl's |browser_context_| member before re- # Check RenderProcessHostImpl's |browser_context_| member before re-
# initializing the channel from RPHI::ProcessDied. # initializing the channel from RPHI::ProcessDied.
# https://bitbucket.org/chromiumembedded/cef/issues/2096 # https://bitbucket.org/chromiumembedded/cef/issues/2096
#
# Don't create a "databases" directory when cache_path is empty.
# https://bitbucket.org/chromiumembedded/cef/issues/2289
'name': 'storage_partition_1973', 'name': 'storage_partition_1973',
}, },
{ {
@@ -324,6 +327,10 @@ patches = [
}, },
{ {
# Linux: Fix build errors related to dependency versions. # Linux: Fix build errors related to dependency versions.
#
# Linux: Fix 32-bit build fails with ld.gold: internal error in
# get_section_contents, at icf.cc:467
# https://bitbucket.org/chromiumembedded/cef/issues/2256
'name': 'linux_build', 'name': 'linux_build',
}, },
{ {
@@ -340,4 +347,14 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/1947 # https://bitbucket.org/chromiumembedded/cef/issues/1947
'name': 'extensions_1947', 'name': 'extensions_1947',
}, },
{
# Don't enable sandbox::MITIGATION_STRICT_HANDLE_CHECKS in WinRT apps.
# https://bitbucket.org/chromiumembedded/cef/issues/2274
'name': 'win_rt_2274',
},
{
# macOS: Fix build of widevinecdmadapter.plugin.
# https://bitbucket.org/chromiumembedded/cef/issues/2314
'name': 'mac_widevine_2314',
},
] ]

View File

@@ -1,5 +1,5 @@
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
index 13e452c2b72b..2c4c55d90a50 100644 index abeb583eae52..bbdfdb13bcf4 100644
--- content/browser/browser_plugin/browser_plugin_guest.cc --- content/browser/browser_plugin/browser_plugin_guest.cc
+++ content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc
@@ -345,8 +345,11 @@ void BrowserPluginGuest::InitInternal( @@ -345,8 +345,11 @@ void BrowserPluginGuest::InitInternal(
@@ -15,7 +15,7 @@ index 13e452c2b72b..2c4c55d90a50 100644
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to // Once a BrowserPluginGuest has an embedder WebContents, it's considered to
// be attached. // be attached.
@@ -843,10 +846,19 @@ void BrowserPluginGuest::OnWillAttachComplete( @@ -841,10 +844,19 @@ void BrowserPluginGuest::OnWillAttachComplete(
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
web_contents_view->CreateViewForWidget( web_contents_view->CreateViewForWidget(
@@ -79,10 +79,10 @@ index e4401f85bf3f..20b85609a23f 100644
// Creates a new View that holds a popup and receives messages for it. // Creates a new View that holds a popup and receives messages for it.
virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( virtual RenderWidgetHostViewBase* CreateViewForPopupWidget(
diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc
index f407726a437e..0efc406c949f 100644 index 53ad9c8cb390..0fb7dc54d5b6 100644
--- content/browser/web_contents/web_contents_view_aura.cc --- content/browser/web_contents/web_contents_view_aura.cc
+++ content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc
@@ -833,7 +833,8 @@ void WebContentsViewAura::CreateView( @@ -834,7 +834,8 @@ void WebContentsViewAura::CreateView(
} }
RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
@@ -92,7 +92,7 @@ index f407726a437e..0efc406c949f 100644
if (render_widget_host->GetView()) { if (render_widget_host->GetView()) {
// During testing, the view will already be set up in most cases to the // During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that // test view, so we don't want to clobber it with a real one. To verify that
@@ -845,6 +846,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -846,6 +847,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
render_widget_host->GetView()); render_widget_host->GetView());
} }
@@ -221,10 +221,10 @@ index 12675d077c8a..46db5596618e 100644
RenderWidgetHost* render_widget_host) override; RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override; void SetPageTitle(const base::string16& title) override;
diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm
index a9111f9d9cef..33d5eea2cbb9 100644 index 92b48b711636..2c5d29c3cdd0 100644
--- content/browser/web_contents/web_contents_view_mac.mm --- content/browser/web_contents/web_contents_view_mac.mm
+++ content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm
@@ -352,7 +352,8 @@ void WebContentsViewMac::CreateView( @@ -353,7 +353,8 @@ void WebContentsViewMac::CreateView(
} }
RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
@@ -234,7 +234,7 @@ index a9111f9d9cef..33d5eea2cbb9 100644
if (render_widget_host->GetView()) { if (render_widget_host->GetView()) {
// During testing, the view will already be set up in most cases to the // During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that // test view, so we don't want to clobber it with a real one. To verify that
@@ -364,6 +365,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( @@ -365,6 +366,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
render_widget_host->GetView()); render_widget_host->GetView());
} }

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 97c769cdf483..78d9db9d084e 100644 index d207627330a3..66c32686f98a 100644
--- chrome/browser/ui/BUILD.gn --- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn
@@ -489,6 +489,7 @@ split_static_library("ui") { @@ -493,6 +493,7 @@ split_static_library("ui") {
"//chrome/browser/ui/webui/usb_internals:mojo_bindings", "//chrome/browser/ui/webui/usb_internals:mojo_bindings",
"//chrome/common", "//chrome/common",
"//chrome/common:search_mojom", "//chrome/common:search_mojom",
@@ -36,3 +36,16 @@ index dbcd69337de8..fc0b6aca080f 100644
"//skia", "//skia",
"//third_party/WebKit/Source/core", "//third_party/WebKit/Source/core",
"//third_party/WebKit/Source/modules", "//third_party/WebKit/Source/modules",
diff --git third_party/WebKit/Source/core/BUILD.gn third_party/WebKit/Source/core/BUILD.gn
index 67bbab12ea53..881310a760ee 100644
--- third_party/WebKit/Source/core/BUILD.gn
+++ third_party/WebKit/Source/core/BUILD.gn
@@ -1189,6 +1189,8 @@ group("all_generators") {
target("jumbo_" + core_link_small_target_type, "core_generated") {
sources = bindings_core_v8_files
+ visibility += [ "//cef:webkit_set" ]
+
# Add all sources generated by the targets above.
foreach(current, targets_generating_sources) {
sources += get_target_outputs(current)

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc
index faca8fe60751..cd96d66a5d8b 100644 index d3677b9732ff..ac41dbec4e6b 100644
--- chrome/browser/download/download_target_determiner.cc --- chrome/browser/download/download_target_determiner.cc
+++ chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc
@@ -484,8 +484,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, @@ -477,8 +477,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context,
content::PluginService* plugin_service = content::PluginService* plugin_service =
content::PluginService::GetInstance(); content::PluginService::GetInstance();
bool plugin_found = plugin_service->GetPluginInfo( bool plugin_found = plugin_service->GetPluginInfo(
@@ -108,7 +108,7 @@ index 2e4d0d9ac4cb..9bd0bf12ca88 100644
} }
diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc
index 7e577c8395d7..96421d4f2d88 100644 index a9c344c3cbee..78ad450cf104 100644
--- content/browser/frame_host/render_frame_host_impl.cc --- content/browser/frame_host/render_frame_host_impl.cc
+++ content/browser/frame_host/render_frame_host_impl.cc +++ content/browser/frame_host/render_frame_host_impl.cc
@@ -370,9 +370,9 @@ void ForwardRequest(const char* service_name, @@ -370,9 +370,9 @@ void ForwardRequest(const char* service_name,
@@ -305,10 +305,10 @@ index b654bf3c98b4..1b09cd3d0a23 100644
const std::string& mime_type, const std::string& mime_type,
bool allow_wildcard, bool allow_wildcard,
diff --git content/common/frame_messages.h content/common/frame_messages.h diff --git content/common/frame_messages.h content/common/frame_messages.h
index 7fcc51298b12..6cde762011c9 100644 index cd68128c6167..6bb6ced10858 100644
--- content/common/frame_messages.h --- content/common/frame_messages.h
+++ content/common/frame_messages.h +++ content/common/frame_messages.h
@@ -1324,8 +1324,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, @@ -1329,8 +1329,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
// Used to get the list of plugins. |main_frame_origin| is used to handle // Used to get the list of plugins. |main_frame_origin| is used to handle
// exceptions for plugin content settings. // exceptions for plugin content settings.
@@ -319,7 +319,7 @@ index 7fcc51298b12..6cde762011c9 100644
url::Origin /* main_frame_origin */, url::Origin /* main_frame_origin */,
std::vector<content::WebPluginInfo> /* plugins */) std::vector<content::WebPluginInfo> /* plugins */)
@@ -1333,9 +1334,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, @@ -1338,9 +1339,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins,
// type. If there is no matching plugin, |found| is false. // type. If there is no matching plugin, |found| is false.
// |actual_mime_type| is the actual mime type supported by the // |actual_mime_type| is the actual mime type supported by the
// found plugin. // found plugin.
@@ -331,7 +331,7 @@ index 7fcc51298b12..6cde762011c9 100644
url::Origin /* main_frame_origin */, url::Origin /* main_frame_origin */,
std::string /* mime_type */, std::string /* mime_type */,
bool /* found */, bool /* found */,
@@ -1722,9 +1724,9 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_FindMatchRects_Reply, @@ -1727,9 +1729,9 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_FindMatchRects_Reply,
IPC_MESSAGE_ROUTED2(FrameHostMsg_GetNearestFindResult_Reply, IPC_MESSAGE_ROUTED2(FrameHostMsg_GetNearestFindResult_Reply,
int /* nfr_request_id */, int /* nfr_request_id */,
float /* distance */) float /* distance */)
@@ -455,10 +455,10 @@ index 4f8478bfa87a..52471407518e 100644
virtual void FocusedNodeChanged(const blink::WebNode& node) {} virtual void FocusedNodeChanged(const blink::WebNode& node) {}
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
index 7fc594620793..9082ae71219f 100644 index 7e546c27b671..11f88ec24b00 100644
--- content/renderer/render_frame_impl.cc --- content/renderer/render_frame_impl.cc
+++ content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc
@@ -2952,7 +2952,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( @@ -2959,7 +2959,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
std::string mime_type; std::string mime_type;
bool found = false; bool found = false;
Send(new FrameHostMsg_GetPluginInfo( Send(new FrameHostMsg_GetPluginInfo(
@@ -468,7 +468,7 @@ index 7fc594620793..9082ae71219f 100644
params.mime_type.Utf8(), &found, &info, &mime_type)); params.mime_type.Utf8(), &found, &info, &mime_type));
if (!found) if (!found)
return nullptr; return nullptr;
@@ -3258,6 +3259,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { @@ -3265,6 +3266,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) {
void RenderFrameImpl::FrameFocused() { void RenderFrameImpl::FrameFocused() {
Send(new FrameHostMsg_FrameFocused(routing_id_)); Send(new FrameHostMsg_FrameFocused(routing_id_));
@@ -477,7 +477,7 @@ index 7fc594620793..9082ae71219f 100644
} }
void RenderFrameImpl::WillCommitProvisionalLoad() { void RenderFrameImpl::WillCommitProvisionalLoad() {
@@ -5397,9 +5400,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( @@ -5431,9 +5434,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
(!IsBrowserSideNavigationEnabled() || (!IsBrowserSideNavigationEnabled() ||
url != pending_navigation_params_->request_params.redirects[0])); url != pending_navigation_params_->request_params.redirects[0]));
@@ -489,7 +489,7 @@ index 7fc594620793..9082ae71219f 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(
@@ -5412,7 +5414,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( @@ -5446,7 +5448,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
} }
return blink::kWebNavigationPolicyIgnore; return blink::kWebNavigationPolicyIgnore;
} }

View File

@@ -1,8 +1,8 @@
diff --git third_party/crashpad/crashpad/client/prune_crash_reports.cc third_party/crashpad/crashpad/client/prune_crash_reports.cc diff --git third_party/crashpad/crashpad/client/prune_crash_reports.cc third_party/crashpad/crashpad/client/prune_crash_reports.cc
index 3aaaeee5d07f..d99fcb418d9e 100644 index 3aaaeee5d07f..9d2e7bcbd621 100644
--- third_party/crashpad/crashpad/client/prune_crash_reports.cc --- third_party/crashpad/crashpad/client/prune_crash_reports.cc
+++ third_party/crashpad/crashpad/client/prune_crash_reports.cc +++ third_party/crashpad/crashpad/client/prune_crash_reports.cc
@@ -67,13 +67,19 @@ void PruneCrashReportDatabase(CrashReportDatabase* database, @@ -67,13 +67,20 @@ void PruneCrashReportDatabase(CrashReportDatabase* database,
} }
// static // static
@@ -17,10 +17,12 @@ index 3aaaeee5d07f..d99fcb418d9e 100644
+ if (max_age_in_days <= 0) + if (max_age_in_days <= 0)
+ max_age_in_days = 365; + max_age_in_days = 365;
return base::WrapUnique( return base::WrapUnique(
new BinaryPruneCondition(BinaryPruneCondition::OR, - new BinaryPruneCondition(BinaryPruneCondition::OR,
- new DatabaseSizePruneCondition(1024 * 128), - new DatabaseSizePruneCondition(1024 * 128),
- new AgePruneCondition(365))); - new AgePruneCondition(365)));
+ new DatabaseSizePruneCondition(max_size_in_mb), + new BinaryPruneCondition(
+ BinaryPruneCondition::OR,
+ new DatabaseSizePruneCondition(1024 * max_size_in_mb),
+ new AgePruneCondition(max_age_in_days))); + new AgePruneCondition(max_age_in_days)));
} }

View File

@@ -1,5 +1,5 @@
diff --git content/browser/frame_host/render_frame_host_manager.cc content/browser/frame_host/render_frame_host_manager.cc diff --git content/browser/frame_host/render_frame_host_manager.cc content/browser/frame_host/render_frame_host_manager.cc
index 799d2925b21a..43f9173e5db2 100644 index 22645479cadc..0c0e92f6ed72 100644
--- content/browser/frame_host/render_frame_host_manager.cc --- content/browser/frame_host/render_frame_host_manager.cc
+++ content/browser/frame_host/render_frame_host_manager.cc +++ content/browser/frame_host/render_frame_host_manager.cc
@@ -1072,10 +1072,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( @@ -1072,10 +1072,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation(
@@ -18,7 +18,7 @@ index 799d2925b21a..43f9173e5db2 100644
return true; return true;
} }
@@ -1197,7 +1198,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( @@ -1214,7 +1215,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation(
// Double-check that the new SiteInstance is associated with the right // Double-check that the new SiteInstance is associated with the right
// BrowserContext. // BrowserContext.
@@ -29,7 +29,7 @@ index 799d2925b21a..43f9173e5db2 100644
// If |new_instance| is a new SiteInstance for a subframe with an isolated // If |new_instance| is a new SiteInstance for a subframe with an isolated
// origin, set its process reuse policy so that such subframes are // origin, set its process reuse policy so that such subframes are
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
index 507f728ffe5b..20c49cc25387 100644 index 9e09d8dbfc35..6c0609aa4dbb 100644
--- content/public/browser/content_browser_client.h --- content/public/browser/content_browser_client.h
+++ content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h
@@ -316,6 +316,13 @@ class CONTENT_EXPORT ContentBrowserClient { @@ -316,6 +316,13 @@ class CONTENT_EXPORT ContentBrowserClient {

View File

@@ -1,5 +1,18 @@
diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn
index 0acb460fe62d..5b0183fb7540 100644
--- build/config/compiler/BUILD.gn
+++ build/config/compiler/BUILD.gn
@@ -415,7 +415,7 @@ config("compiler") {
# chromeos binutils has been patched with the fix, so always use icf there.
# The bug only affects x86 and x64, so we can still use ICF when targeting
# other architectures.
- if ((!is_android && linux_use_bundled_binutils) || is_chromeos ||
+ if ((!is_android && linux_use_bundled_binutils && current_cpu != "x86") || is_chromeos ||
!(current_cpu == "x86" || current_cpu == "x64")) {
ldflags += [ "-Wl,--icf=all" ]
}
diff --git chrome/browser/ui/libgtkui/gtk_ui.cc chrome/browser/ui/libgtkui/gtk_ui.cc diff --git chrome/browser/ui/libgtkui/gtk_ui.cc chrome/browser/ui/libgtkui/gtk_ui.cc
index f45f2b1..dbabf1b 100644 index f45f2b10a842..dbabf1bb7f3b 100644
--- chrome/browser/ui/libgtkui/gtk_ui.cc --- chrome/browser/ui/libgtkui/gtk_ui.cc
+++ chrome/browser/ui/libgtkui/gtk_ui.cc +++ chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -92,6 +92,7 @@ namespace libgtkui { @@ -92,6 +92,7 @@ namespace libgtkui {

View File

@@ -0,0 +1,21 @@
diff --git third_party/widevine/cdm/BUILD.gn third_party/widevine/cdm/BUILD.gn
index a3eac59cc2eb..d14e71e0319b 100644
--- third_party/widevine/cdm/BUILD.gn
+++ third_party/widevine/cdm/BUILD.gn
@@ -111,14 +111,8 @@ if (widevine_cdm_binary_files != []) {
]
if (is_mac) {
- ldflags = [
- # Not to strip important symbols by -Wl,-dead_strip.
- "-Wl,-exported_symbol,_PPP_GetInterface",
- "-Wl,-exported_symbol,_PPP_InitializeModule",
- "-Wl,-exported_symbol,_PPP_ShutdownModule",
- ]
- #TODO(jrummell) Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
- } else if (is_posix && !is_mac) {
+ ldflags = [ "-Wl,-install_name,@loader_path/libwidevinecdm.dylib" ]
+ } else if (is_posix) {
cflags = [ "-fvisibility=hidden" ]
}
}

View File

@@ -55,10 +55,10 @@ index b594cba1a6fc..285eae814c50 100644
} // namespace net } // namespace net
diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc
index 718c70b8f865..0973f4ac142c 100644 index b8d57e4546f5..174b68e355c2 100644
--- net/http/transport_security_state.cc --- net/http/transport_security_state.cc
+++ net/http/transport_security_state.cc +++ net/http/transport_security_state.cc
@@ -1550,8 +1550,10 @@ void TransportSecurityState::ClearReportCachesForTesting() { @@ -1526,8 +1526,10 @@ void TransportSecurityState::ClearReportCachesForTesting() {
sent_expect_ct_reports_cache_.Clear(); sent_expect_ct_reports_cache_.Clear();
} }

View File

@@ -1,5 +1,5 @@
diff --git content/public/common/common_param_traits_macros.h content/public/common/common_param_traits_macros.h diff --git content/public/common/common_param_traits_macros.h content/public/common/common_param_traits_macros.h
index 24302aa9a63b..ba5c08bf5892 100644 index f0df22851a1c..422b001d8fd8 100644
--- content/public/common/common_param_traits_macros.h --- content/public/common/common_param_traits_macros.h
+++ content/public/common/common_param_traits_macros.h +++ content/public/common/common_param_traits_macros.h
@@ -205,6 +205,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) @@ -205,6 +205,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@@ -11,7 +11,7 @@ index 24302aa9a63b..ba5c08bf5892 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop) IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled) IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git content/public/common/web_preferences.cc content/public/common/web_preferences.cc diff --git content/public/common/web_preferences.cc content/public/common/web_preferences.cc
index a9c7b7d8c3ae..7c9d26fb223f 100644 index 528e7996e03c..797df36d9710 100644
--- content/public/common/web_preferences.cc --- content/public/common/web_preferences.cc
+++ content/public/common/web_preferences.cc +++ content/public/common/web_preferences.cc
@@ -170,6 +170,7 @@ WebPreferences::WebPreferences() @@ -170,6 +170,7 @@ WebPreferences::WebPreferences()
@@ -23,7 +23,7 @@ index a9c7b7d8c3ae..7c9d26fb223f 100644
record_whole_document(false), record_whole_document(false),
cookie_enabled(true), cookie_enabled(true),
diff --git content/public/common/web_preferences.h content/public/common/web_preferences.h diff --git content/public/common/web_preferences.h content/public/common/web_preferences.h
index 1e24ea16ae51..2c4062d42992 100644 index 1d4cf92e3471..5d84e907b378 100644
--- content/public/common/web_preferences.h --- content/public/common/web_preferences.h
+++ content/public/common/web_preferences.h +++ content/public/common/web_preferences.h
@@ -191,6 +191,7 @@ struct CONTENT_EXPORT WebPreferences { @@ -191,6 +191,7 @@ struct CONTENT_EXPORT WebPreferences {
@@ -35,10 +35,10 @@ index 1e24ea16ae51..2c4062d42992 100644
bool record_whole_document; bool record_whole_document;
diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc
index 344e89232ca7..c74e5c5432ed 100644 index 5f27dda43991..c149a53c1578 100644
--- content/renderer/render_view_impl.cc --- content/renderer/render_view_impl.cc
+++ content/renderer/render_view_impl.cc +++ content/renderer/render_view_impl.cc
@@ -1309,6 +1309,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( @@ -1311,6 +1311,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

@@ -59,11 +59,15 @@ index 13d802fa72cd..a2d34d1d72eb 100644
partition->GetBluetoothAllowedDevicesMap(); partition->GetBluetoothAllowedDevicesMap();
return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin()); return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin());
diff --git content/browser/browser_context.cc content/browser/browser_context.cc diff --git content/browser/browser_context.cc content/browser/browser_context.cc
index 42b002908c3b..f7d9c3933090 100644 index 42b002908c3b..6787b9ed35b7 100644
--- content/browser/browser_context.cc --- content/browser/browser_context.cc
+++ content/browser/browser_context.cc +++ content/browser/browser_context.cc
@@ -125,7 +125,14 @@ StoragePartition* GetStoragePartitionFromConfig( @@ -122,10 +122,17 @@ StoragePartition* GetStoragePartitionFromConfig(
if (browser_context->IsOffTheRecord()) StoragePartitionImplMap* partition_map =
GetStoragePartitionMap(browser_context);
- if (browser_context->IsOffTheRecord())
+ if (browser_context->IsOffTheRecord() || browser_context->GetPath().empty())
in_memory = true; in_memory = true;
- return partition_map->Get(partition_domain, partition_name, in_memory); - return partition_map->Get(partition_domain, partition_name, in_memory);
@@ -669,3 +673,16 @@ index cf270b894186..1f95c9c3b023 100644
protected: protected:
virtual ~StoragePartition() {} virtual ~StoragePartition() {}
}; };
diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc
index 86fb9f41fc71..7a8be02473a3 100644
--- storage/browser/database/database_tracker.cc
+++ storage/browser/database/database_tracker.cc
@@ -495,7 +495,7 @@ bool DatabaseTracker::LazyInit() {
meta_table_.reset(new sql::MetaTable());
is_initialized_ =
- base::CreateDirectory(db_dir_) &&
+ (is_incognito_ ? true : base::CreateDirectory(db_dir_)) &&
(db_->is_open() ||
(is_incognito_ ? db_->OpenInMemory() :
db_->Open(kTrackerDatabaseFullPath))) &&

View File

@@ -135,7 +135,7 @@ index f772f64d656e..7d13f9f81b6c 100644
return host ? host->GetAcceleratedWidget() : NULL; return host ? host->GetAcceleratedWidget() : NULL;
} }
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index c332dc7e0a58..6be166492241 100644 index e5b007cd0a4a..e9d5da995630 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( @@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
@@ -160,7 +160,7 @@ index c332dc7e0a58..6be166492241 100644
remove_standard_frame_ = params.remove_standard_frame; remove_standard_frame_ = params.remove_standard_frame;
has_non_client_view_ = Widget::RequiresNonClientView(params.type); has_non_client_view_ = Widget::RequiresNonClientView(params.type);
@@ -825,11 +830,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { @@ -829,11 +834,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
} }
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@@ -179,10 +179,10 @@ index c332dc7e0a58..6be166492241 100644
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index 4ee4bb30a122..5441d5e8a2a5 100644 index eb1205ee6a5e..0f45d7f89611 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -265,6 +265,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -271,6 +271,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// True if the window should have the frame removed. // True if the window should have the frame removed.
bool remove_standard_frame_; bool remove_standard_frame_;
@@ -194,7 +194,7 @@ index 4ee4bb30a122..5441d5e8a2a5 100644
// a reference. // a reference.
corewm::TooltipWin* tooltip_; corewm::TooltipWin* tooltip_;
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index fa2878ae0d1d..fde5a8e549be 100644 index 316cf855f7cf..ba52793ba622 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -152,6 +152,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( @@ -152,6 +152,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@@ -427,10 +427,10 @@ index 163e4b54b033..58f594db5019 100644
if (native_widget_delegate->IsDialogBox()) { if (native_widget_delegate->IsDialogBox()) {
*style |= DS_MODALFRAME; *style |= DS_MODALFRAME;
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 4af7811d64d9..7f8f08900ac1 100644 index 9664c7462797..cdc173e50019 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
@@ -2659,8 +2659,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, @@ -2664,8 +2664,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
active_mouse_tracking_flags_ = 0; active_mouse_tracking_flags_ = 0;
} else if (event.type() == ui::ET_MOUSEWHEEL) { } else if (event.type() == ui::ET_MOUSEWHEEL) {
// Reroute the mouse wheel to the window under the pointer if applicable. // Reroute the mouse wheel to the window under the pointer if applicable.

View File

@@ -1,5 +1,5 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 5b54c7614dcb..89addf197fae 100644 index b46cec9804d1..998e8c7d12dc 100644
--- content/browser/web_contents/web_contents_impl.cc --- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc
@@ -1772,6 +1772,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { @@ -1772,6 +1772,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -23,7 +23,7 @@ index 5b54c7614dcb..89addf197fae 100644
if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) { if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) {
view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
@@ -2343,6 +2350,15 @@ void WebContentsImpl::CreateNewWindow( @@ -2350,6 +2357,15 @@ void WebContentsImpl::CreateNewWindow(
create_params.renderer_initiated_creation = create_params.renderer_initiated_creation =
main_frame_route_id != MSG_ROUTING_NONE; main_frame_route_id != MSG_ROUTING_NONE;
@@ -39,7 +39,7 @@ index 5b54c7614dcb..89addf197fae 100644
WebContentsImpl* new_contents = NULL; WebContentsImpl* new_contents = NULL;
if (!is_guest) { if (!is_guest) {
create_params.context = view_->GetNativeView(); create_params.context = view_->GetNativeView();
@@ -2372,7 +2388,7 @@ void WebContentsImpl::CreateNewWindow( @@ -2379,7 +2395,7 @@ void WebContentsImpl::CreateNewWindow(
// TODO(brettw): It seems bogus that we have to call this function on the // TODO(brettw): It seems bogus that we have to call this function on the
// newly created object and give it one of its own member variables. // newly created object and give it one of its own member variables.
new_view->CreateViewForWidget( new_view->CreateViewForWidget(
@@ -48,7 +48,7 @@ index 5b54c7614dcb..89addf197fae 100644
} }
// Save the created window associated with the route so we can show it // Save the created window associated with the route so we can show it
// later. // later.
@@ -5534,7 +5550,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { @@ -5541,7 +5557,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() {
void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
RenderViewHost* render_view_host) { RenderViewHost* render_view_host) {
RenderWidgetHostViewBase* rwh_view = RenderWidgetHostViewBase* rwh_view =
@@ -73,7 +73,7 @@ index fa0afb545df9..d677b310e5ec 100644
WebContents::CreateParams::CreateParams(const CreateParams& other) = default; WebContents::CreateParams::CreateParams(const CreateParams& other) = default;
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index ddaf664254ab..ffec3b79332e 100644 index 9c27ee5021de..fd34d821e0d4 100644
--- content/public/browser/web_contents.h --- content/public/browser/web_contents.h
+++ content/public/browser/web_contents.h +++ content/public/browser/web_contents.h
@@ -68,9 +68,11 @@ class PageState; @@ -68,9 +68,11 @@ class PageState;

View File

@@ -50,7 +50,7 @@ index 7ea90b01b4c6..30e54df93efc 100644
TransformationMatrix device_emulation_transform_; TransformationMatrix device_emulation_transform_;
diff --git third_party/WebKit/Source/core/page/ChromeClientImpl.cpp third_party/WebKit/Source/core/page/ChromeClientImpl.cpp diff --git third_party/WebKit/Source/core/page/ChromeClientImpl.cpp third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
index 581b6b5b9538..14aec97bd676 100644 index f29df35de114..11a980f1be27 100644
--- third_party/WebKit/Source/core/page/ChromeClientImpl.cpp --- third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
+++ third_party/WebKit/Source/core/page/ChromeClientImpl.cpp +++ third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
@@ -776,7 +776,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, @@ -776,7 +776,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame,

View File

@@ -1,5 +1,5 @@
diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd
index 97b732500593..899c6a710344 100644 index 7a4995c2608f..3b83366d6372 100644
--- chrome/app/generated_resources.grd --- chrome/app/generated_resources.grd
+++ chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd
@@ -5060,7 +5060,7 @@ Keep your key file in a safe place. You will need it to create new versions of y @@ -5060,7 +5060,7 @@ Keep your key file in a safe place. You will need it to create new versions of y

View File

@@ -0,0 +1,18 @@
diff --git content/common/sandbox_win.cc content/common/sandbox_win.cc
index a98c8bd7646b..7c100ff20d34 100644
--- content/common/sandbox_win.cc
+++ content/common/sandbox_win.cc
@@ -782,8 +782,11 @@ sandbox::ResultCode StartSandboxedProcess(
#endif
// Post-startup mitigations.
- mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS |
- sandbox::MITIGATION_DLL_SEARCH_ORDER;
+ mitigations = sandbox::MITIGATION_DLL_SEARCH_ORDER;
+ if (!browser_command_line.HasSwitch("win-rt-app")) {
+ // Don't enable this mitigation in WinRT apps. See issue #2274.
+ mitigations |= sandbox::MITIGATION_STRICT_HANDLE_CHECKS;
+ }
if (base::FeatureList::IsEnabled(features::kWinSboxForceMsSigned))
mitigations |= sandbox::MITIGATION_FORCE_MS_SIGNED_BINS;

View File

@@ -0,0 +1,472 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "tests/ceftests/extensions/extension_test_handler.h"
#include "tests/ceftests/test_util.h"
#include "tests/shared/browser/extension_util.h"
#define STORAGE_TEST_GROUP_ALL(name, test_class) \
EXTENSION_TEST_GROUP_ALL(ChromeStorage##name, test_class)
#define STORAGE_TEST_GROUP_MINIMAL(name, test_class) \
EXTENSION_TEST_GROUP_MINIMAL(ChromeStorage##name, test_class)
namespace {
const char kExtensionPath[] = "storage-extension";
const char kSuccessMessage[] = "success";
// Base class for testing chrome.storage methods.
// See https://developer.chrome.com/extensions/storage
class StorageTestHandler : public ExtensionTestHandler {
public:
explicit StorageTestHandler(RequestContextType request_context_type)
: ExtensionTestHandler(request_context_type) {
// Only creating the extension browser.
set_create_main_browser(false);
}
// CefExtensionHandler methods:
void OnExtensionLoaded(CefRefPtr<CefExtension> extension) override {
EXPECT_TRUE(CefCurrentlyOn(TID_UI));
EXPECT_FALSE(got_loaded_);
got_loaded_.yes();
// Verify |extension| contents.
EXPECT_FALSE(extension->GetIdentifier().empty());
EXPECT_STREQ(("extensions/" + std::string(kExtensionPath)).c_str(),
client::extension_util::GetInternalExtensionResourcePath(
extension->GetPath())
.c_str());
TestDictionaryEqual(CreateManifest(), extension->GetManifest());
EXPECT_FALSE(extension_);
extension_ = extension;
CreateBrowserForExtension();
}
void OnExtensionUnloaded(CefRefPtr<CefExtension> extension) override {
EXPECT_TRUE(CefCurrentlyOn(TID_UI));
EXPECT_TRUE(extension_);
EXPECT_TRUE(extension_->IsSame(extension));
EXPECT_FALSE(got_unloaded_);
got_unloaded_.yes();
extension_ = NULL;
// Execute asynchronously so call stacks have a chance to unwind.
// Will close the browser windows.
CefPostTask(TID_UI, base::Bind(&StorageTestHandler::DestroyTest, this));
}
// CefLoadHandler methods:
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading,
bool canGoBack,
bool canGoForward) override {
CefRefPtr<CefExtension> extension = browser->GetHost()->GetExtension();
EXPECT_TRUE(extension);
EXPECT_TRUE(extension_->IsSame(extension));
if (isLoading) {
EXPECT_FALSE(extension_browser_);
extension_browser_ = browser;
} else {
EXPECT_TRUE(browser->IsSame(extension_browser_));
const std::string& url = browser->GetMainFrame()->GetURL();
EXPECT_STREQ(extension_url_.c_str(), url.c_str());
}
}
// CefRequestHandler methods:
CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) override {
EXPECT_TRUE(browser->IsSame(extension_browser_));
CefRefPtr<CefExtension> extension = browser->GetHost()->GetExtension();
EXPECT_TRUE(extension);
EXPECT_TRUE(extension_->IsSame(extension));
const std::string& url = request->GetURL();
EXPECT_STREQ(extension_url_.c_str(), url.c_str());
EXPECT_FALSE(got_url_request_);
got_url_request_.yes();
// Handle the resource request.
return RoutingTestHandler::GetResourceHandler(browser, frame, request);
}
protected:
void OnLoadExtensions() override {
LoadExtension(kExtensionPath, CreateManifest());
}
bool OnMessage(CefRefPtr<CefBrowser> browser,
const std::string& message) override {
if (message == "extension_onload") {
// From body onLoad in the extension browser.
EXPECT_TRUE(browser->IsSame(extension_browser_));
EXPECT_FALSE(got_body_onload_);
got_body_onload_.yes();
TriggerStorageApiJSFunction();
return true;
}
EXPECT_TRUE(browser->IsSame(extension_browser_));
EXPECT_FALSE(got_success_message_);
got_success_message_.yes();
EXPECT_STREQ(kSuccessMessage, message.c_str());
TriggerDestroyTest();
return true;
}
void OnDestroyTest() override {
extension_browser_ = NULL;
EXPECT_TRUE(got_loaded_);
EXPECT_TRUE(got_url_request_);
EXPECT_TRUE(got_body_onload_);
EXPECT_TRUE(got_trigger_api_function_);
EXPECT_TRUE(got_success_message_);
EXPECT_TRUE(got_unloaded_);
}
// Create a manifest that grants access to the storage API.
virtual CefRefPtr<CefDictionaryValue> CreateManifest() const {
ApiPermissionsList api_permissions;
api_permissions.push_back("storage");
return CreateDefaultManifest(api_permissions);
}
// Add resources in the extension browser.
virtual void OnAddExtensionResources(const std::string& origin) {
extension_url_ = origin + "extension.html";
AddResource(extension_url_, GetExtensionHTML(), "text/html");
}
// Returns the chrome.storage.* JS that is executed in the extension browser
// when the triggerStorageApi() JS function is called.
virtual std::string GetStorageApiJS() const = 0;
// Returns the JS that will be loaded in the extension browser. This
// implements the triggerStorageApi() JS function called from
// TriggerStorageApiJSFunction().
virtual std::string GetExtensionJS() const {
return "function triggerStorageApi() {" + GetStorageApiJS() + "}";
}
// Returns the HTML that will be loaded in the extension browser.
virtual std::string GetExtensionHTML() const {
return "<html><head><script>" + GetExtensionJS() +
"</script></head><body onLoad=" + GetMessageJS("extension_onload") +
">Extension</body></html>";
}
virtual void TriggerDestroyTest() {
// Execute asynchronously so call stacks have a chance to unwind.
CefPostTask(TID_UI, base::Bind(&StorageTestHandler::UnloadExtension, this,
extension_));
}
CefRefPtr<CefExtension> extension() const { return extension_; }
std::string extension_url() const { return extension_url_; }
CefRefPtr<CefBrowser> extension_browser() const { return extension_browser_; }
bool got_success_message() const { return got_success_message_; }
private:
void CreateBrowserForExtension() {
const std::string& identifier = extension_->GetIdentifier();
EXPECT_FALSE(identifier.empty());
const std::string& origin =
client::extension_util::GetExtensionOrigin(identifier);
EXPECT_FALSE(origin.empty());
// Add extension resources.
OnAddExtensionResources(origin);
// Create a browser to host the extension.
CreateBrowser(extension_url_, request_context());
}
void TriggerStorageApiJSFunction() {
EXPECT_FALSE(got_trigger_api_function_);
got_trigger_api_function_.yes();
extension_browser_->GetMainFrame()->ExecuteJavaScript(
"triggerStorageApi();", extension_url_, 0);
}
CefRefPtr<CefExtension> extension_;
std::string extension_url_;
CefRefPtr<CefBrowser> extension_browser_;
TrackCallback got_loaded_;
TrackCallback got_url_request_;
TrackCallback got_body_onload_;
TrackCallback got_trigger_api_function_;
TrackCallback got_success_message_;
TrackCallback got_unloaded_;
};
} // namespace
namespace {
// Test for chrome.storage.local.set(object items, function callback)
// and for chrome.storage.local.get(string or array of string or object keys,
// function callback)
class LocalStorageTestHandler : public StorageTestHandler {
public:
explicit LocalStorageTestHandler(RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.local.set({\"local_key_1\": \"local_value_1\"}, function() {"
"chrome.storage.local.get(\"local_key_1\", function (items) {"
"if(items[\"local_key_1\"] == \"local_value_1\") {" +
GetMessageJS(kSuccessMessage) +
"}});"
"});";
}
private:
IMPLEMENT_REFCOUNTING(LocalStorageTestHandler);
DISALLOW_COPY_AND_ASSIGN(LocalStorageTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_ALL(LocalStorage, LocalStorageTestHandler);
namespace {
// Test for chrome.storage.local.getBytesInUse(string or array of string keys,
// function callback)
class LocalStorageGetBytesInUseTestHandler : public StorageTestHandler {
public:
explicit LocalStorageGetBytesInUseTestHandler(
RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.local.set({\"local_key_2\": \"local_value_2\"}, function() {"
"chrome.storage.local.getBytesInUse(\"local_key_2\", function (bytesInUse) {"
"if (bytesInUse == 26) {" +
GetMessageJS(kSuccessMessage) +
"}});"
"});";
}
private:
IMPLEMENT_REFCOUNTING(LocalStorageGetBytesInUseTestHandler);
DISALLOW_COPY_AND_ASSIGN(LocalStorageGetBytesInUseTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(LocalStorageGetBytesInUse,
LocalStorageGetBytesInUseTestHandler);
namespace {
// Test for chrome.storage.local.remove(string or array of string keys, function
// callback)
class LocalStorageRemoveTestHandler : public StorageTestHandler {
public:
explicit LocalStorageRemoveTestHandler(
RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.local.set({\"local_key_3\": \"local_value_3\"}, function() {"
"chrome.storage.local.remove(\"local_key_3\", function () {"
"chrome.storage.local.get(\"local_key_3\", function(items) {"
"if (items[\"local_key_3\"] == undefined) {" +
GetMessageJS(kSuccessMessage) +
"}})})"
"});";
}
private:
IMPLEMENT_REFCOUNTING(LocalStorageRemoveTestHandler);
DISALLOW_COPY_AND_ASSIGN(LocalStorageRemoveTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(LocalStorageRemove, LocalStorageRemoveTestHandler);
namespace {
// Test for chrome.storage.local.clear(function callback)
class LocalStorageClearTestHandler : public StorageTestHandler {
public:
explicit LocalStorageClearTestHandler(RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "var value1Cleared = false;"
"var value2Cleared = false;"
"function checkCleared() {"
"if (value1Cleared && value2Cleared) {"
+ GetMessageJS(kSuccessMessage) +
"}}"
"chrome.storage.local.set({\"local_key_4\": \"local_value_4\","
"\"local_key_5\": \"local_value_5\"}, function() {"
"chrome.storage.local.clear(function () {"
"chrome.storage.local.get(\"local_key_4\", function(items) {"
"if (items[\"local_key_4\"] == undefined) {"
"value1Cleared = true;"
"checkCleared();"
"}});"
"chrome.storage.local.get(\"local_key_5\", function(items) {"
"if (items[\"local_key_5\"] == undefined) {"
"value2Cleared = true;"
"checkCleared();"
"}});"
"})});";
}
private:
IMPLEMENT_REFCOUNTING(LocalStorageClearTestHandler);
DISALLOW_COPY_AND_ASSIGN(LocalStorageClearTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(LocalStorageClear, LocalStorageClearTestHandler);
namespace {
// Test for chrome.storage.sync.set(object items, function callback)
// and for chrome.storage.sync.get(string or array of string or object keys,
// function callback)
class SyncStorageTestHandler : public StorageTestHandler {
public:
explicit SyncStorageTestHandler(RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.sync.set({\"sync_key_1\": \"sync_value_1\"}, function() {"
"chrome.storage.sync.get(\"sync_key_1\", function (items) {"
"if (items[\"sync_key_1\"] == \"sync_value_1\") {" +
GetMessageJS(kSuccessMessage) +
"}});"
"});";
}
private:
IMPLEMENT_REFCOUNTING(SyncStorageTestHandler);
DISALLOW_COPY_AND_ASSIGN(SyncStorageTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_ALL(SyncStorage, SyncStorageTestHandler);
namespace {
// Test for chrome.storage.sync.getBytesInUse(string or array of string keys,
// function callback)
class SyncStorageGetBytesInUseTestHandler : public StorageTestHandler {
public:
explicit SyncStorageGetBytesInUseTestHandler(
RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.sync.set({\"sync_key_2\": \"sync_value_2\"}, function() {"
"chrome.storage.sync.getBytesInUse(\"sync_key_2\", function (bytesInUse) {"
"if (bytesInUse == 24) {" +
GetMessageJS(kSuccessMessage) +
"}});"
"});";
}
private:
IMPLEMENT_REFCOUNTING(SyncStorageGetBytesInUseTestHandler);
DISALLOW_COPY_AND_ASSIGN(SyncStorageGetBytesInUseTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(SyncStorageGetBytesInUse,
SyncStorageGetBytesInUseTestHandler);
namespace {
// Test for chrome.storage.sync.remove(string or array of string keys, function
// callback)
class SyncStorageRemoveTestHandler : public StorageTestHandler {
public:
explicit SyncStorageRemoveTestHandler(RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "chrome.storage.sync.set({\"sync_key_3\": \"sync_value_3\"}, function() {"
"chrome.storage.sync.remove(\"sync_key_3\", function () {"
"chrome.storage.sync.get(\"sync_key_3\", function(items) {"
"if (items[\"sync_key_3\"] == undefined) {" +
GetMessageJS(kSuccessMessage) +
"}})})"
"});";
}
private:
IMPLEMENT_REFCOUNTING(SyncStorageRemoveTestHandler);
DISALLOW_COPY_AND_ASSIGN(SyncStorageRemoveTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(SyncStorageRemove, SyncStorageRemoveTestHandler);
namespace {
// Test for chrome.storage.sync.clear(function callback)
class SyncStorageClearTestHandler : public StorageTestHandler {
public:
explicit SyncStorageClearTestHandler(RequestContextType request_context_type)
: StorageTestHandler(request_context_type) {}
protected:
std::string GetStorageApiJS() const override {
return "var value1Cleared = false;"
"var value2Cleared = false;"
"function checkCleared() {"
"if (value1Cleared && value2Cleared) {"
+ GetMessageJS(kSuccessMessage) +
"}}"
"chrome.storage.sync.set({\"sync_key_4\": \"sync_value_4\","
"\"sync_key_5\": \"sync_value_5\"}, function() {"
"chrome.storage.sync.clear(function () {"
"chrome.storage.sync.get(\"sync_key_4\", function(items) {"
"if (items[\"sync_key_4\"] == undefined) {"
"value1Cleared = true;"
"checkCleared();"
"}});"
"chrome.storage.sync.get(\"sync_key_5\", function(items) {"
"if (items[\"sync_key_5\"] == undefined) {"
"value2Cleared = true;"
"checkCleared();"
"}});"
"})});";
}
private:
IMPLEMENT_REFCOUNTING(SyncStorageClearTestHandler);
DISALLOW_COPY_AND_ASSIGN(SyncStorageClearTestHandler);
};
} // namespace
STORAGE_TEST_GROUP_MINIMAL(SyncStorageClear, SyncStorageClearTestHandler);

View File

@@ -6,6 +6,8 @@
#include <sstream> #include <sstream>
#include "include/cef_parser.h"
#include "tests/ceftests/test_util.h" #include "tests/ceftests/test_util.h"
#include "tests/shared/browser/extension_util.h" #include "tests/shared/browser/extension_util.h"
@@ -291,6 +293,7 @@ class TabsTestHandler : public ExtensionTestHandler {
void set_expected_api_call_count(int val) { expected_api_call_count_ = val; } void set_expected_api_call_count(int val) { expected_api_call_count_ = val; }
bool got_success_message() const { return got_success_message_; } bool got_success_message() const { return got_success_message_; }
void set_got_success_message() { got_success_message_.yes(); }
private: private:
void CreateBrowserForExtensionIfReady() { void CreateBrowserForExtensionIfReady() {
@@ -361,6 +364,175 @@ class TabsTestHandler : public ExtensionTestHandler {
int got_can_access_browser_count_; int got_can_access_browser_count_;
}; };
//
// chrome.tabs.create tests.
//
const char kCreateBrowserURL[] =
"https://test-extensions.com/chrome-tabs-create";
const char kTabCallbackMessage[] = "tab-callback";
const int kCreateTabIndex = 2;
// Class for chrome.tabs.create tests.
class CreateTestHandler : public TabsTestHandler {
public:
explicit CreateTestHandler(RequestContextType request_context_type)
: TabsTestHandler(request_context_type) {}
bool OnBeforeBrowser(CefRefPtr<CefExtension> extension,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefBrowser> active_browser,
int index,
const CefString& url,
bool foreground,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) override {
EXPECT_TRUE(extension->IsSame(this->extension()));
EXPECT_TRUE(browser->IsSame(extension_browser()));
EXPECT_TRUE(active_browser->IsSame(main_browser()));
EXPECT_EQ(kCreateTabIndex, index);
EXPECT_STREQ(kCreateBrowserURL, url.ToString().c_str());
EXPECT_TRUE(foreground);
EXPECT_TRUE(client);
EXPECT_FALSE(got_on_before_browser_);
got_on_before_browser_.yes();
return false;
}
void OnAddMainBrowserResources() override {
AddResource(kCreateBrowserURL, GetCreatedBrowserHTML(), "text/html");
TabsTestHandler::OnAddMainBrowserResources();
}
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading,
bool canGoBack,
bool canGoForward) override {
if (extension_browser() && main_browser()) {
if (isLoading) {
// Keep a reference to the newly created browser.
EXPECT_FALSE(created_browser_);
created_browser_ = browser;
return;
} else {
const std::string& url = browser->GetMainFrame()->GetURL();
if (url == kCreateBrowserURL) {
EXPECT_TRUE(browser->IsSame(created_browser_));
return;
}
}
}
TabsTestHandler::OnLoadingStateChange(browser, isLoading, canGoBack,
canGoForward);
}
CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) override {
const std::string& url = request->GetURL();
if (url == kCreateBrowserURL) {
EXPECT_TRUE(browser->IsSame(created_browser_));
EXPECT_FALSE(got_create_browser_url_request_);
got_create_browser_url_request_.yes();
}
return TabsTestHandler::GetResourceHandler(browser, frame, request);
}
protected:
std::string GetTabsApiJS() const override {
std::stringstream ss;
ss << kCreateTabIndex;
return "chrome.tabs.create({url: \"" + std::string(kCreateBrowserURL) +
"\", index: " + ss.str() +
"}, function(tab) { window.testQuery({request:'" +
kTabCallbackMessage + ":' + JSON.stringify(tab)}); });";
}
bool OnMessage(CefRefPtr<CefBrowser> browser,
const std::string& message) override {
if (message.find(kTabCallbackMessage) != std::string::npos) {
EXPECT_TRUE(browser->IsSame(extension_browser()));
EXPECT_FALSE(got_tab_callback_message_);
got_tab_callback_message_.yes();
// Verify the contents of the Tab object.
const std::string& json_str =
message.substr(strlen(kTabCallbackMessage) + 1);
CefRefPtr<CefValue> obj = CefParseJSON(json_str, JSON_PARSER_RFC);
EXPECT_TRUE(obj);
EXPECT_EQ(VTYPE_DICTIONARY, obj->GetType());
CefRefPtr<CefDictionaryValue> dict = obj->GetDictionary();
int index = dict->GetInt("index");
EXPECT_EQ(kCreateTabIndex, index);
int id = dict->GetInt("id");
int windowId = dict->GetInt("windowId");
EXPECT_EQ(created_browser_->GetIdentifier(), id);
EXPECT_EQ(created_browser_->GetIdentifier(), windowId);
const std::string& url = dict->GetString("url");
EXPECT_STREQ(kCreateBrowserURL, url.c_str());
TriggerDestroyTestIfReady();
return true;
} else if (message == kSuccessMessage) {
// Overriding default kSuccessMessage handling.
EXPECT_TRUE(browser->IsSame(created_browser_));
EXPECT_FALSE(got_success_message());
set_got_success_message();
TriggerDestroyTestIfReady();
return true;
}
return TabsTestHandler::OnMessage(browser, message);
}
void OnDestroyTest() override {
created_browser_ = NULL;
EXPECT_TRUE(got_on_before_browser_);
EXPECT_TRUE(got_create_browser_url_request_);
EXPECT_TRUE(got_tab_callback_message_);
TabsTestHandler::OnDestroyTest();
}
private:
std::string GetCreatedBrowserHTML() {
return "<html><body onLoad=" + GetMessageJS(kSuccessMessage) +
">Created</body></html>";
}
void TriggerDestroyTestIfReady() {
if (got_tab_callback_message_ && got_success_message())
TriggerDestroyTest();
}
CefRefPtr<CefBrowser> created_browser_;
TrackCallback got_on_before_browser_;
TrackCallback got_create_browser_url_request_;
TrackCallback got_tab_callback_message_;
IMPLEMENT_REFCOUNTING(CreateTestHandler);
DISALLOW_COPY_AND_ASSIGN(CreateTestHandler);
};
} // namespace
TABS_TEST_GROUP_ALL(Create, CreateTestHandler);
namespace {
// //
// chrome.tabs.executeScript tests. // chrome.tabs.executeScript tests.
// //

View File

@@ -135,8 +135,8 @@ class AccessibilityTestHandler : public TestHandler,
// Get the first update dict and validate event type // Get the first update dict and validate event type
CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0); CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0);
// ignore other events // Ignore other events.
if (dict->GetString("event_type").ToString() != "layoutComplete") if (dict->GetString("event_type") != "layoutComplete")
break; break;
SetEditBoxIdAndRect(dict->GetDictionary("update")); SetEditBoxIdAndRect(dict->GetDictionary("update"));
@@ -159,8 +159,8 @@ class AccessibilityTestHandler : public TestHandler,
// Get the first update dict and validate event type // Get the first update dict and validate event type
CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0); CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0);
// ignore other events // Ignore other events.
if (dict->GetString("event_type").ToString() != "layoutComplete") if (dict->GetString("event_type") != "layoutComplete")
break; break;
// Now post a delayed task to trigger focus to edit box // Now post a delayed task to trigger focus to edit box
@@ -183,9 +183,9 @@ class AccessibilityTestHandler : public TestHandler,
// Get the first update dict and validate event type // Get the first update dict and validate event type
CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0); CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0);
// Validate Event type is Focus change // Ignore other events.
EXPECT_STREQ("focus", if (dict->GetString("event_type") != "focus")
dict->GetString("event_type").ToString().c_str()); return;
// And Focus is set to expected element edit_box // And Focus is set to expected element edit_box
EXPECT_TRUE(edit_box_id_ == dict->GetInt("id")); EXPECT_TRUE(edit_box_id_ == dict->GetInt("id"));
@@ -295,8 +295,10 @@ class AccessibilityTestHandler : public TestHandler,
// Get the first update dict and validate event type. // Get the first update dict and validate event type.
CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0); CefRefPtr<CefDictionaryValue> dict = list->GetDictionary(0);
EXPECT_STREQ("layoutComplete",
dict->GetString("event_type").ToString().c_str()); // Ignore other events.
if (dict->GetString("event_type") != "layoutComplete")
return;
// Get update and validate it has tree data // Get update and validate it has tree data
CefRefPtr<CefDictionaryValue> update = dict->GetDictionary("update"); CefRefPtr<CefDictionaryValue> update = dict->GetDictionary("update");

View File

@@ -48,6 +48,12 @@ void ClientAppBrowser::OnBeforeCommandLineProcessing(
command_line->AppendSwitchWithValue("top-chrome-md", "non-material"); command_line->AppendSwitchWithValue("top-chrome-md", "non-material");
} }
if (!command_line->HasSwitch(switches::kCachePath) &&
!command_line->HasSwitch("disable-gpu-shader-disk-cache")) {
// Don't create a "GPUCache" directory when cache-path is unspecified.
command_line->AppendSwitch("disable-gpu-shader-disk-cache");
}
DelegateSet::iterator it = delegates_.begin(); DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) for (; it != delegates_.end(); ++it)
(*it)->OnBeforeCommandLineProcessing(this, command_line); (*it)->OnBeforeCommandLineProcessing(this, command_line);

View File

@@ -67,6 +67,12 @@ run but any related functionality may become broken or disabled.
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.
* SwiftShader support.
* swiftshader/libEGL.dll
* swiftshader/libGLESv2.dll
Without these files WebGL will not function in software-only mode when the GPU
is not available or disabled.
* Widevine CDM support. * Widevine CDM support.
* widevinecdmadapter.dll * widevinecdmadapter.dll
Without this file playback of Widevine projected content will not function. Without this file playback of Widevine projected content will not function.

View File

@@ -654,17 +654,19 @@ if mode == 'standard':
if platform == 'windows': if platform == 'windows':
binaries = [ binaries = [
'chrome_elf.dll', {'path': 'chrome_elf.dll'},
'd3dcompiler_47.dll', {'path': 'd3dcompiler_47.dll'},
'libcef.dll', {'path': 'libcef.dll'},
'libEGL.dll', {'path': 'libEGL.dll'},
'libGLESv2.dll', {'path': 'libGLESv2.dll'},
'natives_blob.bin', {'path': 'natives_blob.bin'},
'snapshot_blob.bin', {'path': 'snapshot_blob.bin'},
'v8_context_snapshot.bin', {'path': 'v8_context_snapshot.bin'},
# Should match the output path from media/cdm/ppapi/cdm_paths.gni. # Should match the output path from media/cdm/ppapi/cdm_paths.gni.
'WidevineCdm\\_platform_specific\\win_%s\\widevinecdmadapter.dll' % \ {'path': 'WidevineCdm\\_platform_specific\\win_%s\\widevinecdmadapter.dll' % \
('x64' if options.x64build else 'x86'), ('x64' if options.x64build else 'x86'), 'strip_folder': True},
{'path': 'swiftshader\\libEGL.dll'},
{'path': 'swiftshader\\libGLESv2.dll'},
] ]
libcef_dll_file = 'libcef.dll.lib' libcef_dll_file = 'libcef.dll.lib'
@@ -673,6 +675,7 @@ if platform == 'windows':
'obj\\base\\base.lib', 'obj\\base\\base.lib',
'obj\\base\\base_static.lib', 'obj\\base\\base_static.lib',
'obj\\base\\third_party\\dynamic_annotations\\dynamic_annotations.lib', 'obj\\base\\third_party\\dynamic_annotations\\dynamic_annotations.lib',
'obj\\base\\win\\pe_image.lib',
cef_sandbox_lib, cef_sandbox_lib,
'obj\\sandbox\\win\\sandbox.lib', 'obj\\sandbox\\win\\sandbox.lib',
] ]
@@ -706,9 +709,13 @@ if platform == 'windows':
copy_files( copy_files(
os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
for binary in binaries: for binary in binaries:
if 'strip_folder' in binary and binary['strip_folder']:
target_path = os.path.join(dst_dir, os.path.basename(binary['path']))
else:
target_path = os.path.join(dst_dir, binary['path'])
make_dir(os.path.dirname(target_path), options.quiet)
copy_file( copy_file(
os.path.join(build_dir, binary), os.path.join(build_dir, binary['path']), target_path, options.quiet)
os.path.join(dst_dir, os.path.basename(binary)), options.quiet)
copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \ copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
options.quiet) options.quiet)
@@ -734,9 +741,13 @@ if platform == 'windows':
copy_files( copy_files(
os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
for binary in binaries: for binary in binaries:
if 'strip_folder' in binary and binary['strip_folder']:
target_path = os.path.join(dst_dir, os.path.basename(binary['path']))
else:
target_path = os.path.join(dst_dir, binary['path'])
make_dir(os.path.dirname(target_path), options.quiet)
copy_file( copy_file(
os.path.join(build_dir, binary), os.path.join(build_dir, binary['path']), target_path, options.quiet)
os.path.join(dst_dir, os.path.basename(binary)), options.quiet)
if mode != 'client': if mode != 'client':
copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \ copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
@@ -831,11 +842,11 @@ elif platform == 'macosx':
valid_build_dir = build_dir valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Debug') dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
framework_dst_dir = os.path.join(dst_dir, '%s.framework' % framework_name)
copy_dir(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/%s.framework' % framework_name), \ copy_dir(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/%s.framework' % framework_name), \
os.path.join(dst_dir, '%s.framework' % framework_name), options.quiet) framework_dst_dir, options.quiet)
copy_file( move_file(os.path.join(framework_dst_dir, 'Resources/widevinecdmadapter.plugin'), \
os.path.join(script_dir, 'distrib/mac/widevinecdmadapter.plugin'), os.path.join(dst_dir, 'widevinecdmadapter.plugin'), options.quiet)
dst_dir, options.quiet)
if not options.nosymbols: if not options.nosymbols:
# create the symbol output directory # create the symbol output directory
@@ -858,11 +869,11 @@ elif platform == 'macosx':
dst_dir = os.path.join(output_dir, 'Release') dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
if mode != 'client': if mode != 'client':
framework_dst_dir = os.path.join(dst_dir, '%s.framework' % framework_name)
copy_dir(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/%s.framework' % framework_name), \ copy_dir(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/%s.framework' % framework_name), \
os.path.join(dst_dir, '%s.framework' % framework_name), options.quiet) framework_dst_dir, options.quiet)
copy_file( move_file(os.path.join(framework_dst_dir, 'Resources/widevinecdmadapter.plugin'), \
os.path.join(script_dir, 'distrib/mac/widevinecdmadapter.plugin'), os.path.join(dst_dir, 'widevinecdmadapter.plugin'), options.quiet)
dst_dir, options.quiet)
else: else:
copy_dir( copy_dir(
os.path.join(build_dir, 'cefclient.app'), os.path.join(build_dir, 'cefclient.app'),

View File

@@ -19,6 +19,7 @@ def make_wrapper_types_header(header):
for clsname in clsnames: for clsname in clsnames:
result += ' ' + get_wrapper_type_enum(clsname) + ',\n' result += ' ' + get_wrapper_type_enum(clsname) + ',\n'
result += '\n WT_LAST\n'
result += '};\n\n' + \ result += '};\n\n' + \
'#endif // CEF_LIBCEF_DLL_WRAPPER_TYPES_H_' '#endif // CEF_LIBCEF_DLL_WRAPPER_TYPES_H_'

View File

@@ -26,19 +26,32 @@ if %vcvars% == "none" goto found_vcvars
if "%1" == "win64" goto check_win64 if "%1" == "win64" goto check_win64
:: Hardcoded list of MSVS paths for VS2017 32-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat"
if exist %vcvars% goto found_vcvars
:: Hardcoded list of MSVS paths for VS2015 32-bit builds. :: Hardcoded list of MSVS paths for VS2015 32-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
if exist %vcvars% goto found_vcvars if exist %vcvars% goto found_vcvars
goto notfound_vcvars
:check_win64 :check_win64
:: Hardcoded list of MSVS paths for VS2017 64-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat"
if exist %vcvars% goto found_vcvars
:: Hardcoded list of MSVS paths for VS2015 64-bit builds. :: Hardcoded list of MSVS paths for VS2015 64-bit builds.
set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
if exist %vcvars% goto found_vcvars if exist %vcvars% goto found_vcvars
set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
if exist %vcvars% goto found_vcvars if exist %vcvars% goto found_vcvars
goto notfound_vcvars
:notfound_vcvars :notfound_vcvars
echo ERROR: Failed to find vcvars echo ERROR: Failed to find vcvars