Update to Chromium revision cb947c01 (#352221)

- Implement CefRequestHandler::OnBeforeBrowse using NavigationThrottle
  instead of ResourceThrottle (see http://crbug.com/537634). The CefRequest
  object passed to OnBeforeBrowse will no longer have an associated request
  identifier.
- Mac: Remove additional helper apps which are no longer required (see
  http://crbug.com/520680)
- Remove the UR_FLAG_REPORT_RAW_HEADERS flag which is no longer supported (see
  http://crbug.com/517114)
- Remove the CefBrowserSettings.java parameter. Java is an NPAPI plugin and
  NPAPI plugins are no longer supported (see http://crbug.com/470301#c11)
- Add CefFormatUrlForSecurityDisplay function in cef_parser.h
- Fix crash when passing `--disable-extensions` command-line flag (issue #1721)
- Linux: Fix NSS handler loading (issue #1727)
This commit is contained in:
Marshall Greenblatt 2015-10-09 11:23:12 -04:00
parent 5780ea8baa
commit 8aac23386e
104 changed files with 938 additions and 940 deletions

View File

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

88
cef.gyp
View File

@ -7,7 +7,6 @@
'pkg-config': 'pkg-config',
'chromium_code': 1,
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/cef',
'about_credits_file': '<(SHARED_INTERMEDIATE_DIR)/about_credits.html',
'framework_name': 'Chromium Embedded Framework',
'commit_number': '<!(python tools/commit_number.py)',
'chrome_version': '<!(python ../build/util/version.py -f ../chrome/VERSION -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")',
@ -153,22 +152,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefclient Helper EH.app and cefclient Helper NP.app are created
# from cefclient Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cefclient',
],
},
],
'link_settings': {
'libraries': [
@ -337,22 +320,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefsimple Helper EH.app and cefsimple Helper NP.app are created
# from cefsimple Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cefsimple',
],
},
],
'link_settings': {
'libraries': [
@ -558,22 +525,6 @@
'action': ['../build/mac/tweak_info_plist.py',
'--scm=1'],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# cefclient Helper EH.app and cefclient Helper NP.app are created
# from cefclient Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'../build/mac/make_more_helpers.sh',
'Frameworks',
'cef_unittests',
],
},
],
'link_settings': {
'libraries': [
@ -687,47 +638,15 @@
},
],
},
{
'target_name': 'about_credits',
'type': 'none',
'actions': [
{
'variables': {
'generator_path': '../tools/licenses.py',
},
'action_name': 'generate_about_credits',
'inputs': [
# TODO(phajdan.jr): make licenses.py print inputs too.
'<(generator_path)',
],
'outputs': [
'<(about_credits_file)',
],
'hard_dependency': 1,
'action': ['python',
'<(generator_path)',
'credits',
'<(about_credits_file)',
],
'message': 'Generating about:credits.',
},
],
},
{
# Create the pack file for CEF resources.
'target_name': 'cef_resources',
'type': 'none',
'dependencies': [
'about_credits',
],
'actions': [
{
'action_name': 'cef_resources',
'variables': {
'grit_grd_file': 'libcef/resources/cef_resources.grd',
'grit_additional_defines': [
'-E', 'about_credits_file=<(about_credits_file)',
],
},
'includes': [ '../build/grit_action.gypi' ],
},
@ -931,9 +850,9 @@
'<(DEPTH)/cef/libcef/resources/grit_stub',
'<(DEPTH)/cef/libcef/resources/grit_stub/chrome',
'<(grit_out_dir)',
'<(SHARED_INTERMEDIATE_DIR)/components',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources',
'<(SHARED_INTERMEDIATE_DIR)/ui/strings',
'<(SHARED_INTERMEDIATE_DIR)/webkit',
],
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
@ -951,6 +870,7 @@
'<(DEPTH)/components/components.gyp:content_settings_core_common',
'<(DEPTH)/components/components.gyp:crash_component_breakpad_mac_to_be_deleted',
'<(DEPTH)/components/components.gyp:crx_file',
'<(DEPTH)/components/components.gyp:data_use_measurement_core',
'<(DEPTH)/components/components.gyp:devtools_discovery',
'<(DEPTH)/components/components.gyp:devtools_http_handler',
'<(DEPTH)/components/components.gyp:keyed_service_content',
@ -1301,10 +1221,6 @@
# Include sources for proxy support.
'<(DEPTH)/base/prefs/testing_pref_store.cc',
'<(DEPTH)/base/prefs/testing_pref_store.h',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker.cc',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker.h',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.cc',
'<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.h',
'<(DEPTH)/chrome/browser/net/proxy_service_factory.cc',
'<(DEPTH)/chrome/browser/net/proxy_service_factory.h',
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc',

View File

@ -176,7 +176,8 @@ typedef struct _cef_frame_t {
cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_frame_t* self);
///
// Returns the globally unique identifier for this frame.
// Returns the globally unique identifier for this frame or < 0 if the
// underlying frame does not yet exist.
///
int64 (CEF_CALLBACK *get_identifier)(struct _cef_frame_t* self);

View File

@ -76,19 +76,21 @@ typedef struct _cef_jsdialog_handler_t {
cef_base_t base;
///
// Called to run a JavaScript dialog. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true (1) and
// return false (0) to suppress the message (suppressing messages is
// preferable to immediately executing the callback as this is used to detect
// presumably malicious behavior like spamming alert messages in
// onbeforeunload). Set |suppress_message| to false (0) and return false (0)
// to use the default implementation (the default implementation will show one
// modal dialog at a time and suppress any additional dialog requests until
// the displayed dialog is dismissed). Return true (1) if the application will
// use a custom dialog or if the callback has been executed immediately.
// Custom dialogs may be either modal or modeless. If a custom dialog is used
// the application must execute |callback| once the custom dialog is
// dismissed.
// Called to run a JavaScript dialog. If |origin_url| and |accept_lang| are
// non-NULL they can be passed to the CefFormatUrlForSecurityDisplay function
// to retrieve a secure and user-friendly display string. The
// |default_prompt_text| value will be specified for prompt dialogs only. Set
// |suppress_message| to true (1) and return false (0) to suppress the message
// (suppressing messages is preferable to immediately executing the callback
// as this is used to detect presumably malicious behavior like spamming alert
// messages in onbeforeunload). Set |suppress_message| to false (0) and return
// false (0) to use the default implementation (the default implementation
// will show one modal dialog at a time and suppress any additional dialog
// requests until the displayed dialog is dismissed). Return true (1) if the
// application will use a custom dialog or if the callback has been executed
// immediately. Custom dialogs may be either modal or modeless. If a custom
// dialog is used the application must execute |callback| once the custom
// dialog is dismissed.
///
int (CEF_CALLBACK *on_jsdialog)(struct _cef_jsdialog_handler_t* self,
struct _cef_browser_t* browser, const cef_string_t* origin_url,

View File

@ -60,6 +60,20 @@ CEF_EXPORT int cef_parse_url(const cef_string_t* url,
CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts,
cef_string_t* url);
///
// This is a convenience function for formatting a URL in a concise and human-
// friendly way to help users make security-related decisions (or in other
// circumstances when people need to distinguish sites, origins, or otherwise-
// simplified URLs from each other). Internationalized domain names (IDN) may be
// presented in Unicode if |languages| accepts the Unicode representation. The
// returned value will (a) omit the path for standard schemes, excepting file
// and filesystem, and (b) omit the port if it is the default for the scheme. Do
// not use this for URLs which will be parsed or sent to other applications.
///
// The resulting string must be freed by calling cef_string_userfree_free().
CEF_EXPORT cef_string_userfree_t cef_format_url_for_security_display(
const cef_string_t* origin_url, const cef_string_t* languages);
///
// Returns the mime type for the specified file extension or an NULL string if
// unknown.

View File

@ -182,7 +182,8 @@ class CefFrame : public virtual CefBase {
virtual CefString GetName() =0;
///
// Returns the globally unique identifier for this frame.
// Returns the globally unique identifier for this frame or < 0 if the
// underlying frame does not yet exist.
///
/*--cef()--*/
virtual int64 GetIdentifier() =0;

View File

@ -68,18 +68,21 @@ class CefJSDialogHandler : public virtual CefBase {
typedef cef_jsdialog_type_t JSDialogType;
///
// Called to run a JavaScript dialog. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true and
// return false to suppress the message (suppressing messages is preferable
// to immediately executing the callback as this is used to detect presumably
// malicious behavior like spamming alert messages in onbeforeunload). Set
// |suppress_message| to false and return false to use the default
// implementation (the default implementation will show one modal dialog at a
// time and suppress any additional dialog requests until the displayed dialog
// is dismissed). Return true if the application will use a custom dialog or
// if the callback has been executed immediately. Custom dialogs may be either
// modal or modeless. If a custom dialog is used the application must execute
// |callback| once the custom dialog is dismissed.
// Called to run a JavaScript dialog. If |origin_url| and |accept_lang| are
// non-empty they can be passed to the CefFormatUrlForSecurityDisplay function
// to retrieve a secure and user-friendly display string. The
// |default_prompt_text| value will be specified for prompt dialogs only. Set
// |suppress_message| to true and return false to suppress the message
// (suppressing messages is preferable to immediately executing the callback
// as this is used to detect presumably malicious behavior like spamming alert
// messages in onbeforeunload). Set |suppress_message| to false and return
// false to use the default implementation (the default implementation will
// show one modal dialog at a time and suppress any additional dialog requests
// until the displayed dialog is dismissed). Return true if the application
// will use a custom dialog or if the callback has been executed immediately.
// Custom dialogs may be either modal or modeless. If a custom dialog is used
// the application must execute |callback| once the custom dialog is
// dismissed.
///
/*--cef(optional_param=origin_url,optional_param=accept_lang,
optional_param=message_text,optional_param=default_prompt_text)--*/

View File

@ -60,6 +60,20 @@ bool CefParseURL(const CefString& url,
bool CefCreateURL(const CefURLParts& parts,
CefString& url);
///
// This is a convenience function for formatting a URL in a concise and human-
// friendly way to help users make security-related decisions (or in other
// circumstances when people need to distinguish sites, origins, or otherwise-
// simplified URLs from each other). Internationalized domain names (IDN) may be
// presented in Unicode if |languages| accepts the Unicode representation. The
// returned value will (a) omit the path for standard schemes, excepting file
// and filesystem, and (b) omit the port if it is the default for the scheme. Do
// not use this for URLs which will be parsed or sent to other applications.
///
/*--cef(optional_param=languages)--*/
CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url,
const CefString& languages);
///
// Returns the mime type for the specified file extension or an empty string if
// unknown.

View File

@ -513,12 +513,6 @@ typedef struct _cef_browser_settings_t {
///
cef_state_t caret_browsing;
///
// Controls whether the Java plugin will be loaded. Also configurable using
// the "disable-java" command-line switch.
///
cef_state_t java;
///
// Controls whether any plugins will be loaded. Also configurable using the
// "disable-plugins" command-line switch.
@ -1151,11 +1145,6 @@ typedef enum {
///
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
///
// If set the headers sent and received for the request will be recorded.
///
UR_FLAG_REPORT_RAW_HEADERS = 1 << 5,
///
// If set the CefURLRequestClient::OnDownloadData method will not be called.
///

View File

@ -605,7 +605,6 @@ struct CefBrowserSettingsTraits {
target->javascript_access_clipboard = src->javascript_access_clipboard;
target->javascript_dom_paste = src->javascript_dom_paste;
target->caret_browsing = src->caret_browsing;
target->java = src->java;
target->plugins = src->plugins;
target->universal_access_from_file_urls =
src->universal_access_from_file_urls;

View File

@ -328,8 +328,7 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
DCHECK(!url_request_getter_.get());
// Initialize the proxy configuration service.
scoped_ptr<net::ProxyConfigService> proxy_config_service;
proxy_config_service.reset(
scoped_ptr<net::ProxyConfigService> proxy_config_service(
ProxyServiceFactory::CreateProxyConfigService(
pref_proxy_config_tracker_.get()));

View File

@ -14,7 +14,7 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "components/proxy_config/pref_proxy_config_tracker.h"
namespace content {
class DownloadManagerDelegate;

View File

@ -414,15 +414,10 @@ bool CefBrowserHost::CreateBrowser(
}
// Verify windowless rendering requirements.
if (windowInfo.windowless_rendering_enabled) {
if (!client->GetRenderHandler().get()) {
NOTREACHED() << "CefRenderHandler implementation is required";
return false;
}
if (!content::IsDelegatedRendererEnabled()) {
NOTREACHED() << "Delegated renderer must be enabled";
return false;
}
if (windowInfo.windowless_rendering_enabled &&
!client->GetRenderHandler().get()) {
NOTREACHED() << "CefRenderHandler implementation is required";
return false;
}
// Create the browser on the UI thread.
@ -479,15 +474,10 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
bool is_popup,
CefRefPtr<CefRequestContext> request_context) {
// Verify windowless rendering requirements.
if (windowInfo.windowless_rendering_enabled) {
if (!client->GetRenderHandler().get()) {
NOTREACHED() << "CefRenderHandler implementation is required";
return NULL;
}
if (!content::IsDelegatedRendererEnabled()) {
NOTREACHED() << "Delegated renderer must be enabled";
return NULL;
}
if (windowInfo.windowless_rendering_enabled &&
!client->GetRenderHandler().get()) {
NOTREACHED() << "CefRenderHandler implementation is required";
return NULL;
}
scoped_refptr<CefBrowserInfo> info =

View File

@ -28,7 +28,6 @@
#include "grit/ui_strings.h"
#include "net/base/mime_util.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/mac/WebInputEventFactory.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"

View File

@ -13,12 +13,12 @@
#include "base/prefs/pref_registry_simple.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/proxy_config/proxy_config_dictionary.h"
#include "extensions/browser/extension_prefs.h"
#include "grit/cef_strings.h"

View File

@ -106,7 +106,6 @@ void BrowserToWebSettings(const CefBrowserSettings& cef,
web.javascript_can_access_clipboard);
SET_STATE(cef.javascript_dom_paste, web.dom_paste_enabled);
SET_STATE(cef.caret_browsing, web.caret_browsing_enabled);
SET_STATE(cef.java, web.java_enabled);
SET_STATE(cef.plugins, web.plugins_enabled);
SET_STATE(cef.universal_access_from_file_urls,
web.allow_universal_access_from_file_urls);

View File

@ -307,9 +307,6 @@ class CefBrowserURLRequest::Context
upload_data_size_ = upload_data_size;
}
if (cef_flags & UR_FLAG_REPORT_RAW_HEADERS)
load_flags |= net::LOAD_REPORT_RAW_HEADERS;
fetcher_->SetLoadFlags(load_flags);
fetcher_->SetExtraRequestHeaders(

View File

@ -66,13 +66,14 @@ net::URLRequestContextGetter*
return NULL;
}
chrome_variations::VariationsService*
variations::VariationsService*
ChromeBrowserProcessStub::variations_service() {
NOTIMPLEMENTED();
return NULL;
}
PromoResourceService* ChromeBrowserProcessStub::promo_resource_service() {
web_resource::PromoResourceService*
ChromeBrowserProcessStub::promo_resource_service() {
NOTIMPLEMENTED();
return NULL;
}
@ -217,7 +218,7 @@ void ChromeBrowserProcessStub::StartAutoupdateTimer() {
}
#endif
ChromeNetLog* ChromeBrowserProcessStub::net_log() {
net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
NOTIMPLEMENTED();
return NULL;
}
@ -273,13 +274,13 @@ gcm::GCMDriver* ChromeBrowserProcessStub::gcm_driver() {
return NULL;
}
memory::OomPriorityManager* ChromeBrowserProcessStub::GetOomPriorityManager() {
NOTIMPLEMENTED();
return NULL;
}
ShellIntegration::DefaultWebClientState
ChromeBrowserProcessStub::CachedDefaultWebClientState() {
NOTIMPLEMENTED();
return ShellIntegration::UNKNOWN_DEFAULT;
}
memory::TabManager* ChromeBrowserProcessStub::GetTabManager() {
NOTIMPLEMENTED();
return NULL;
}

View File

@ -39,8 +39,8 @@ class ChromeBrowserProcessStub : public BrowserProcess {
ProfileManager* profile_manager() override;
PrefService* local_state() override;
net::URLRequestContextGetter* system_request_context() override;
chrome_variations::VariationsService* variations_service() override;
PromoResourceService* promo_resource_service() override;
variations::VariationsService* variations_service() override;
web_resource::PromoResourceService* promo_resource_service() override;
BrowserProcessPlatformPart* platform_part() override;
extensions::EventRouterForwarder*
extension_event_router_forwarder() override;
@ -80,7 +80,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
void StartAutoupdateTimer() override;
#endif
ChromeNetLog* net_log() override;
net_log::ChromeNetLog* net_log() override;
component_updater::ComponentUpdateService*
component_updater() override;
CRLSetFetcher* crl_set_fetcher() override;
@ -96,9 +96,9 @@ class ChromeBrowserProcessStub : public BrowserProcess {
#endif
network_time::NetworkTimeTracker* network_time_tracker() override;
gcm::GCMDriver* gcm_driver() override;
memory::OomPriorityManager* GetOomPriorityManager() override;
ShellIntegration::DefaultWebClientState
CachedDefaultWebClientState() override;
memory::TabManager* GetTabManager() override;
private:
std::string locale_;

View File

@ -29,6 +29,7 @@
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "grit/cef_resources.h"
#include "grit/components_resources.h"
#include "ipc/ipc_channel.h"
#include "net/url_request/url_request.h"
#include "ui/base/webui/web_ui_util.h"
@ -274,10 +275,10 @@ class Delegate : public InternalHandlerDelegate {
bool OnCredits(const std::string& path, Action* action) {
if (path == "credits.js") {
action->resource_id = IDR_CEF_CREDITS_JS;
action->resource_id = IDR_ABOUT_UI_CREDITS_JS;
} else {
action->mime_type = "text/html";
action->resource_id = IDR_CEF_CREDITS_HTML;
action->resource_id = IDR_ABOUT_UI_CREDITS_HTML;
}
return true;
}

View File

@ -30,6 +30,7 @@
#include "libcef/common/command_line_impl.h"
#include "libcef/common/content_client.h"
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/scheme_registration.h"
#include "base/base_switches.h"
@ -38,13 +39,19 @@
#include "base/path_service.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
#include "chrome/common/chrome_switches.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/plugin_service_impl.h"
#include "content/public/browser/access_token_store.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
@ -70,8 +77,8 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h"
#include "components/crash/app/breakpad_linux.h"
#include "components/crash/browser/crash_handler_host_linux.h"
#include "components/crash/content/app/breakpad_linux.h"
#include "components/crash/content/browser/crash_handler_host_linux.h"
#include "content/public/common/content_descriptors.h"
#endif
@ -353,6 +360,67 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
}
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
// TODO(cef): We can't currently trust NavigationParams::is_main_frame() because
// it's always set to true in
// InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation. Remove the
// |is_main_frame| argument once this problem is fixed.
bool NavigationOnUIThread(
bool is_main_frame,
int64 frame_id,
int64 parent_frame_id,
content::WebContents* source,
const navigation_interception::NavigationParams& params) {
CEF_REQUIRE_UIT();
bool ignore_navigation = false;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(source);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get()) {
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
if (handler.get()) {
CefRefPtr<CefFrame> frame;
if (is_main_frame) {
frame = browser->GetMainFrame();
} else if (frame_id >= 0) {
frame = browser->GetFrame(frame_id);
DCHECK(frame);
} else {
// Create a temporary frame object for navigation of sub-frames that
// don't yet exist.
frame = new CefFrameHostImpl(browser.get(),
CefFrameHostImpl::kInvalidFrameId,
false,
CefString(),
CefString(),
parent_frame_id);
}
CefRefPtr<CefRequestImpl> request = new CefRequestImpl();
request->Set(params, is_main_frame);
request->SetReadOnly(true);
ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.is_redirect());
}
}
}
return ignore_navigation;
}
void FindFrameHostForNavigationHandle(
content::NavigationHandle* navigation_handle,
content::RenderFrameHost** matching_frame_host,
content::RenderFrameHost* current_frame_host) {
content::RenderFrameHostImpl* current_impl =
static_cast<content::RenderFrameHostImpl*>(current_frame_host);
if (current_impl->navigation_handle() == navigation_handle)
*matching_frame_host = current_frame_host;
}
} // namespace
@ -964,6 +1032,51 @@ content::DevToolsManagerDelegate*
return new CefDevToolsManagerDelegate();
}
ScopedVector<content::NavigationThrottle>
CefContentBrowserClient::CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) {
CEF_REQUIRE_UIT();
ScopedVector<content::NavigationThrottle> throttles;
const bool is_main_frame = navigation_handle->IsInMainFrame();
int64 parent_frame_id = CefFrameHostImpl::kUnspecifiedFrameId;
if (!is_main_frame) {
// Identify the RenderFrameHostImpl that originated the navigation.
// TODO(cef): It would be better if NavigationHandle could directly report
// the owner RenderFrameHostImpl.
// There is additional complexity here if PlzNavigate is enabled. See
// comments in content/browser/frame_host/navigation_handle_impl.h.
content::WebContents* web_contents = navigation_handle->GetWebContents();
content::RenderFrameHost* parent_frame_host = NULL;
web_contents->ForEachFrame(
base::Bind(FindFrameHostForNavigationHandle,
navigation_handle, &parent_frame_host));
DCHECK(parent_frame_host);
parent_frame_id = parent_frame_host->GetRoutingID();
if (parent_frame_id < 0)
parent_frame_id = CefFrameHostImpl::kUnspecifiedFrameId;
}
int64 frame_id = CefFrameHostImpl::kInvalidFrameId;
if (!is_main_frame && navigation_handle->HasCommitted()) {
frame_id = navigation_handle->GetRenderFrameHost()->GetRoutingID();
if (frame_id < 0)
frame_id = CefFrameHostImpl::kInvalidFrameId;
}
content::NavigationThrottle* throttle =
new navigation_interception::InterceptNavigationThrottle(
navigation_handle,
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
parent_frame_id));
throttles.push_back(throttle);
return throttles.Pass();
}
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,

View File

@ -137,6 +137,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate()
override;
ScopedVector<content::NavigationThrottle> CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess(

View File

@ -111,6 +111,11 @@ std::string CefDevToolsDelegate::GetFrontendResource(
return content::DevToolsFrontendHost::GetFrontendResource(path).as_string();
}
content::DevToolsExternalAgentProxyDelegate*
CefDevToolsDelegate::HandleWebSocketConnection(const std::string& path) {
return nullptr;
}
std::string CefDevToolsDelegate::GetChromeDevToolsURL() {
return base::StringPrintf("%s://%s/inspector.html",
content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost);

View File

@ -34,6 +34,8 @@ class CefDevToolsDelegate :
std::string GetDiscoveryPageHTML() override;
std::string GetFrontendResource(const std::string& path) override;
std::string GetPageThumbnailData(const GURL& url) override;
content::DevToolsExternalAgentProxyDelegate*
HandleWebSocketConnection(const std::string& path) override;
// Returns the chrome-devtools URL.
std::string GetChromeDevToolsURL();

View File

@ -272,6 +272,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
if (!params->GetString(0, &name))
return;
preferences_.RemoveWithoutPathExpansion(name, nullptr);
} else if (method == "requestFileSystems") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
} else {
return;
}

View File

@ -35,6 +35,7 @@
#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/quota_service.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/file_util.h"
@ -131,7 +132,7 @@ void CefExtensionSystem::Init() {
// 10.Routing of print-related commands are handled by ChromePDFPrintClient
// and CefPrintWebViewHelperDelegate in the renderer process.
// 11.The PDF extension is granted access to chrome://resources via
// CefExtensionsDispatcherDelegate::InitOriginPermissions in the renderer
// CefExtensionWebContentsObserver::RenderViewCreated in the browser
// process.
if (PdfExtensionEnabled()) {
AddExtension(pdf_extension_util::GetManifest(),
@ -169,6 +170,7 @@ void CefExtensionSystem::Shutdown() {
}
void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
service_worker_manager_.reset(new ServiceWorkerManager(browser_context_));
runtime_data_.reset(new RuntimeData(registry_));
quota_service_.reset(new QuotaService);
app_sorting_.reset(new NullAppSorting);
@ -186,6 +188,10 @@ ManagementPolicy* CefExtensionSystem::management_policy() {
return nullptr;
}
ServiceWorkerManager* CefExtensionSystem::service_worker_manager() {
return service_worker_manager_.get();
}
SharedUserScriptMaster* CefExtensionSystem::shared_user_script_master() {
return nullptr;
}

View File

@ -56,6 +56,7 @@ class CefExtensionSystem : public ExtensionSystem {
ExtensionService* extension_service() override;
RuntimeData* runtime_data() override;
ManagementPolicy* management_policy() override;
ServiceWorkerManager* service_worker_manager() override;
SharedUserScriptMaster* shared_user_script_master() override;
StateStore* state_store() override;
StateStore* rules_store() override;
@ -118,6 +119,7 @@ class CefExtensionSystem : public ExtensionSystem {
// Data to be accessed on the IO thread. Must outlive process_manager_.
scoped_refptr<InfoMap> info_map_;
scoped_ptr<ServiceWorkerManager> service_worker_manager_;
scoped_ptr<RuntimeData> runtime_data_;
scoped_ptr<QuotaService> quota_service_;
scoped_ptr<AppSorting> app_sorting_;

View File

@ -22,7 +22,7 @@ ExtensionSystem* CefExtensionSystemFactory::GetForBrowserContext(
// static
CefExtensionSystemFactory* CefExtensionSystemFactory::GetInstance() {
return Singleton<CefExtensionSystemFactory>::get();
return base::Singleton<CefExtensionSystemFactory>::get();
}
CefExtensionSystemFactory::CefExtensionSystemFactory()

View File

@ -20,7 +20,7 @@ class CefExtensionSystemFactory : public ExtensionSystemProvider {
static CefExtensionSystemFactory* GetInstance();
private:
friend struct DefaultSingletonTraits<CefExtensionSystemFactory>;
friend struct base::DefaultSingletonTraits<CefExtensionSystemFactory>;
CefExtensionSystemFactory();
~CefExtensionSystemFactory() override;

View File

@ -4,6 +4,11 @@
#include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/url_constants.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::CefExtensionWebContentsObserver);
namespace extensions {
@ -16,4 +21,24 @@ CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {
}
void CefExtensionWebContentsObserver::RenderViewCreated(
content::RenderViewHost* render_view_host) {
ExtensionWebContentsObserver::RenderViewCreated(render_view_host);
const Extension* extension = GetExtension(render_view_host);
if (!extension)
return;
int process_id = render_view_host->GetProcess()->GetID();
auto policy = content::ChildProcessSecurityPolicy::GetInstance();
// Components of chrome that are implemented as extensions or platform apps
// are allowed to use chrome://resources/ URLs.
if ((extension->is_extension() || extension->is_platform_app()) &&
Manifest::IsComponentLocation(extension->location())) {
policy->GrantOrigin(process_id,
url::Origin(GURL(content::kChromeUIResourcesURL)));
}
}
} // namespace extensions

View File

@ -21,6 +21,9 @@ class CefExtensionWebContentsObserver
content::WebContents* web_contents);
~CefExtensionWebContentsObserver() override;
// content::WebContentsObserver overrides.
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
DISALLOW_COPY_AND_ASSIGN(CefExtensionWebContentsObserver);
};

View File

@ -156,6 +156,10 @@ bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false;
}
bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
return false;
}
ApiActivityMonitor* CefExtensionsBrowserClient::GetApiActivityMonitor(
BrowserContext* context) {
// CEF doesn't monitor API function calls or events.

View File

@ -63,6 +63,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override;
bool IsLoggedInAsPublicAccount() override;
ApiActivityMonitor* GetApiActivityMonitor(
content::BrowserContext* context) override;
ExtensionSystemProvider* GetExtensionSystemFactory() override;

View File

@ -121,7 +121,7 @@ void CefFrameHostImpl::LoadRequest(CefRefPtr<CefRequest> request) {
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser.get())
if (browser.get() && frame_id != kInvalidFrameId)
browser->LoadRequest(frame_id, request);
}
@ -135,7 +135,7 @@ void CefFrameHostImpl::LoadURL(const CefString& url) {
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser.get()) {
if (browser.get() && frame_id != kInvalidFrameId) {
browser->LoadURL(frame_id, url, content::Referrer(),
ui::PAGE_TRANSITION_TYPED, std::string());
}
@ -152,7 +152,7 @@ void CefFrameHostImpl::LoadString(const CefString& string,
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser.get())
if (browser.get() && frame_id != kInvalidFrameId)
browser->LoadString(frame_id, string, url);
}
@ -252,7 +252,7 @@ void CefFrameHostImpl::SendJavaScript(
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser.get())
if (browser.get() && frame_id != kInvalidFrameId)
browser->SendCode(frame_id, true, jsCode, scriptUrl, startLine, NULL);
}

View File

@ -33,9 +33,16 @@ static std::string GetMimeType(const std::string& filename) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
std::string mime_type;
if (net::GetMimeTypeFromFile(FilePathFromASCII(filename), &mime_type))
const base::FilePath& file_path = FilePathFromASCII(filename);
if (net::GetMimeTypeFromFile(file_path, &mime_type))
return mime_type;
// Check for newer extensions used by internal resources but not yet
// recognized by the mime type detector.
const std::string& extension = CefString(file_path.FinalExtension());
if (extension == ".woff2")
return "application/font-woff2";
NOTREACHED() << "No known mime type for file: " << filename.c_str();
return "text/plain";
}

View File

@ -11,7 +11,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "components/url_formatter/url_formatter.h"
#include "components/url_formatter/elide_url.h"
#include "net/base/net_util.h"
namespace {
@ -121,7 +121,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
}
base::string16 display_url =
url_formatter::FormatUrl(origin_url, accept_lang);
url_formatter::FormatUrlForSecurityDisplay(origin_url, accept_lang);
dialog_.reset(new CefJavaScriptDialog(this,
message_type,

View File

@ -36,7 +36,7 @@ const content::MediaStreamDevice* FindDefaultDeviceWithId(
CefMediaCaptureDevicesDispatcher*
CefMediaCaptureDevicesDispatcher::GetInstance() {
return Singleton<CefMediaCaptureDevicesDispatcher>::get();
return base::Singleton<CefMediaCaptureDevicesDispatcher>::get();
}
CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher() {}

View File

@ -55,7 +55,7 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
int render_view_id) override;
private:
friend struct DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;
friend struct base::DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;
CefMediaCaptureDevicesDispatcher();
~CefMediaCaptureDevicesDispatcher() override;

View File

@ -12,6 +12,8 @@
#include "base/callback.h"
#include "content/public/browser/geolocation_provider.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
namespace {
@ -53,6 +55,22 @@ class CefGeolocationCallbackImpl : public CefGeolocationCallback {
} // namespace
struct CefPermissionManager::PendingRequest {
PendingRequest(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin)
: permission(permission),
render_process_id(render_frame_host->GetProcess()->GetID()),
render_frame_id(render_frame_host->GetRoutingID()),
requesting_origin(requesting_origin) {
}
content::PermissionType permission;
int render_process_id;
int render_frame_id;
GURL requesting_origin;
};
CefPermissionManager::CefPermissionManager()
: PermissionManager() {
}
@ -60,10 +78,9 @@ CefPermissionManager::CefPermissionManager()
CefPermissionManager::~CefPermissionManager() {
}
void CefPermissionManager::RequestPermission(
int CefPermissionManager::RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) {
@ -71,11 +88,15 @@ void CefPermissionManager::RequestPermission(
if (permission != content::PermissionType::GEOLOCATION) {
callback.Run(content::PERMISSION_STATUS_DENIED);
return;
return kNoPendingOperation;
}
bool proceed = false;
PendingRequest* pending_request = new PendingRequest(
permission, render_frame_host, requesting_origin);
const int request_id = pending_requests_.Add(pending_request);
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForHost(render_frame_host);
if (browser.get()) {
@ -97,36 +118,45 @@ void CefPermissionManager::RequestPermission(
}
}
if (!proceed) {
// Disallow geolocation access by default.
callback.Run(content::PERMISSION_STATUS_DENIED);
}
if (proceed)
return request_id;
pending_requests_.Remove(request_id);
// Disallow geolocation access by default.
callback.Run(content::PERMISSION_STATUS_DENIED);
return kNoPendingOperation;
}
void CefPermissionManager::CancelPermissionRequest(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin) {
int request_id) {
CEF_REQUIRE_UIT();
if (permission != content::PermissionType::GEOLOCATION)
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
if (!pending_request)
return;
if (pending_request->permission != content::PermissionType::GEOLOCATION)
return;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForHost(render_frame_host);
CefBrowserHostImpl::GetBrowserForFrame(pending_request->render_process_id,
pending_request->render_frame_id);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get()) {
CefRefPtr<CefGeolocationHandler> handler =
client->GetGeolocationHandler();
if (handler.get()) {
handler->OnCancelGeolocationPermission(browser.get(),
requesting_origin.spec(),
request_id);
handler->OnCancelGeolocationPermission(
browser.get(),
pending_request->requesting_origin.spec(),
request_id);
}
}
}
pending_requests_.Remove(request_id);
}
void CefPermissionManager::ResetPermission(

View File

@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_PERMISSION_MANAGER_H_
#include "base/callback_forward.h"
#include "base/id_map.h"
#include "base/macros.h"
#include "content/public/browser/permission_manager.h"
@ -15,17 +16,13 @@ class CefPermissionManager : public content::PermissionManager {
~CefPermissionManager() override;
// PermissionManager implementation.
void RequestPermission(
int RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
void CancelPermissionRequest(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin) override;
void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
@ -44,6 +41,10 @@ class CefPermissionManager : public content::PermissionManager {
void UnsubscribePermissionStatusChange(int subscription_id) override;
private:
struct PendingRequest;
using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
PendingRequestsMap pending_requests_;
DISALLOW_COPY_AND_ASSIGN(CefPermissionManager);
};

View File

@ -9,6 +9,7 @@
#include "libcef/browser/plugins/plugin_service_filter.h"
#include "libcef/browser/web_plugin_impl.h"
#include "libcef/common/cef_messages.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
@ -29,7 +30,6 @@
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/webview_info.h"
#include "url/gurl.h"
@ -130,17 +130,10 @@ bool IsPluginLoadingAccessibleResourceInWebView(
}
const std::string extension_id = resource.host();
const extensions::Extension* extension =
extension_registry->GetExtensionById(extension_id,
extensions::ExtensionRegistry::ENABLED);
if (!extension)
return false;
const extensions::WebviewInfo* webview_info =
static_cast<const extensions::WebviewInfo*>(extension->GetManifestData(
extensions::manifest_keys::kWebviewAccessibleResources));
if (!webview_info ||
!webview_info->IsResourceWebviewAccessible(extension, partition_id,
resource.path())) {
const extensions::Extension* extension = extension_registry->GetExtensionById(
extension_id, extensions::ExtensionRegistry::ENABLED);
if (!extension || !extensions::WebviewInfo::IsResourceWebviewAccessible(
extension, partition_id, resource.path())) {
return false;
}
@ -159,10 +152,12 @@ CefPluginInfoMessageFilter::Context::Context(
CefBrowserContext* profile)
: render_process_id_(render_process_id),
resource_context_(profile->GetResourceContext()),
#if defined(ENABLE_EXTENSIONS)
extension_registry_(extensions::ExtensionRegistry::Get(profile)),
#endif
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
#if defined(ENABLE_EXTENSIONS)
if (extensions::ExtensionsEnabled())
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
#endif
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
profile->GetPrefs());
allow_outdated_plugins_.MoveToThread(
@ -387,7 +382,8 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
// If an app has explicitly made internal resources available by listing them
// in |accessible_resources| in the manifest, then allow them to be loaded by
// plugins inside a guest-view.
if (params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
if (extensions::ExtensionsEnabled() &&
params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
plugin_setting == CONTENT_SETTING_BLOCK &&
IsPluginLoadingAccessibleResourceInWebView(
extension_registry_, render_process_id_, params.url)) {
@ -405,18 +401,21 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
: CefViewHostMsg_GetPluginInfo_Status::kBlocked;
}
if (*status == CefViewHostMsg_GetPluginInfo_Status::kAllowed) {
// Allow an embedder of <webview> to block a plugin from being loaded inside
// the guest. In order to do this, set the status to 'Unauthorized' here,
// and update the status as appropriate depending on the response from the
// embedder.
#if defined(ENABLE_EXTENSIONS)
// Allow an embedder of <webview> to block a plugin from being loaded inside
// the guest. In order to do this, set the status to 'Unauthorized' here,
// and update the status as appropriate depending on the response from the
// embedder.
if (*status == CefViewHostMsg_GetPluginInfo_Status::kAllowed ||
*status == CefViewHostMsg_GetPluginInfo_Status::kBlocked ||
*status ==
CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
if (extensions::WebViewRendererState::GetInstance()->IsGuest(
render_process_id_)) {
*status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized;
}
#endif
}
#endif
}
bool CefPluginInfoMessageFilter::Context::FindEnabledPlugin(

View File

@ -42,11 +42,11 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
: PrintManager(web_contents),
printing_succeeded_(false),
inside_inner_message_loop_(false),
#if !defined(OS_MACOSX)
expecting_first_page_(true),
#endif
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_.get());
#if !defined(OS_MACOSX)
expecting_first_page_ = true;
#endif // OS_MACOSX
PrefService* pref_service =
static_cast<CefBrowserContext*>(web_contents->GetBrowserContext())->
GetPrefs();
@ -66,7 +66,7 @@ PrintViewManagerBase::~PrintViewManagerBase() {
bool PrintViewManagerBase::PrintNow() {
return PrintNowInternal(new PrintMsg_PrintPages(routing_id()));
}
#endif // ENABLE_BASIC_PRINTING
#endif
void PrintViewManagerBase::UpdateScriptedPrintingBlocked() {
Send(new PrintMsg_SetScriptedPrintingBlocked(
@ -125,27 +125,51 @@ void PrintViewManagerBase::OnDidPrintPage(
#else
const bool metafile_must_be_valid = expecting_first_page_;
expecting_first_page_ = false;
#endif // OS_MACOSX
#endif
base::SharedMemory shared_buf(params.metafile_data_handle, true);
// Only used when |metafile_must_be_valid| is true.
scoped_ptr<base::SharedMemory> shared_buf;
if (metafile_must_be_valid) {
if (!shared_buf.Map(params.data_size)) {
if (!base::SharedMemory::IsHandleValid(params.metafile_data_handle)) {
NOTREACHED() << "invalid memory handle";
web_contents()->Stop();
return;
}
shared_buf.reset(new base::SharedMemory(params.metafile_data_handle, true));
if (!shared_buf->Map(params.data_size)) {
NOTREACHED() << "couldn't map";
web_contents()->Stop();
return;
}
} else {
if (base::SharedMemory::IsHandleValid(params.metafile_data_handle)) {
NOTREACHED() << "unexpected valid memory handle";
web_contents()->Stop();
base::SharedMemory::CloseHandle(params.metafile_data_handle);
return;
}
}
scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia);
if (metafile_must_be_valid) {
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header";
web_contents()->Stop();
return;
}
}
#if !defined(OS_WIN)
#if defined(OS_WIN)
if (metafile_must_be_valid) {
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
params.data_size);
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
print_job_->StartPdfToEmfConversion(
bytes, params.page_size, params.content_area);
}
#else
// Update the rendered document. It will send notifications to the listener.
document->SetPage(params.page_number,
metafile.Pass(),
@ -153,17 +177,7 @@ void PrintViewManagerBase::OnDidPrintPage(
params.content_area);
ShouldQuitFromInnerMessageLoop();
#else
if (metafile_must_be_valid) {
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
reinterpret_cast<const unsigned char*>(shared_buf.memory()),
params.data_size);
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
print_job_->StartPdfToEmfConversion(
bytes, params.page_size, params.content_area);
}
#endif // !OS_WIN
#endif
}
void PrintViewManagerBase::OnPrintingFailed(int cookie) {
@ -354,7 +368,7 @@ void PrintViewManagerBase::DisconnectFromCurrentPrintJob() {
}
#if !defined(OS_MACOSX)
expecting_first_page_ = true;
#endif // OS_MACOSX
#endif
}
void PrintViewManagerBase::PrintingDone(bool success) {
@ -409,7 +423,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
// be CPU bound, the page overly complex/large or the system just
// memory-bound.
static const int kPrinterSettingsTimeout = 60000;
base::OneShotTimer<base::MessageLoop> quit_timer;
base::OneShotTimer quit_timer;
quit_timer.Start(FROM_HERE,
TimeDelta::FromMilliseconds(kPrinterSettingsTimeout),
base::MessageLoop::current(), &base::MessageLoop::Quit);

View File

@ -472,9 +472,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
#if !defined(OS_MACOSX)
// On OS X the ui::Compositor is created/owned by the platform view.
compositor_.reset(
new ui::Compositor(compositor_widget_,
content::GetContextFactory(),
new ui::Compositor(content::GetContextFactory(),
base::ThreadTaskRunnerHandle::Get()));
compositor_->SetAcceleratedWidgetAndStartCompositor(compositor_widget_);
#endif
compositor_->SetDelegate(this);
compositor_->SetRootLayer(root_layer_.get());
@ -670,7 +670,8 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
cc::RenderPass* root_pass =
frame->delegated_frame_data->render_pass_list.back();
gfx::Size frame_size = root_pass->output_rect.size();
gfx::Rect damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect);
gfx::Rect damage_rect =
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
damage_rect.Intersect(gfx::Rect(frame_size));
delegated_frame_host_->SwapDelegatedFrame(
@ -689,6 +690,10 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
}
}
void CefRenderWidgetHostViewOSR::ClearCompositorFrame() {
delegated_frame_host_->ClearDelegatedFrame();
}
void CefRenderWidgetHostViewOSR::InitAsPopup(
content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
@ -830,12 +835,6 @@ void CefRenderWidgetHostViewOSR::SetTooltipText(
}
}
void CefRenderWidgetHostViewOSR::SelectionChanged(
const base::string16& text,
size_t offset,
const gfx::Range& range) {
}
gfx::Size CefRenderWidgetHostViewOSR::GetRequestedRendererSize() const {
return delegated_frame_host_->GetRequestedRendererSize();
}
@ -844,14 +843,16 @@ gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const {
return gfx::ConvertSizeToPixel(scale_factor_, GetRequestedRendererSize());
}
#if !defined(OS_MACOSX)
void CefRenderWidgetHostViewOSR::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) {
}
#endif
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
content::ReadbackRequestCallback& callback,
const content::ReadbackRequestCallback& callback,
const SkColorType color_type) {
delegated_frame_host_->CopyFromCompositingSurface(
src_subrect, dst_size, callback, color_type);
@ -869,10 +870,6 @@ bool CefRenderWidgetHostViewOSR::CanCopyToVideoFrame() const {
return delegated_frame_host_->CanCopyToVideoFrame();
}
bool CefRenderWidgetHostViewOSR::CanSubscribeFrame() const {
return delegated_frame_host_->CanSubscribeFrame();
}
void CefRenderWidgetHostViewOSR::BeginFrameSubscription(
scoped_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
delegated_frame_host_->BeginFrameSubscription(subscriber.Pass());
@ -882,10 +879,6 @@ void CefRenderWidgetHostViewOSR::EndFrameSubscription() {
delegated_frame_host_->EndFrameSubscription();
}
void CefRenderWidgetHostViewOSR::AcceleratedSurfaceInitialized(
int route_id) {
}
bool CefRenderWidgetHostViewOSR::HasAcceleratedSurface(
const gfx::Size& desired_size) {
// CEF doesn't use GetBackingStore for accelerated pages, so it doesn't
@ -929,6 +922,13 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) {
*results = webScreenInfoFrom(screen_info);
}
bool CefRenderWidgetHostViewOSR::GetScreenColorProfile(
std::vector<char>* color_profile) {
DCHECK(color_profile->empty());
// TODO(cef): Maybe expose this method to the client?
return false;
}
gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
if (!browser_impl_.get())
return gfx::Rect();
@ -941,11 +941,6 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
return gfx::Rect();
}
gfx::GLSurfaceHandle CefRenderWidgetHostViewOSR::GetCompositingSurface() {
return content::ImageTransportFactory::GetInstance()->
GetSharedSurfaceHandle();
}
content::BrowserAccessibilityManager*
CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate) {

View File

@ -119,6 +119,7 @@ class CefRenderWidgetHostViewOSR
void OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) override;
void ClearCompositorFrame() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) override;
void InitAsFullscreen(
@ -134,9 +135,13 @@ class CefRenderWidgetHostViewOSR
int error_code) override;
void Destroy() override;
void SetTooltipText(const base::string16& tooltip_text) override;
#if defined(OS_MACOSX)
void SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) override;
#endif
gfx::Size GetRequestedRendererSize() const override;
gfx::Size GetPhysicalBackingSize() const override;
void SelectionBoundsChanged(
@ -144,23 +149,21 @@ class CefRenderWidgetHostViewOSR
void CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
content::ReadbackRequestCallback& callback,
const content::ReadbackRequestCallback& callback,
const SkColorType color_type) override;
void CopyFromCompositingSurfaceToVideoFrame(
const gfx::Rect& src_subrect,
const scoped_refptr<media::VideoFrame>& target,
const base::Callback<void(bool)>& callback) override;
bool CanCopyToVideoFrame() const override;
bool CanSubscribeFrame() const override;
void BeginFrameSubscription(
scoped_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
override;
void EndFrameSubscription() override;
void AcceleratedSurfaceInitialized(int route_id) override;
bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
void GetScreenInfo(blink::WebScreenInfo* results) override;
bool GetScreenColorProfile(std::vector<char>* color_profile) override;
gfx::Rect GetBoundsInRootWindow() override;
gfx::GLSurfaceHandle GetCompositingSurface() override;
content::BrowserAccessibilityManager*
CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate) override;
@ -256,6 +259,11 @@ class CefRenderWidgetHostViewOSR
bool GetCachedFirstRectForCharacterRange(gfx::Range range, gfx::Rect* rect,
gfx::Range* actual_range) const;
const std::string& selected_text() const { return selected_text_; }
const gfx::Range& composition_range() const { return composition_range_; }
const base::string16& selection_text() const { return selection_text_; }
size_t selection_text_offset() const { return selection_text_offset_; }
#endif // defined(OS_MACOSX)
void AddGuestHostView(CefRenderWidgetHostViewOSR* guest_host);
@ -376,6 +384,19 @@ class CefRenderWidgetHostViewOSR
#if defined(OS_MACOSX)
NSTextInputContext* text_input_context_osr_mac_;
// Selected text on the renderer.
std::string selected_text_;
// The current composition character range and its bounds.
gfx::Range composition_range_;
std::vector<gfx::Rect> composition_bounds_;
// The current caret bounds.
gfx::Rect caret_rect_;
// The current first selection bounds.
gfx::Rect first_selection_rect_;
#endif
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;

View File

@ -11,6 +11,8 @@
#include "libcef/browser/text_input_client_osr_mac.h"
#include "base/compiler_specific.h"
#include "base/strings/utf_string_conversions.h"
#include "content/common/view_messages.h"
#include "ui/events/latency_info.h"
namespace {
@ -79,9 +81,36 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
if (!client)
return;
client->markedRange_ = range.ToNSRange();
client->composition_range_ = range;
client->composition_bounds_ = character_bounds;
composition_range_ = range;
composition_bounds_ = character_bounds;
}
void CefRenderWidgetHostViewOSR::SelectionChanged(
const base::string16& text,
size_t offset,
const gfx::Range& range) {
if (range.is_empty() || text.empty()) {
selected_text_.clear();
} else {
size_t pos = range.GetMin() - offset;
size_t n = range.length();
DCHECK(pos + n <= text.length()) << "The text can not fully cover range.";
if (pos >= text.length()) {
DCHECK(false) << "The text can not cover range.";
return;
}
selected_text_ = base::UTF16ToUTF8(text.substr(pos, n));
}
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
}
void CefRenderWidgetHostViewOSR::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) {
if (params.anchor_rect == params.focus_rect)
caret_rect_ = params.anchor_rect;
first_selection_rect_ = params.anchor_rect;
}
NSView* CefRenderWidgetHostViewOSR::AcceleratedWidgetGetNSView() const {
@ -147,99 +176,98 @@ void CefRenderWidgetHostViewOSR::HandleKeyEventAfterTextInputClient(
bool CefRenderWidgetHostViewOSR::GetCachedFirstRectForCharacterRange(
gfx::Range range, gfx::Rect* rect, gfx::Range* actual_range) const {
DCHECK(rect);
CefTextInputClientOSRMac* client = GetInputClientFromContext(
text_input_context_osr_mac_);
const gfx::Range requested_range(range);
// If requested range is same as caret location, we can just return it.
if (selection_range_.is_empty() && gfx::Range(range) == selection_range_) {
if (selection_range_.is_empty() && requested_range == selection_range_) {
if (actual_range)
*actual_range = range;
*rect = client->caret_rect_;
*rect = caret_rect_;
return true;
}
if (composition_range_.is_empty()) {
if (!selection_range_.Contains(requested_range))
return false;
if (actual_range)
*actual_range = selection_range_;
*rect = first_selection_rect_;
return true;
}
const gfx::Range request_range_in_composition =
ConvertCharacterRangeToCompositionRange(gfx::Range(range));
ConvertCharacterRangeToCompositionRange(requested_range);
if (request_range_in_composition == gfx::Range::InvalidRange())
return false;
// If firstRectForCharacterRange in WebFrame is failed in renderer,
// ImeCompositionRangeChanged will be sent with empty vector.
if (client->composition_bounds_.empty())
if (composition_bounds_.empty())
return false;
DCHECK_EQ(client->composition_bounds_.size(),
client->composition_range_.length());
DCHECK_EQ(composition_bounds_.size(), composition_range_.length());
gfx::Range ui_actual_range;
*rect = GetFirstRectForCompositionRange(request_range_in_composition,
&ui_actual_range);
if (actual_range) {
*actual_range = gfx::Range(
client->composition_range_.start() + ui_actual_range.start(),
client->composition_range_.start() + ui_actual_range.end()).ToNSRange();
composition_range_.start() + ui_actual_range.start(),
composition_range_.start() + ui_actual_range.end());
}
return true;
}
gfx::Rect CefRenderWidgetHostViewOSR::GetFirstRectForCompositionRange(
const gfx::Range& range, gfx::Range* actual_range) const {
CefTextInputClientOSRMac* client = GetInputClientFromContext(
text_input_context_osr_mac_);
DCHECK(client);
DCHECK(actual_range);
DCHECK(!client->composition_bounds_.empty());
DCHECK_LE(range.start(), client->composition_bounds_.size());
DCHECK_LE(range.end(), client->composition_bounds_.size());
DCHECK(!composition_bounds_.empty());
DCHECK(range.start() <= composition_bounds_.size());
DCHECK(range.end() <= composition_bounds_.size());
if (range.is_empty()) {
*actual_range = range;
if (range.start() == client->composition_bounds_.size()) {
return gfx::Rect(client->composition_bounds_[range.start() - 1].right(),
client->composition_bounds_[range.start() - 1].y(),
if (range.start() == composition_bounds_.size()) {
return gfx::Rect(composition_bounds_[range.start() - 1].right(),
composition_bounds_[range.start() - 1].y(),
0,
client->composition_bounds_[range.start() - 1].height());
composition_bounds_[range.start() - 1].height());
} else {
return gfx::Rect(client->composition_bounds_[range.start()].x(),
client->composition_bounds_[range.start()].y(),
return gfx::Rect(composition_bounds_[range.start()].x(),
composition_bounds_[range.start()].y(),
0,
client->composition_bounds_[range.start()].height());
composition_bounds_[range.start()].height());
}
}
size_t end_idx;
if (!GetLineBreakIndex(client->composition_bounds_,
range, &end_idx)) {
if (!GetLineBreakIndex(composition_bounds_, range, &end_idx)) {
end_idx = range.end();
}
*actual_range = gfx::Range(range.start(), end_idx);
gfx::Rect rect = client->composition_bounds_[range.start()];
gfx::Rect rect = composition_bounds_[range.start()];
for (size_t i = range.start() + 1; i < end_idx; ++i) {
rect.Union(client->composition_bounds_[i]);
rect.Union(composition_bounds_[i]);
}
return rect;
}
gfx::Range CefRenderWidgetHostViewOSR::ConvertCharacterRangeToCompositionRange(
const gfx::Range& request_range) const {
CefTextInputClientOSRMac* client = GetInputClientFromContext(
text_input_context_osr_mac_);
DCHECK(client);
if (client->composition_range_.is_empty())
if (composition_range_.is_empty())
return gfx::Range::InvalidRange();
if (request_range.is_reversed())
return gfx::Range::InvalidRange();
if (request_range.start() < client->composition_range_.start()
|| request_range.start() > client->composition_range_.end()
|| request_range.end() > client->composition_range_.end())
if (request_range.start() < composition_range_.start() ||
request_range.start() > composition_range_.end() ||
request_range.end() > composition_range_.end()) {
return gfx::Range::InvalidRange();
}
return gfx::Range(request_range.start() - client->composition_range_.start(),
request_range.end() - client->composition_range_.start());
return gfx::Range(
request_range.start() - composition_range_.start(),
request_range.end() - composition_range_.start());
}
bool CefRenderWidgetHostViewOSR::GetLineBreakIndex(

View File

@ -9,13 +9,10 @@
#include "libcef/browser/origin_whitelist_impl.h"
#include "libcef/browser/resource_context.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/guid.h"
#include "base/memory/scoped_vector.h"
#include "components/navigation_interception/intercept_navigation_resource_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/browser/resource_request_info.h"
@ -30,37 +27,6 @@
namespace {
bool NavigationOnUIThread(
int64 frame_id,
CefRefPtr<CefRequestImpl> request,
content::WebContents* source,
const navigation_interception::NavigationParams& params) {
CEF_REQUIRE_UIT();
bool ignore_navigation = false;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(source);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get()) {
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
if (handler.get()) {
CefRefPtr<CefFrame> frame;
if (frame_id >= 0)
frame = browser->GetFrame(frame_id);
DCHECK(frame.get());
if (frame.get()) {
ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.is_redirect());
}
}
}
}
return ignore_navigation;
}
void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
int64 expected_content_size,
int render_process_id,
@ -105,37 +71,6 @@ CefResourceDispatcherHostDelegate::CefResourceDispatcherHostDelegate() {
CefResourceDispatcherHostDelegate::~CefResourceDispatcherHostDelegate() {
}
void CefResourceDispatcherHostDelegate::RequestBeginning(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
content::ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles) {
if (resource_type == content::ResourceType::RESOURCE_TYPE_MAIN_FRAME ||
resource_type == content::ResourceType::RESOURCE_TYPE_SUB_FRAME) {
int64 frame_id = -1;
// ResourceRequestInfo will not exist for requests originating from
// WebURLLoader in the render process.
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request);
if (info)
frame_id = info->GetRenderFrameID();
if (frame_id >= 0) {
CefRefPtr<CefRequestImpl> cef_request(new CefRequestImpl);
cef_request->Set(request);
cef_request->SetReadOnly(true);
content::ResourceThrottle* throttle =
new navigation_interception::InterceptNavigationResourceThrottle(
request,
base::Bind(&NavigationOnUIThread, frame_id, cef_request));
throttles->push_back(throttle);
}
}
}
bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
const GURL& url,
int child_id,

View File

@ -20,12 +20,6 @@ class CefResourceDispatcherHostDelegate
~CefResourceDispatcherHostDelegate() override;
// ResourceDispatcherHostDelegate methods.
void RequestBeginning(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
content::ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles) override;
bool HandleExternalProtocol(const GURL& url,
int child_id,
int route_id,

View File

@ -21,19 +21,6 @@
// mac when window rendering is disabled.
@interface CefTextInputClientOSRMac : NSObject<NSTextInputClient> {
@public
// The range of current marked text inside the whole content of the DOM node
// being edited.
NSRange markedRange_;
// The current composition character range and its bounds.
gfx::Range composition_range_;
std::vector<gfx::Rect> composition_bounds_;
// The current caret bounds.
gfx::Rect caret_rect_;
@private
// Represents the input-method attributes supported by this object.
base::scoped_nsobject<NSArray> validAttributesForMarkedText_;

View File

@ -5,6 +5,7 @@
#include "libcef/browser/text_input_client_osr_mac.h"
#include "libcef/browser/browser_host_impl.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/sys_string_conversions.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h"
#import "content/browser/renderer_host/text_input_client_mac.h"
@ -81,7 +82,9 @@ extern "C" {
}
- (NSRange)markedRange {
return hasMarkedText_ ? markedRange_ : NSMakeRange(NSNotFound, 0);
return hasMarkedText_ ?
renderWidgetHostView_->composition_range().ToNSRange() :
NSMakeRange(NSNotFound, 0);
}
- (BOOL)hasMarkedText {
@ -192,10 +195,40 @@ extern "C" {
actualRange:(NSRangePointer)actualRange {
if (actualRange)
*actualRange = range;
NSAttributedString* str = content::TextInputClientMac::GetInstance()->
GetAttributedSubstringFromRange(
renderWidgetHostView_->GetRenderWidgetHost(), range);
return str;
const gfx::Range requested_range(range);
if (requested_range.is_reversed())
return nil;
gfx::Range expected_range;
const base::string16* expected_text;
if (!renderWidgetHostView_->composition_range().is_empty()) {
expected_text = &markedText_;
expected_range = renderWidgetHostView_->composition_range();
} else {
expected_text = &renderWidgetHostView_->selection_text();
size_t offset = renderWidgetHostView_->selection_text_offset();
expected_range = gfx::Range(offset, offset + expected_text->size());
}
if (!expected_range.Contains(requested_range))
return nil;
// Gets the raw bytes to avoid unnecessary string copies for generating
// NSString.
const base::char16* bytes =
&(*expected_text)[requested_range.start() - expected_range.start()];
// Avoid integer overflow.
base::CheckedNumeric<size_t> requested_len = requested_range.length();
requested_len *= sizeof(base::char16);
NSUInteger bytes_len = base::strict_cast<NSUInteger, size_t>(
requested_len.ValueOrDefault(0));
base::scoped_nsobject<NSString> ns_string(
[[NSString alloc] initWithBytes:bytes
length:bytes_len
encoding:NSUTF16LittleEndianStringEncoding]);
return [[[NSAttributedString alloc] initWithString:ns_string] autorelease];
}
- (NSRect)firstViewRectForCharacterRange:(NSRange)theRange

View File

@ -53,8 +53,8 @@
#include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_job_manager.h"
#if defined(USE_NSS)
#include "net/ocsp/nss_ocsp.h"
#if defined(USE_NSS_CERTS)
#include "net/cert_net/nss_ocsp.h"
#endif
using content::BrowserThread;
@ -140,7 +140,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
SetCookieStoragePath(cache_path,
settings_.persist_session_cookies ? true : false);
storage_->set_network_delegate(new CefNetworkDelegate);
storage_->set_network_delegate(
make_scoped_ptr<net::NetworkDelegate>(new CefNetworkDelegate));
storage_->set_channel_id_service(make_scoped_ptr(
new net::ChannelIDService(
@ -151,22 +152,23 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
settings_.accept_language_list.length > 0 ?
CefString(&settings_.accept_language_list): "en-US,en";
storage_->set_http_user_agent_settings(
new CefHttpUserAgentSettings(accept_language));
make_scoped_ptr<net::HttpUserAgentSettings>(
new CefHttpUserAgentSettings(accept_language)));
storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
storage_->set_transport_security_state(new net::TransportSecurityState);
storage_->set_transport_security_state(
make_scoped_ptr(new net::TransportSecurityState));
scoped_ptr<net::ProxyService> system_proxy_service;
system_proxy_service.reset(
scoped_ptr<net::ProxyService> system_proxy_service =
ProxyServiceFactory::CreateProxyService(
NULL,
url_request_context_.get(),
url_request_context_->network_delegate(),
proxy_config_service_.release(),
proxy_config_service_.Pass(),
*command_line,
true));
storage_->set_proxy_service(system_proxy_service.release());
true);
storage_->set_proxy_service(system_proxy_service.Pass());
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
@ -179,7 +181,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
supported_schemes.push_back("ntlm");
supported_schemes.push_back("negotiate");
storage_->set_http_auth_handler_factory(
storage_->set_http_auth_handler_factory(make_scoped_ptr(
net::HttpAuthHandlerRegistryFactory::Create(
supported_schemes,
url_security_manager_.get(),
@ -187,7 +189,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
std::string(),
std::string(),
false,
false));
false)));
storage_->set_http_server_properties(
make_scoped_ptr<net::HttpServerProperties>(
new net::HttpServerPropertiesImpl));
@ -223,9 +225,10 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
network_session_params.ignore_certificate_errors =
settings_.ignore_certificate_errors ? true : false;
net::HttpCache* main_cache = new net::HttpCache(network_session_params,
main_backend);
storage_->set_http_transaction_factory(main_cache);
scoped_ptr<net::HttpCache> main_cache(
new net::HttpCache(network_session_params,
main_backend));
storage_->set_http_transaction_factory(main_cache.Pass());
#if !defined(DISABLE_FTP_SUPPORT)
ftp_transaction_factory_.reset(
@ -260,9 +263,9 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
}
request_interceptors_.weak_clear();
storage_->set_job_factory(top_job_factory.release());
storage_->set_job_factory(top_job_factory.Pass());
#if defined(USE_NSS)
#if defined(USE_NSS_CERTS)
// Only do this for the first (global) request context.
static bool request_context_for_nss_set = false;
if (!request_context_for_nss_set) {
@ -359,7 +362,7 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
if (proxy_config_service_.get())
return;
proxy_config_service_.reset(
proxy_config_service_ =
net::ProxyService::CreateSystemProxyConfigService(
io_loop_->task_runner(), file_loop_->task_runner()));
io_loop_->task_runner(), file_loop_->task_runner());
}

View File

@ -6,7 +6,7 @@
#define CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
#include "base/compiler_specific.h"
#include "components/crash/app/crash_reporter_client.h"
#include "components/crash/content/app/crash_reporter_client.h"
class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
public:

View File

@ -45,13 +45,13 @@ class CefPermissionMessageProvider : public PermissionMessageProvider {
~CefPermissionMessageProvider() override {}
// PermissionMessageProvider implementation.
CoalescedPermissionMessages GetPermissionMessages(
PermissionMessages GetPermissionMessages(
const PermissionIDSet& permissions) const override {
return CoalescedPermissionMessages();
return PermissionMessages();
}
bool IsPrivilegeIncrease(const PermissionSet* old_permissions,
const PermissionSet* new_permissions,
bool IsPrivilegeIncrease(const PermissionSet& old_permissions,
const PermissionSet& new_permissions,
Manifest::Type extension_type) const override {
// Ensure we implement this before shipping.
CHECK(false);
@ -59,7 +59,7 @@ class CefPermissionMessageProvider : public PermissionMessageProvider {
}
PermissionIDSet GetAllPermissionIDs(
const PermissionSet* permissions,
const PermissionSet& permissions,
Manifest::Type extension_type) const override {
return PermissionIDSet();
}

View File

@ -54,7 +54,7 @@
#if defined(OS_WIN)
#include <Objbase.h> // NOLINT(build/include_order)
#include "base/win/registry.h"
#include "components/crash/app/breakpad_win.h"
#include "components/crash/content/app/breakpad_win.h"
#endif
#if defined(OS_MACOSX)
@ -62,12 +62,12 @@
#include "base/mac/os_crash_dumps.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "components/crash/app/breakpad_mac.h"
#include "components/crash/content/app/breakpad_mac.h"
#include "content/public/common/content_paths.h"
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "components/crash/app/breakpad_linux.h"
#include "components/crash/content/app/breakpad_linux.h"
#endif
#if defined(OS_LINUX)
@ -430,13 +430,6 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchASCII(switches::kContextSafetyImplementation,
base::IntToString(settings.context_safety_implementation));
}
if (settings.windowless_rendering_enabled) {
#if defined(OS_MACOSX)
// The delegated renderer is not yet enabled by default on OS X.
command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
#endif
}
}
if (content_client_.application().get()) {

View File

@ -9,6 +9,7 @@
#include "base/base64.h"
#include "base/threading/thread_restrictions.h"
#include "components/url_formatter/elide_url.h"
#include "net/base/escape.h"
#include "net/base/mime_util.h"
#include "third_party/WebKit/public/platform/WebString.h"
@ -76,6 +77,12 @@ bool CefCreateURL(const CefURLParts& parts,
return false;
}
CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url,
const CefString& languages) {
return url_formatter::FormatUrlForSecurityDisplay(
GURL(origin_url.ToString()), languages);
}
CefString CefGetMimeType(const CefString& extension) {
// Requests should not block on the disk! On POSIX this goes to disk.
// http://code.google.com/p/chromium/issues/detail?id=59849

View File

@ -11,6 +11,7 @@
#include "libcef/common/upload_data.h"
#include "base/logging.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/common/resource_type.h"
#include "net/base/elements_upload_data_stream.h"
@ -101,12 +102,9 @@ CefRefPtr<CefRequest> CefRequest::Create() {
// CefRequestImpl -------------------------------------------------------------
CefRequestImpl::CefRequestImpl()
: method_("GET"),
resource_type_(RT_SUB_RESOURCE),
transition_type_(TT_EXPLICIT),
identifier_(0U),
flags_(UR_FLAG_NONE),
read_only_(false) {
: read_only_(false) {
base::AutoLock lock_scope(lock_);
Reset();
}
bool CefRequestImpl::IsReadOnly() {
@ -209,6 +207,8 @@ void CefRequestImpl::Set(net::URLRequest* request) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
Reset();
url_ = request->url().spec();
method_ = request->method();
first_party_for_cookies_ = request->first_party_for_cookies().spec();
@ -238,8 +238,6 @@ void CefRequestImpl::Set(net::URLRequest* request) {
if (data) {
postdata_ = CefPostData::Create();
static_cast<CefPostDataImpl*>(postdata_.get())->Set(*data);
} else if (postdata_.get()) {
postdata_ = NULL;
}
const content::ResourceRequestInfo* info =
@ -249,9 +247,6 @@ void CefRequestImpl::Set(net::URLRequest* request) {
static_cast<cef_resource_type_t>(info->GetResourceType());
transition_type_ =
static_cast<cef_transition_type_t>(info->GetPageTransition());
} else {
resource_type_ = RT_SUB_RESOURCE;
transition_type_ = TT_EXPLICIT;
}
}
@ -286,12 +281,37 @@ void CefRequestImpl::Get(net::URLRequest* request) {
}
}
void CefRequestImpl::Set(
const navigation_interception::NavigationParams& params,
bool is_main_frame) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
Reset();
url_ = params.url().spec();
method_ = params.is_post() ? "POST" : "GET";
const content::Referrer& sanitized_referrer =
content::Referrer::SanitizeForRequest(params.url(), params.referrer());
if (!sanitized_referrer.url.is_empty()) {
headermap_.insert(std::make_pair(
CefString("Referrer"), sanitized_referrer.url.spec()));
}
resource_type_ = is_main_frame ? RT_MAIN_FRAME : RT_SUB_FRAME;
transition_type_ =
static_cast<cef_transition_type_t>(params.transition_type());
}
void CefRequestImpl::Set(const blink::WebURLRequest& request) {
DCHECK(!request.isNull());
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
Reset();
url_ = request.url().spec().utf16();
method_ = request.httpMethod();
@ -299,22 +319,16 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
if (!body.isNull()) {
postdata_ = new CefPostDataImpl();
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
} else if (postdata_.get()) {
postdata_ = NULL;
}
headermap_.clear();
GetHeaderMap(request, headermap_);
flags_ = UR_FLAG_NONE;
if (request.cachePolicy() == blink::WebURLRequest::ReloadIgnoringCacheData)
flags_ |= UR_FLAG_SKIP_CACHE;
if (request.allowStoredCredentials())
flags_ |= UR_FLAG_ALLOW_CACHED_CREDENTIALS;
if (request.reportUploadProgress())
flags_ |= UR_FLAG_REPORT_UPLOAD_PROGRESS;
if (request.reportRawHeaders())
flags_ |= UR_FLAG_REPORT_RAW_HEADERS;
first_party_for_cookies_ = request.firstPartyForCookies().spec().utf16();
}
@ -349,8 +363,6 @@ void CefRequestImpl::Get(blink::WebURLRequest& request) {
UR_FLAG_ALLOW_CACHED_CREDENTIALS);
SETBOOLFLAG(request, flags_, setReportUploadProgress,
UR_FLAG_REPORT_UPLOAD_PROGRESS);
SETBOOLFLAG(request, flags_, setReportRawHeaders,
UR_FLAG_REPORT_RAW_HEADERS);
if (!first_party_for_cookies_.empty()) {
GURL gurl = GURL(first_party_for_cookies_.ToString());
@ -412,6 +424,21 @@ void CefRequestImpl::SetHeaderMap(const HeaderMap& map,
base::string16(it->second));
}
void CefRequestImpl::Reset() {
lock_.AssertAcquired();
DCHECK(!read_only_);
url_.clear();
method_ = "GET";
postdata_ = NULL;
headermap_.clear();
resource_type_ = RT_SUB_RESOURCE;
transition_type_ = TT_EXPLICIT;
identifier_ = 0U;
flags_ = UR_FLAG_NONE;
first_party_for_cookies_.clear();
}
// CefPostData ----------------------------------------------------------------
// static

View File

@ -11,6 +11,10 @@
#include "base/synchronization/lock.h"
#include "third_party/WebKit/public/platform/WebHTTPBody.h"
namespace navigation_interception {
class NavigationParams;
}
namespace net {
class HttpRequestHeaders;
class UploadData;
@ -56,6 +60,12 @@ class CefRequestImpl : public CefRequest {
// Populate the URLRequest object from this object.
void Get(net::URLRequest* request);
// Populate this object from the NavigationParams object.
// TODO(cef): Remove the |is_main_frame| argument once NavigationParams is
// reliable in reporting that value.
void Set(const navigation_interception::NavigationParams& params,
bool is_main_frame);
// Populate this object from a WebURLRequest object.
void Set(const blink::WebURLRequest& request);
@ -71,7 +81,9 @@ class CefRequestImpl : public CefRequest {
static void SetHeaderMap(const HeaderMap& map,
blink::WebURLRequest& request);
protected:
private:
void Reset();
CefString url_;
CefString method_;
CefRefPtr<CefPostData> postdata_;
@ -113,7 +125,7 @@ class CefPostDataImpl : public CefPostData {
void SetReadOnly(bool read_only);
protected:
private:
ElementVector elements_;
// True if this object is read-only.
@ -150,7 +162,7 @@ class CefPostDataElementImpl : public CefPostDataElement {
void SetReadOnly(bool read_only);
protected:
private:
void Cleanup();
Type type_;

View File

@ -112,54 +112,6 @@ class CefPrerendererClient : public content::RenderViewObserver,
void willAddPrerender(blink::WebPrerender* prerender) override {}
};
// Implementation of SequencedTaskRunner for WebWorker threads.
class CefWebWorkerTaskRunner : public base::SequencedTaskRunner,
public content::WorkerTaskRunner::Observer {
public:
CefWebWorkerTaskRunner(content::WorkerTaskRunner* runner,
int worker_id)
: runner_(runner),
worker_id_(worker_id) {
DCHECK(runner_);
DCHECK_GT(worker_id_, 0);
DCHECK(RunsTasksOnCurrentThread());
// Adds an observer for the current thread.
runner_->AddStopObserver(this);
}
// SequencedTaskRunner methods:
bool PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) override {
return PostDelayedTask(from_here, task, delay);
}
// TaskRunner methods:
bool PostDelayedTask(const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) override {
if (delay != base::TimeDelta())
LOG(WARNING) << "Delayed tasks are not supported on WebWorker threads";
runner_->PostTask(worker_id_, task);
return true;
}
bool RunsTasksOnCurrentThread() const override {
return (runner_->CurrentWorkerId() == worker_id_);
}
// WorkerTaskRunner::Observer methods:
void OnWorkerRunLoopStopped() override {
CefContentRendererClient::Get()->RemoveWorkerTaskRunner(worker_id_);
}
private:
content::WorkerTaskRunner* runner_;
int worker_id_;
};
void IsGuestViewApiAvailableToScriptContext(
bool* api_is_available,
extensions::ScriptContext* context) {
@ -351,21 +303,6 @@ void CefContentRendererClient::DevToolsAgentDetached() {
// When the last DevToolsAgent is detached the stack size is set to 0.
// Restore the user-specified stack size here.
CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_);
// And do the same for any WebWorker threads.
WorkerTaskRunnerMap map_copy;
{
base::AutoLock lock_scope(worker_task_runner_lock_);
map_copy = worker_task_runner_map_;
}
WorkerTaskRunnerMap::const_iterator it = map_copy.begin();
for (; it != map_copy.end(); ++it) {
it->second->PostTask(FROM_HERE,
base::Bind(CefV8SetUncaughtExceptionStackSize,
uncaught_exception_stack_size_));
}
}
}
@ -374,45 +311,9 @@ scoped_refptr<base::SequencedTaskRunner>
// Check if currently on the render thread.
if (CEF_CURRENTLY_ON_RT())
return render_task_runner_;
// Check if a WebWorker exists for the current thread.
content::WorkerTaskRunner* worker_runner =
content::WorkerTaskRunner::Instance();
int worker_id = worker_runner->CurrentWorkerId();
if (worker_id > 0) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::const_iterator it =
worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
return it->second;
scoped_refptr<base::SequencedTaskRunner> task_runner =
new CefWebWorkerTaskRunner(worker_runner, worker_id);
worker_task_runner_map_[worker_id] = task_runner;
return task_runner;
}
return NULL;
}
scoped_refptr<base::SequencedTaskRunner>
CefContentRendererClient::GetWorkerTaskRunner(int worker_id) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::const_iterator it =
worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
return it->second;
return NULL;
}
void CefContentRendererClient::RemoveWorkerTaskRunner(int worker_id) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::iterator it = worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
worker_task_runner_map_.erase(it);
}
void CefContentRendererClient::RunSingleProcessCleanup() {
DCHECK(content::RenderProcessHost::run_renderer_in_process());

View File

@ -71,18 +71,10 @@ class CefContentRendererClient : public content::ContentRendererClient,
void DevToolsAgentAttached();
void DevToolsAgentDetached();
// Returns the task runner for the current thread. If this is a WebWorker
// thread and the task runner does not already exist it will be created.
// Returns NULL if the current thread is not a valid render process thread.
// Returns the task runner for the current thread. Returns NULL if the current
// thread is not the main render process thread.
scoped_refptr<base::SequencedTaskRunner> GetCurrentTaskRunner();
// Returns the task runner for the specified worker ID or NULL if the
// specified worker ID is not valid.
scoped_refptr<base::SequencedTaskRunner> GetWorkerTaskRunner(int worker_id);
// Remove the task runner associated with the specified worker ID.
void RemoveWorkerTaskRunner(int worker_id);
// Perform cleanup work that needs to occur before shutdown when running in
// single-process mode. Blocks until cleanup is complete.
void RunSingleProcessCleanup();
@ -154,13 +146,6 @@ class CefContentRendererClient : public content::ContentRendererClient,
int devtools_agent_count_;
int uncaught_exception_stack_size_;
// Map of worker thread IDs to task runners. Access must be protected by
// |worker_task_runner_lock_|.
typedef std::map<int, scoped_refptr<base::SequencedTaskRunner> >
WorkerTaskRunnerMap;
WorkerTaskRunnerMap worker_task_runner_map_;
base::Lock worker_task_runner_lock_;
// Used in single-process mode to test when cleanup is complete.
// Access must be protected by |single_process_cleanup_lock_|.
bool single_process_cleanup_complete_;

View File

@ -51,28 +51,7 @@ CefDOMNodeImpl::Type CefDOMNodeImpl::GetType() {
if (!VerifyContext())
return DOM_NODE_TYPE_UNSUPPORTED;
switch (node_.nodeType()) {
case WebNode::ElementNode:
return DOM_NODE_TYPE_ELEMENT;
case WebNode::AttributeNode:
return DOM_NODE_TYPE_ATTRIBUTE;
case WebNode::TextNode:
return DOM_NODE_TYPE_TEXT;
case WebNode::CDataSectionNode:
return DOM_NODE_TYPE_CDATA_SECTION;
case WebNode::ProcessingInstructionsNode:
return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS;
case WebNode::CommentNode:
return DOM_NODE_TYPE_COMMENT;
case WebNode::DocumentNode:
return DOM_NODE_TYPE_DOCUMENT;
case WebNode::DocumentTypeNode:
return DOM_NODE_TYPE_DOCUMENT_TYPE;
case WebNode::DocumentFragmentNode:
return DOM_NODE_TYPE_DOCUMENT_FRAGMENT;
default:
return DOM_NODE_TYPE_UNSUPPORTED;
}
return webkit_glue::GetNodeType(node_);
}
bool CefDOMNodeImpl::IsText() {
@ -166,7 +145,7 @@ CefString CefDOMNodeImpl::GetName() {
if (!VerifyContext())
return str;
const WebString& name = node_.nodeName();
const WebString& name = webkit_glue::GetNodeName(node_);
if (!name.isNull())
str = name;
@ -226,7 +205,7 @@ CefString CefDOMNodeImpl::GetAsMarkup() {
if (!VerifyContext())
return str;
const WebString& markup = node_.createMarkup();
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
if (!markup.isNull())
str = markup;

View File

@ -4,12 +4,6 @@
#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/extension.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
namespace extensions {
CefExtensionsDispatcherDelegate::CefExtensionsDispatcherDelegate() {
@ -18,19 +12,4 @@ CefExtensionsDispatcherDelegate::CefExtensionsDispatcherDelegate() {
CefExtensionsDispatcherDelegate::~CefExtensionsDispatcherDelegate() {
}
void CefExtensionsDispatcherDelegate::InitOriginPermissions(
const Extension* extension,
bool is_extension_active) {
if (is_extension_active) {
// The chrome: scheme is marked as display isolated in
// RenderThreadImpl::RegisterSchemes() so an exception must be added for
// accessing chrome://resources from the extension origin.
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
extension->url(),
blink::WebString::fromUTF8(content::kChromeUIScheme),
blink::WebString::fromUTF8("resources"),
false);
}
}
} // namespace extensions

View File

@ -16,10 +16,6 @@ class CefExtensionsDispatcherDelegate : public DispatcherDelegate {
~CefExtensionsDispatcherDelegate() override;
private:
// DispatcherDelegate implementation.
void InitOriginPermissions(const Extension* extension,
bool is_extension_active) override;
DISALLOW_COPY_AND_ASSIGN(CefExtensionsDispatcherDelegate);
};

View File

@ -99,6 +99,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
values.SetString("name", name);
values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE));
values.SetString("pluginType",
frame->view()->mainFrame()->isWebLocalFrame() &&
frame->view()->mainFrame()->document().isPluginDocument()
? "document"
: "embedded");
@ -240,8 +241,10 @@ void CefPluginPlaceholder::ShowContextMenu(
content::MenuItem hide_item;
hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE;
hide_item.enabled =
!GetFrame()->view()->mainFrame()->document().isPluginDocument();
bool is_main_frame_plugin_document =
GetFrame()->view()->mainFrame()->isWebLocalFrame() &&
GetFrame()->view()->mainFrame()->document().isPluginDocument();
hide_item.enabled = !is_main_frame_plugin_document;
hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE);
params.custom_items.push_back(hide_item);

View File

@ -27,6 +27,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "third_party/WebKit/Source/core/css/parser/CSSParser.h"
#include "third_party/WebKit/Source/core/dom/Node.h"
#include "third_party/WebKit/Source/core/editing/serializers/Serialization.h"
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
#include "third_party/WebKit/Source/web/WebViewImpl.h"
MSVC_POP_WARNING();
@ -79,6 +80,41 @@ std::string DumpDocumentText(blink::WebFrame* frame) {
return document_element.textContent().utf8();
}
cef_dom_node_type_t GetNodeType(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
switch (web_node->nodeType()) {
case blink::Node::ELEMENT_NODE:
return DOM_NODE_TYPE_ELEMENT;
case blink::Node::ATTRIBUTE_NODE:
return DOM_NODE_TYPE_ATTRIBUTE;
case blink::Node::TEXT_NODE:
return DOM_NODE_TYPE_TEXT;
case blink::Node::CDATA_SECTION_NODE:
return DOM_NODE_TYPE_CDATA_SECTION;
case blink::Node::PROCESSING_INSTRUCTION_NODE:
return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS;
case blink::Node::COMMENT_NODE:
return DOM_NODE_TYPE_COMMENT;
case blink::Node::DOCUMENT_NODE:
return DOM_NODE_TYPE_DOCUMENT;
case blink::Node::DOCUMENT_TYPE_NODE:
return DOM_NODE_TYPE_DOCUMENT_TYPE;
case blink::Node::DOCUMENT_FRAGMENT_NODE:
return DOM_NODE_TYPE_DOCUMENT_FRAGMENT;
}
return DOM_NODE_TYPE_UNSUPPORTED;
}
blink::WebString GetNodeName(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
return web_node->nodeName();
}
blink::WebString CreateNodeMarkup(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
return blink::createMarkup(web_node);
}
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
blink::Node* web_node = node.unwrap<blink::Node>();
web_node->setNodeValue(value);

View File

@ -10,6 +10,8 @@
#include "base/basictypes.h"
#include "third_party/skia/include/core/SkColor.h"
#include "include/internal/cef_types.h"
namespace blink {
class WebFrame;
class WebNode;
@ -29,6 +31,10 @@ void GoForward(blink::WebView* view);
// Returns the text of the document element.
std::string DumpDocumentText(blink::WebFrame* frame);
// Expose additional actions on WebNode.
cef_dom_node_type_t GetNodeType(const blink::WebNode& node);
blink::WebString GetNodeName(const blink::WebNode& node);
blink::WebString CreateNodeMarkup(const blink::WebNode& node);
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value);
int64 GetIdentifier(blink::WebFrame* frame);

View File

@ -10,8 +10,6 @@
<release seq="1">
<includes>
<include name="IDR_CEF_DEVTOOLS_DISCOVERY_PAGE" file="devtools_discovery_page.html" type="BINDATA" />
<include name="IDR_CEF_CREDITS_HTML" file="${about_credits_file}" use_base_dir="false" type="BINDATA" />
<include name="IDR_CEF_CREDITS_JS" file="..\..\..\chrome\browser\resources\about_credits.js" type="BINDATA" />
<include name="IDR_CEF_LICENSE_TXT" file="..\..\LICENSE.txt" type="BINDATA" />
<include name="IDR_CEF_VERSION_HTML" file="about_version.html" type="BINDATA" />

View File

@ -460,6 +460,25 @@ CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts,
return _retval;
}
CEF_EXPORT cef_string_userfree_t cef_format_url_for_security_display(
const cef_string_t* origin_url, const cef_string_t* languages) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: origin_url; type: string_byref_const
DCHECK(origin_url);
if (!origin_url)
return NULL;
// Unverified params: languages
// Execute
CefString _retval = CefFormatUrlForSecurityDisplay(
CefString(origin_url),
CefString(languages));
// Return type: string
return _retval.DetachToUserFree();
}
CEF_EXPORT cef_string_userfree_t cef_get_mime_type(
const cef_string_t* extension) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -421,6 +421,27 @@ CEF_GLOBAL bool CefCreateURL(const CefURLParts& parts, CefString& url) {
return _retval?true:false;
}
CEF_GLOBAL CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url,
const CefString& languages) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: origin_url; type: string_byref_const
DCHECK(!origin_url.empty());
if (origin_url.empty())
return CefString();
// Unverified params: languages
// Execute
cef_string_userfree_t _retval = cef_format_url_for_security_display(
origin_url.GetStruct(),
languages.GetStruct());
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CEF_GLOBAL CefString CefGetMimeType(const CefString& extension) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

View File

@ -192,19 +192,6 @@ macro(FIX_MACOSX_MAIN_FRAMEWORK_LINK target app_path)
)
endmacro()
# Make the other helper app bundles.
macro(MAKE_MACOSX_HELPERS target app_path)
add_custom_command(TARGET ${target}
POST_BUILD
# The exported variables need to be set for generators other than Xcode.
COMMAND export BUILT_PRODUCTS_DIR=${app_path} &&
export CONTENTS_FOLDER_PATH=/Contents &&
tools/make_more_helpers.sh "Frameworks" "${target}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM
)
endmacro()
# Manually process and copy over resource files.
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
foreach(FILENAME ${resource_list})

View File

@ -14,8 +14,6 @@ patches = [
{
# Fix Xcode 4 build on OS X Lion.
# http://codereview.chromium.org/8086022/
# Fix incorrect detection of DEPOT_TOOLS_WIN_TOOLCHAIN=0 on Windows.
# https://code.google.com/p/chromium/issues/detail?id=523154
'name': 'build',
'path': '../build/',
},
@ -202,13 +200,6 @@ patches = [
'name': 'supports_user_data_1710',
'path': '../base/',
},
{
# Fix warning treated as error with Widevine CDM 64-bit Windows build.
# https://bitbucket.org/chromiumembedded/cef/issues/1631/
# https://codereview.chromium.org/1326413003
'name': 'widevine_cdm_1631',
'path': '../media/cdm/stub/',
},
{
# Fix background color on Mac.
# https://codereview.chromium.org/1070383005 (reverted)

View File

@ -1,5 +1,5 @@
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
index dc6789f..70edd0e 100644
index ecda893d..446c6e6 100644
--- render_widget_host_view_guest.cc
+++ render_widget_host_view_guest.cc
@@ -191,6 +191,9 @@ void RenderWidgetHostViewGuest::Destroy() {

View File

@ -1,5 +1,5 @@
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
index b0de6b9..d0cab8f 100644
index 00529ff..57ccf08 100644
--- browser/browser_plugin/browser_plugin_guest.cc
+++ browser/browser_plugin/browser_plugin_guest.cc
@@ -23,7 +23,7 @@
@ -11,7 +11,7 @@ index b0de6b9..d0cab8f 100644
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/content_constants_internal.h"
@@ -286,20 +286,19 @@ void BrowserPluginGuest::InitInternal(
@@ -289,20 +289,19 @@ void BrowserPluginGuest::InitInternal(
guest_window_rect_ = params.view_rect;
if (owner_web_contents_ != owner_web_contents) {
@ -36,7 +36,7 @@ index b0de6b9..d0cab8f 100644
}
RendererPreferences* renderer_prefs =
@@ -731,12 +730,9 @@ void BrowserPluginGuest::OnWillAttachComplete(
@@ -748,12 +747,9 @@ void BrowserPluginGuest::OnWillAttachComplete(
// This will trigger a callback to RenderViewReady after a round-trip IPC.
static_cast<RenderViewHostImpl*>(
GetWebContents()->GetRenderViewHost())->Init();
@ -90,7 +90,7 @@ index fd7dec4..49d4f99 100644
+
} // namespace content
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
index 000e3b6..ced8765 100644
index aabe27b..8ff46f4 100644
--- public/browser/browser_plugin_guest_delegate.h
+++ public/browser/browser_plugin_guest_delegate.h
@@ -21,6 +21,8 @@ class Size;
@ -102,11 +102,10 @@ index 000e3b6..ced8765 100644
// Objects implement this interface to get notified about changes in the guest
// WebContents and to provide necessary functionality.
@@ -86,6 +88,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Provides the delegate with an interface with which to communicate with the
@@ -87,6 +89,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// content module.
virtual void SetGuestHost(GuestHost* guest_host) {}
+
+ // Called when a guest is attached or detached.
+ virtual void OnGuestAttached(content::WebContentsView* guest_view,
+ content::WebContentsView* parent_view);
@ -117,6 +116,7 @@ index 000e3b6..ced8765 100644
+ virtual void CreateViewForWidget(
+ content::WebContentsView* guest_view,
+ content::RenderWidgetHost* render_widget_host);
};
} // namespace content
+
// Sets the position of the context menu for the guest contents. The value
// reported from the guest renderer should be ignored. The reported value
// fromt he guest renderer is incorrect in situations where BrowserPlugin is

View File

@ -1,9 +1,9 @@
diff --git web_contents_impl.cc web_contents_impl.cc
index f7505af..ef9ff79 100644
index 7c84d90..2aaace4 100644
--- web_contents_impl.cc
+++ web_contents_impl.cc
@@ -1351,23 +1351,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
params.main_frame_routing_id);
@@ -1353,23 +1353,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
MSG_ROUTING_NONE);
frame_tree_.root()->SetFrameName(params.main_frame_name);
- WebContentsViewDelegate* delegate =
@ -50,7 +50,7 @@ index f7505af..ef9ff79 100644
}
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -1705,6 +1712,9 @@ void WebContentsImpl::CreateNewWindow(
@@ -1715,6 +1722,9 @@ void WebContentsImpl::CreateNewWindow(
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
@ -60,7 +60,7 @@ index f7505af..ef9ff79 100644
if (delegate_ &&
!delegate_->ShouldCreateWebContents(this,
route_id,
@@ -1713,7 +1723,9 @@ void WebContentsImpl::CreateNewWindow(
@@ -1723,7 +1733,9 @@ void WebContentsImpl::CreateNewWindow(
params.frame_name,
params.target_url,
partition_id,
@ -71,7 +71,7 @@ index f7505af..ef9ff79 100644
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
@@ -1735,6 +1747,8 @@ void WebContentsImpl::CreateNewWindow(
@@ -1745,6 +1757,8 @@ void WebContentsImpl::CreateNewWindow(
create_params.opener_render_process_id = render_process_id;
create_params.opener_render_frame_id = params.opener_render_frame_id;
create_params.opener_suppressed = params.opener_suppressed;

View File

@ -1,5 +1,5 @@
diff --git common.gypi common.gypi
index cff7376..d16e12d 100644
index cce7b3c..84a702a 100644
--- common.gypi
+++ common.gypi
@@ -9,6 +9,9 @@
@ -25,18 +25,3 @@ index c9cf226..0dedbe3 100755
stdout=subprocess.PIPE)
archs = []
diff --git vs_toolchain.py vs_toolchain.py
index cea0d6d..158d0a8 100755
--- vs_toolchain.py
+++ vs_toolchain.py
@@ -32,8 +32,8 @@ def SetEnvironmentAndGetRuntimeDllDirs():
bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
# When running on a non-Windows host, only do this if the SDK has explicitly
# been downloaded before (in which case json_data_file will exist).
- if ((sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain) or
- os.path.exists(json_data_file)):
+ if ((sys.platform in ('win32', 'cygwin') or os.path.exists(json_data_file)) and
+ depot_tools_win_toolchain):
if not os.path.exists(json_data_file):
Update()
with open(json_data_file, 'r') as tempf:

View File

@ -1,8 +1,8 @@
diff --git ui/browser.cc ui/browser.cc
index befe5b8..e02cde4 100644
index 36d24b6..bbc5075 100644
--- ui/browser.cc
+++ ui/browser.cc
@@ -1646,7 +1646,9 @@ bool Browser::ShouldCreateWebContents(
@@ -1669,7 +1669,9 @@ bool Browser::ShouldCreateWebContents(
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
@ -14,10 +14,10 @@ index befe5b8..e02cde4 100644
// If a BackgroundContents is created, suppress the normal WebContents.
return !MaybeCreateBackgroundContents(route_id,
diff --git ui/browser.h ui/browser.h
index 362d85a..60a12ef 100644
index e296569..bf03785 100644
--- ui/browser.h
+++ ui/browser.h
@@ -586,7 +586,9 @@ class Browser : public TabStripModelObserver,
@@ -591,7 +591,9 @@ class Browser : public TabStripModelObserver,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@ -1,8 +1,8 @@
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
index 4c0b363..092ad56 100644
index b7ed844..c6ec2a9 100644
--- content/browser/compositor/gpu_process_transport_factory.cc
+++ content/browser/compositor/gpu_process_transport_factory.cc
@@ -140,6 +140,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
@@ -142,6 +142,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
scoped_ptr<cc::SoftwareOutputDevice>
GpuProcessTransportFactory::CreateSoftwareOutputDevice(
ui::Compositor* compositor) {
@ -17,7 +17,7 @@ index 4c0b363..092ad56 100644
return scoped_ptr<cc::SoftwareOutputDevice>(
new SoftwareOutputDeviceWin(software_backing_.get(), compositor));
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
index 7c4166f..afeea2f 100644
index fe2a033..b6cd7c9 100644
--- ui/compositor/compositor.h
+++ ui/compositor/compositor.h
@@ -15,6 +15,7 @@
@ -46,7 +46,7 @@ index 7c4166f..afeea2f 100644
// Compositor object to take care of GPU painting.
// A Browser compositor object is responsible for generating the final
// displayable form of pixels comprising a single widget's contents. It draws an
@@ -170,6 +182,9 @@ class COMPOSITOR_EXPORT Compositor
@@ -169,6 +181,9 @@ class COMPOSITOR_EXPORT Compositor
// Schedules a redraw of the layer tree associated with this compositor.
void ScheduleDraw();

View File

@ -1,8 +1,8 @@
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
index 9513339..75ddff8 100644
index e09e803..ff26996 100644
--- public/renderer/content_renderer_client.cc
+++ public/renderer/content_renderer_client.cc
@@ -103,6 +103,18 @@ bool ContentRendererClient::AllowPopup() {
@@ -98,6 +98,18 @@ bool ContentRendererClient::AllowPopup() {
return false;
}
@ -22,7 +22,7 @@ index 9513339..75ddff8 100644
const GURL& url,
const std::string& http_method,
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
index ccf4b5f..91a5be3 100644
index df8d501..f3a2068 100644
--- public/renderer/content_renderer_client.h
+++ public/renderer/content_renderer_client.h
@@ -16,6 +16,8 @@
@ -34,7 +34,7 @@ index ccf4b5f..91a5be3 100644
#include "ui/base/page_transition_types.h"
#include "v8/include/v8.h"
@@ -198,6 +200,17 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -191,6 +193,17 @@ class CONTENT_EXPORT ContentRendererClient {
// Returns true if a popup window should be allowed.
virtual bool AllowPopup();
@ -53,10 +53,10 @@ index ccf4b5f..91a5be3 100644
// If |send_referrer| is set to false (which is the default), no referrer
// header will be send for the navigation. Otherwise, the referrer header is
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index 8568626..9a746d2 100644
index ff5d269..6ca4948 100644
--- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc
@@ -4240,6 +4240,19 @@ void RenderFrameImpl::OnFailedNavigation(
@@ -4274,6 +4274,19 @@ void RenderFrameImpl::OnFailedNavigation(
WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
RenderFrame* render_frame,
const NavigationPolicyInfo& info) {

View File

@ -1,5 +1,5 @@
diff --git resource_ids resource_ids
index 2741068..03f9753 100644
index 92456c8..9fa9ce3 100644
--- resource_ids
+++ resource_ids
@@ -14,6 +14,12 @@

View File

@ -21,10 +21,10 @@ index 51c288b..d996bbd 100644
dst = self.GypPathToNinja(os.path.join(copy['destination'], basename),
env)
diff --git gyp/msvs_emulation.py gyp/msvs_emulation.py
index ce5c46e..2f03c01 100644
index ca67b12..a3fd903 100644
--- gyp/msvs_emulation.py
+++ gyp/msvs_emulation.py
@@ -1017,8 +1017,10 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags,
@@ -1027,8 +1027,10 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags,
args = vs.SetupScript(arch)
args.extend(('&&', 'set'))
popen = subprocess.Popen(

View File

@ -1,10 +1,10 @@
diff --git hwnd_message_handler.cc hwnd_message_handler.cc
index b394556..729cacf 100644
index 5348080..4f9bec5 100644
--- hwnd_message_handler.cc
+++ hwnd_message_handler.cc
@@ -2687,8 +2687,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
"440919 HWNDMessageHandler::HandleMouseEventInternal6"));
@@ -2364,8 +2364,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
active_mouse_tracking_flags_ = 0;
} else if (event.type() == ui::ET_MOUSEWHEEL) {
// Reroute the mouse wheel to the window under the pointer if applicable.
- return (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
- delegate_->HandleMouseEvent(ui::MouseWheelEvent(msg))) ? 0 : 1;
@ -16,4 +16,4 @@ index b394556..729cacf 100644
+ return 1;
}
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
// There are cases where the code handling the message destroys the window,

View File

@ -1,8 +1,8 @@
diff --git input_method_win.cc input_method_win.cc
index 7db88b6..16793d8 100644
index df75bb2..a688138 100644
--- input_method_win.cc
+++ input_method_win.cc
@@ -581,8 +581,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
@@ -548,8 +548,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
// receiving keyboard input as long as it is an active window. This works well
// even when the |attached_window_handle| becomes active but has not received
// WM_FOCUS yet.

View File

@ -92,7 +92,7 @@ index 63b81b8..0f63f48 100644
content::WebContents* web_contents,
const content::ContextMenuParams& params) {
diff --git mime_handler_view_guest_delegate.h mime_handler_view_guest_delegate.h
index e065104..f68b66c 100644
index e065104d..f68b66c 100644
--- mime_handler_view_guest_delegate.h
+++ mime_handler_view_guest_delegate.h
@@ -6,10 +6,11 @@

View File

@ -1,8 +1,8 @@
diff --git url_request.h url_request.h
index c6ef160..11727b4 100644
index 9209697..a2f73f8 100644
--- url_request.h
+++ url_request.h
@@ -619,10 +619,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
@@ -640,10 +640,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
// or after the response headers are received.
void GetConnectionAttempts(ConnectionAttempts* out) const;

View File

@ -1,5 +1,5 @@
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
index 119fc1d..c7e8699 100644
index a308f84..bbbe950 100644
--- public/common/common_param_traits_macros.h
+++ public/common/common_param_traits_macros.h
@@ -196,6 +196,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@ -11,19 +11,19 @@ index 119fc1d..c7e8699 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
index 11803fa..efe32ff 100644
index deb82db..2da2957 100644
--- public/common/web_preferences.cc
+++ public/common/web_preferences.cc
@@ -171,6 +171,7 @@ WebPreferences::WebPreferences()
@@ -176,6 +176,7 @@ WebPreferences::WebPreferences()
pinch_overlay_scrollbar_thickness(0),
use_solid_color_scrollbars(false),
navigate_on_drag_drop(true),
+ base_background_color(0xFFFFFFFF), // Color::white
v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
slimming_paint_enabled(false),
slimming_paint_v2_enabled(false),
inert_visual_viewport(false),
diff --git public/common/web_preferences.h public/common/web_preferences.h
index bfb67a1..b7170ef 100644
index 75012d1..8da71be 100644
--- public/common/web_preferences.h
+++ public/common/web_preferences.h
@@ -173,6 +173,7 @@ struct CONTENT_EXPORT WebPreferences {
@ -32,15 +32,15 @@ index bfb67a1..b7170ef 100644
bool navigate_on_drag_drop;
+ uint32_t base_background_color;
V8CacheOptions v8_cache_options;
bool slimming_paint_enabled;
bool slimming_paint_v2_enabled;
bool inert_visual_viewport;
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 5f1e6d8..09e81e2 100644
index d6d5d6e..82b499e 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -970,6 +970,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
settings->setJavaEnabled(prefs.java_enabled);
@@ -949,6 +949,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
settings->setCookieEnabled(prefs.cookie_enabled);
settings->setNavigateOnDragDrop(prefs.navigate_on_drag_drop);
+ web_view->setBaseBackgroundColor(prefs.base_background_color);
+

View File

@ -1,20 +1,24 @@
diff --git printing/renderer/print_web_view_helper.cc printing/renderer/print_web_view_helper.cc
index d315efa..a312f77 100644
index 27419d6..0a6757b 100644
--- printing/renderer/print_web_view_helper.cc
+++ printing/renderer/print_web_view_helper.cc
@@ -75,6 +75,7 @@ const double kMinDpi = 1.0;
bool g_is_preview_enabled_ = false;
#else
bool g_is_preview_enabled_ = true;
+#endif // !defined(ENABLE_PRINT_PREVIEW)
@@ -73,6 +73,9 @@ const double kMinDpi = 1.0;
#if defined(ENABLE_PRINT_PREVIEW)
bool g_is_preview_enabled = true;
+#else
+bool g_is_preview_enabled = false;
+#endif // defined(ENABLE_PRINT_PREVIEW)
const char kPageLoadScriptFormat[] =
"document.open(); document.write(%s); document.close();";
@@ -89,7 +90,6 @@ void ExecuteScript(blink::WebFrame* frame,
@@ -87,9 +90,6 @@ void ExecuteScript(blink::WebFrame* frame,
std::string script = base::StringPrintf(script_format, json.c_str());
frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
}
-#endif // !defined(ENABLE_PRINT_PREVIEW)
-#else
-bool g_is_preview_enabled = false;
-#endif // defined(ENABLE_PRINT_PREVIEW)
int GetDPI(const PrintMsg_Print_Params* print_params) {
#if defined(OS_MACOSX)
@ -26,7 +30,7 @@ index d315efa..a312f77 100644
// static - Not anonymous so that platform implementations can use it.
void PrintWebViewHelper::PrintHeaderAndFooter(
blink::WebCanvas* canvas,
@@ -538,7 +537,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
@@ -536,7 +535,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
web_view->close();
frame->close();
}
@ -34,7 +38,7 @@ index d315efa..a312f77 100644
// static - Not anonymous so that platform implementations can use it.
float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
@@ -813,6 +811,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
@@ -807,6 +805,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
print_for_preview_(false),
delegate_(delegate.Pass()),
print_node_in_progress_(false),
@ -42,7 +46,7 @@ index d315efa..a312f77 100644
is_loading_(false),
is_scripted_preview_delayed_(false),
ipc_nesting_level_(0),
@@ -1254,7 +1253,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
@@ -1246,7 +1245,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
// that instead.
auto plugin = delegate_->GetPdfElement(frame);
if (!plugin.isNull()) {
@ -52,17 +56,17 @@ index d315efa..a312f77 100644
return;
}
print_preview_context_.InitWithFrame(frame);
@@ -1287,7 +1288,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
@@ -1279,7 +1280,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
// its |context_menu_node_|.
- if (!g_is_preview_enabled_) {
+ if (!g_is_preview_enabled_ && !force_print_preview_) {
- if (!g_is_preview_enabled) {
+ if (!g_is_preview_enabled && !force_print_preview_) {
blink::WebNode duplicate_node(node);
Print(duplicate_node.document().frame(), duplicate_node, false);
} else {
diff --git printing/renderer/print_web_view_helper.h printing/renderer/print_web_view_helper.h
index 54179ff..0c48602 100644
index d9ea441..dce6b9e 100644
--- printing/renderer/print_web_view_helper.h
+++ printing/renderer/print_web_view_helper.h
@@ -309,7 +309,6 @@ class PrintWebViewHelper
@ -90,10 +94,10 @@ index 54179ff..0c48602 100644
bool is_loading_;
bool is_scripted_preview_delayed_;
diff --git printing/renderer/print_web_view_helper_linux.cc printing/renderer/print_web_view_helper_linux.cc
index 61a1a1d..f931979 100644
index 52f92ec..85f7adb 100644
--- printing/renderer/print_web_view_helper_linux.cc
+++ printing/renderer/print_web_view_helper_linux.cc
@@ -172,7 +172,6 @@ void PrintWebViewHelper::PrintPageInternal(
@@ -154,7 +154,6 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
@ -101,7 +105,7 @@ index 61a1a1d..f931979 100644
if (params.params.display_header_footer) {
// |page_number| is 0-based, so 1 is added.
// TODO(vitalybuka) : why does it work only with 1.25?
@@ -181,7 +180,6 @@ void PrintWebViewHelper::PrintPageInternal(
@@ -163,7 +162,6 @@ void PrintWebViewHelper::PrintPageInternal(
scale_factor / 1.25, page_layout_in_points,
params.params);
}
@ -110,10 +114,10 @@ index 61a1a1d..f931979 100644
RenderPageContent(frame, params.page_number, canvas_area, content_area,
scale_factor, canvas);
diff --git printing/renderer/print_web_view_helper_mac.mm printing/renderer/print_web_view_helper_mac.mm
index 7aa503c..a6413be 100644
index f2b94e7..8c5df5e 100644
--- printing/renderer/print_web_view_helper_mac.mm
+++ printing/renderer/print_web_view_helper_mac.mm
@@ -125,14 +125,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
@@ -126,14 +126,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
skia::SetIsPreviewMetafile(*canvas, is_preview);
@ -129,10 +133,10 @@ index 7aa503c..a6413be 100644
scale_factor, static_cast<blink::WebCanvas*>(canvas));
}
diff --git printing/renderer/print_web_view_helper_pdf_win.cc printing/renderer/print_web_view_helper_pdf_win.cc
index a121448..f2a1a0a 100644
index 56acc74..ac85bf6 100644
--- printing/renderer/print_web_view_helper_pdf_win.cc
+++ printing/renderer/print_web_view_helper_pdf_win.cc
@@ -185,14 +185,12 @@ void PrintWebViewHelper::PrintPageInternal(
@@ -162,14 +162,12 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);

View File

@ -25,7 +25,7 @@ index 887f242..a7cc318 100644
WebContents::CreateParams::~CreateParams() {
}
diff --git web_contents.h web_contents.h
index 803b816..1457ef3 100644
index 08c5ba9..459fe19 100644
--- web_contents.h
+++ web_contents.h
@@ -52,9 +52,11 @@ class PageState;
@ -40,7 +40,7 @@ index 803b816..1457ef3 100644
struct CustomContextMenuContext;
struct DropData;
struct Manifest;
@@ -141,6 +143,10 @@ class WebContents : public PageNavigator,
@@ -142,6 +144,10 @@ class WebContents : public PageNavigator,
// RenderFrame, have already been created on the renderer side, and
// WebContents construction should take this into account.
bool renderer_initiated_creation;
@ -52,7 +52,7 @@ index 803b816..1457ef3 100644
// Creates a new WebContents.
diff --git web_contents_delegate.cc web_contents_delegate.cc
index 016097b..4fb00ed 100644
index b3d2d70..727401c 100644
--- web_contents_delegate.cc
+++ web_contents_delegate.cc
@@ -138,7 +138,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
@ -67,10 +67,10 @@ index 016097b..4fb00ed 100644
}
diff --git web_contents_delegate.h web_contents_delegate.h
index 685c1e6..782ab86 100644
index 76dfd36..f3bec13 100644
--- web_contents_delegate.h
+++ web_contents_delegate.h
@@ -38,9 +38,11 @@ class DownloadItem;
@@ -39,9 +39,11 @@ class DownloadItem;
class JavaScriptDialogManager;
class PageState;
class RenderViewHost;
@ -82,7 +82,7 @@ index 685c1e6..782ab86 100644
struct ColorSuggestion;
struct ContextMenuParams;
struct DropData;
@@ -298,7 +300,9 @@ class CONTENT_EXPORT WebContentsDelegate {
@@ -299,7 +301,9 @@ class CONTENT_EXPORT WebContentsDelegate {
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@ -1,8 +1,8 @@
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index 66f1c31..0eac488 100644
index 8db1f59..41157952 100644
--- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm
@@ -582,9 +582,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
@@ -590,9 +590,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
// Paint this view host with |background_color_| when there is no content
// ready to draw.
background_layer_.reset([[CALayer alloc] init]);

View File

@ -1,5 +1,5 @@
diff --git spellcheck_factory.cc spellcheck_factory.cc
index 4c61d34..9e4f3d1 100644
index fcf2ce8..9e4f3d1 100644
--- spellcheck_factory.cc
+++ spellcheck_factory.cc
@@ -16,6 +16,13 @@
@ -20,13 +20,13 @@ index 4c61d34..9e4f3d1 100644
// static
SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() {
- return Singleton<SpellcheckServiceFactory>::get();
- return base::Singleton<SpellcheckServiceFactory>::get();
+ return g_spellcheck_service_factory.Pointer();
}
SpellcheckServiceFactory::SpellcheckServiceFactory()
diff --git spellcheck_factory.h spellcheck_factory.h
index 3e4ad0e..d52b881 100644
index 7cdf471..d52b881 100644
--- spellcheck_factory.h
+++ spellcheck_factory.h
@@ -7,7 +7,7 @@
@ -42,7 +42,7 @@ index 3e4ad0e..d52b881 100644
static SpellcheckServiceFactory* GetInstance();
private:
- friend struct DefaultSingletonTraits<SpellcheckServiceFactory>;
- friend struct base::DefaultSingletonTraits<SpellcheckServiceFactory>;
+ friend struct base::DefaultLazyInstanceTraits<SpellcheckServiceFactory>;
SpellcheckServiceFactory();

View File

@ -12,7 +12,7 @@ index a8e088c..838b6a0 100644
return host ? host->GetAcceleratedWidget() : NULL;
}
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
index 5bee7fd..3d89853 100644
index 270bd54..72748cf 100644
--- desktop_aura/desktop_window_tree_host_win.cc
+++ desktop_aura/desktop_window_tree_host_win.cc
@@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
@ -26,7 +26,7 @@ index 5bee7fd..3d89853 100644
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
@@ -792,11 +794,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
@@ -793,11 +795,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
}
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@ -45,7 +45,7 @@ index 5bee7fd..3d89853 100644
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
index 4a69310..3b00233 100644
index ed0cb1d..62e3872 100644
--- desktop_aura/desktop_window_tree_host_x11.cc
+++ desktop_aura/desktop_window_tree_host_x11.cc
@@ -172,7 +172,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@ -86,7 +86,7 @@ index 4a69310..3b00233 100644
return bounds_in_pixels_;
}
@@ -1019,6 +1025,8 @@ void DesktopWindowTreeHostX11::SetBounds(
@@ -1020,6 +1026,8 @@ void DesktopWindowTreeHostX11::SetBounds(
}
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
@ -95,7 +95,7 @@ index 4a69310..3b00233 100644
return bounds_in_pixels_.origin();
}
@@ -1132,9 +1140,13 @@ void DesktopWindowTreeHostX11::InitX11Window(
@@ -1133,9 +1141,13 @@ void DesktopWindowTreeHostX11::InitX11Window(
}
}
@ -110,7 +110,7 @@ index 4a69310..3b00233 100644
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
bounds_in_pixels_.height(),
0, // border width
@@ -1787,6 +1799,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
@@ -1789,6 +1801,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
break;
}
@ -122,7 +122,7 @@ index 4a69310..3b00233 100644
if (xev->xfocus.mode != NotifyGrab) {
ReleaseCapture();
diff --git desktop_aura/desktop_window_tree_host_x11.h desktop_aura/desktop_window_tree_host_x11.h
index 73e9e3e..deb2cef 100644
index 73e9e3e6..deb2cef 100644
--- desktop_aura/desktop_window_tree_host_x11.h
+++ desktop_aura/desktop_window_tree_host_x11.h
@@ -85,6 +85,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@ -155,10 +155,10 @@ index 73e9e3e..deb2cef 100644
};
diff --git widget.cc widget.cc
index 280969a..8ea7f0b 100644
index 154d107..cf276b1 100644
--- widget.cc
+++ widget.cc
@@ -118,6 +118,7 @@ Widget::InitParams::InitParams()
@@ -119,6 +119,7 @@ Widget::InitParams::InitParams()
use_system_default_icon(false),
show_state(ui::SHOW_STATE_DEFAULT),
parent(NULL),
@ -166,7 +166,7 @@ index 280969a..8ea7f0b 100644
native_widget(NULL),
desktop_window_tree_host(NULL),
layer_type(ui::LAYER_TEXTURED),
@@ -141,6 +142,7 @@ Widget::InitParams::InitParams(Type type)
@@ -142,6 +143,7 @@ Widget::InitParams::InitParams(Type type)
use_system_default_icon(false),
show_state(ui::SHOW_STATE_DEFAULT),
parent(NULL),
@ -174,7 +174,7 @@ index 280969a..8ea7f0b 100644
native_widget(NULL),
desktop_window_tree_host(NULL),
layer_type(ui::LAYER_TEXTURED),
@@ -315,7 +317,7 @@ void Widget::Init(const InitParams& in_params) {
@@ -316,7 +318,7 @@ void Widget::Init(const InitParams& in_params) {
InitParams params = in_params;
params.child |= (params.type == InitParams::TYPE_CONTROL);
@ -183,7 +183,7 @@ index 280969a..8ea7f0b 100644
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
params.type != views::Widget::InitParams::TYPE_WINDOW &&
@@ -378,7 +380,12 @@ void Widget::Init(const InitParams& in_params) {
@@ -379,7 +381,12 @@ void Widget::Init(const InitParams& in_params) {
Minimize();
} else if (params.delegate) {
SetContentsView(params.delegate->GetContentsView());
@ -198,10 +198,10 @@ index 280969a..8ea7f0b 100644
// This must come after SetContentsView() or it might not be able to find
// the correct NativeTheme (on Linux). See http://crbug.com/384492
diff --git widget.h widget.h
index 320332b..8d46883 100644
index 1342625..7fbc24c 100644
--- widget.h
+++ widget.h
@@ -233,6 +233,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -232,6 +232,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Whether the widget should be maximized or minimized.
ui::WindowShowState show_state;
gfx::NativeView parent;

View File

@ -1,8 +1,8 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index 7f94b2d..1390a1f 100644
index 5577228..74ccf53 100644
--- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp
@@ -801,7 +801,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
@@ -814,7 +814,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
PassRefPtrWillBeRawPtr<PopupMenu> ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select)
{
notifyPopupOpeningObservers();
@ -12,18 +12,18 @@ index 7f94b2d..1390a1f 100644
ASSERT(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index c1d869d..e11d102 100644
index b708684..769c127 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -427,6 +427,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
@@ -421,6 +421,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_enableFakePageScaleAnimationForTesting(false)
, m_fakePageScaleAnimationPageScaleFactor(0)
, m_fakePageScaleAnimationUseAnchor(false)
, m_contextMenuAllowed(false)
+ , m_shouldUseExternalPopupMenus(shouldUseExternalPopupMenus)
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -3959,9 +3960,14 @@ void WebViewImpl::pageScaleFactorChanged()
@@ -4018,9 +4019,14 @@ void WebViewImpl::pageScaleFactorChanged()
m_client->pageScaleFactorChanged();
}
@ -40,10 +40,10 @@ index c1d869d..e11d102 100644
void WebViewImpl::startDragging(LocalFrame* frame,
diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h
index 98268d4..9b2f03a 100644
index a1f3e54..24f60a9 100644
--- Source/web/WebViewImpl.h
+++ Source/web/WebViewImpl.h
@@ -394,7 +394,8 @@ public:
@@ -393,7 +393,8 @@ public:
// Returns true if popup menus should be rendered by the browser, false if
// they should be rendered by WebKit (which is the default).
@ -51,11 +51,11 @@ index 98268d4..9b2f03a 100644
+ void setUseExternalPopupMenusThisInstance(bool);
+ bool useExternalPopupMenus();
bool contextMenuAllowed() const
bool shouldAutoResize() const
{
@@ -687,6 +688,8 @@ private:
bool m_contextMenuAllowed;
@@ -671,6 +672,8 @@ private:
float m_fakePageScaleAnimationPageScaleFactor;
bool m_fakePageScaleAnimationUseAnchor;
+ bool m_shouldUseExternalPopupMenus;
+
@ -63,10 +63,10 @@ index 98268d4..9b2f03a 100644
bool m_ignoreInputEvents;
diff --git public/web/WebView.h public/web/WebView.h
index fac145a..0fc5c23 100644
index 1bce1b2..3ea51c1 100644
--- public/web/WebView.h
+++ public/web/WebView.h
@@ -399,6 +399,7 @@ public:
@@ -400,6 +400,7 @@ public:
// Sets whether select popup menus should be rendered by the browser.
BLINK_EXPORT static void setUseExternalPopupMenus(bool);

View File

@ -1,37 +0,0 @@
diff --git stub_cdm.cc stub_cdm.cc
index 0bfa25e..0db23db 100644
--- stub_cdm.cc
+++ stub_cdm.cc
@@ -5,6 +5,7 @@
#include "media/cdm/stub/stub_cdm.h"
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
// Version number for this stub. The third number represents the
@@ -61,9 +62,11 @@ void StubCdm::CreateSessionAndGenerateRequest(
// Provide a dummy message (with a trivial session ID) to enable some testing
// and be consistent with existing testing without a license server.
std::string session_id(base::UintToString(next_session_id_++));
- host_->OnResolveNewSessionPromise(promise_id, session_id.data(),
- session_id.length());
- host_->OnSessionMessage(session_id.data(), session_id.length(),
+ host_->OnResolveNewSessionPromise(
+ promise_id, session_id.data(),
+ base::checked_cast<uint32_t>(session_id.length()));
+ host_->OnSessionMessage(session_id.data(),
+ base::checked_cast<uint32_t>(session_id.length()),
cdm::kLicenseRequest, nullptr, 0, nullptr, 0);
}
@@ -156,7 +159,8 @@ void StubCdm::OnQueryOutputProtectionStatus(
void StubCdm::FailRequest(uint32 promise_id) {
std::string message("Operation not supported by stub CDM.");
host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0,
- message.data(), message.length());
+ message.data(),
+ base::checked_cast<uint32_t>(message.length()));
}
} // namespace media

View File

@ -206,9 +206,6 @@ if(OS_MACOSX)
# Fix the framework link in the main executable.
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP})
# Make the other helper app bundles.
MAKE_MACOSX_HELPERS(${CEF_TARGET} ${CEF_APP})
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
# Manually process and copy over resource files.
# The Xcode generator handles this via the set_target_properties RESOURCE directive.

View File

@ -336,7 +336,7 @@ bool ClientDialogHandlerGtk::OnJSDialog(
if (!origin_url.empty()) {
title += " - ";
title += origin_url.ToString();
title += CefFormatUrlForSecurityDisplay(origin_url, accept_lang).ToString();
}
GtkWidget* window = GetWindow(browser);

View File

@ -26,7 +26,7 @@
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
<li><a href="https://www.google.com/intl/en/chrome/demos/speech.html">Speech Input</a> - requires "enable-speech-input" flag</li>
<li><a href="http://tests/transparency">Transparency</a></li>
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
<li><a href="http://webglsamples.org/field/field.html">WebGL</a></li>
<li><a href="http://apprtc.appspot.com/">WebRTC</a> - requires "enable-media-stream" flag</li>
<li><a href="http://tests/urlrequest">CefURLRequest</a></li>
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>

View File

@ -127,9 +127,6 @@ if(OS_MACOSX)
# Fix the framework link in the main executable.
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP})
# Make the other helper app bundles.
MAKE_MACOSX_HELPERS(${CEF_TARGET} ${CEF_APP})
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
# Manually process and copy over resource files.
# The Xcode generator handles this via the set_target_properties RESOURCE directive.

View File

@ -175,11 +175,24 @@ class FrameNavExpectationsBrowser : public FrameNavExpectations {
virtual std::string GetContentForURL(const std::string& url) =0;
// Browser-only notifications.
virtual bool OnAfterCreated(CefRefPtr<CefBrowser> browser) { return true; }
virtual bool OnAfterCreated(CefRefPtr<CefBrowser> browser) {
EXPECT_TRUE(browser.get());
return true;
}
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) { return true; }
CefRefPtr<CefFrame> frame,
const std::string& url) {
EXPECT_TRUE(browser.get());
EXPECT_TRUE(frame.get());
EXPECT_FALSE(url.empty());
return true;
}
virtual bool GetResourceHandler(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) { return true; }
CefRefPtr<CefFrame> frame) {
EXPECT_TRUE(browser.get());
EXPECT_TRUE(frame.get());
return true;
}
// Called when the renderer signals completion.
virtual bool OnRendererComplete(CefRefPtr<CefBrowser> browser,
@ -495,8 +508,9 @@ class FrameNavTestHandler : public TestHandler {
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) override {
EXPECT_TRUE(expectations_->OnBeforeBrowse(browser, frame)) <<
"nav = " << nav_;
EXPECT_TRUE(
expectations_->OnBeforeBrowse(browser, frame, request->GetURL())) <<
"nav = " << nav_;
return false;
}
@ -618,7 +632,8 @@ class FrameNavExpectationsBrowserSingleNav :
}
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override {
CefRefPtr<CefFrame> frame,
const std::string& url) override {
EXPECT_FALSE(got_before_browse_);
got_before_browse_.yes();
return true;
@ -1019,11 +1034,12 @@ class FrameNavExpectationsBrowserTestSingleNav :
}
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override {
CefRefPtr<CefFrame> frame,
const std::string& url) override {
V_DECLARE();
V_EXPECT_TRUE(VerifySingleBrowserFrames(browser, frame, true,
std::string()));
V_EXPECT_TRUE(parent::OnBeforeBrowse(browser, frame));
V_EXPECT_TRUE(parent::OnBeforeBrowse(browser, frame, url));
V_RETURN();
}
@ -1555,14 +1571,15 @@ class FrameNavExpectationsBrowserTestMultiNav :
}
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) override {
CefRefPtr<CefFrame> frame,
const std::string& url) override {
V_DECLARE();
std::string expected_url;
if (nav() > 0)
expected_url = GetPreviousMainURL();
V_EXPECT_TRUE(VerifySingleBrowserFrames(browser, frame, true,
expected_url));
V_EXPECT_TRUE(parent::OnBeforeBrowse(browser, frame));
V_EXPECT_TRUE(parent::OnBeforeBrowse(browser, frame, url));
V_RETURN();
}
@ -1893,6 +1910,23 @@ class FrameNavExpectationsBrowserTestNestedIframes :
got_load_end_[0] && got_load_end_[1] && got_load_end_[2];
}
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::string& url) override {
V_DECLARE();
V_EXPECT_TRUE(frame.get());
const int frame_number = GetNavFromMultiNavURL(url);
if (frame_number == 0) {
// Main frame.
V_EXPECT_TRUE(frame->IsMain());
} else {
// Sub frame.
V_EXPECT_FALSE(frame->IsMain());
}
V_EXPECT_TRUE(parent::OnBeforeBrowse(browser, frame, url));
V_RETURN();
}
bool OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading) override {
V_DECLARE();

View File

@ -102,7 +102,7 @@ class JSDialogTestHandler : public TestHandler {
bool& suppress_message) override {
got_onjsdialog_.yes();
EXPECT_STREQ("http://tests/", origin_url.ToString().c_str());
EXPECT_STREQ(kStartUrl, origin_url.ToString().c_str());
EXPECT_TRUE(accept_lang.empty());
if (type_ == TYPE_ALERT) {

View File

@ -85,7 +85,7 @@ const int kVerticalScrollbarWidth = GetSystemMetrics(SM_CXVSCROLL);
const CefRect kEditBoxRect(442, 251, 46, 16);
const CefRect kNavigateButtonRect(375, 275, 130, 20);
const CefRect kSelectRect(461, 21, 87, 26);
const CefRect kExpandedSelectRect(466, 42, 79, 286);
const CefRect kExpandedSelectRect(466, 42, 76, 286);
const CefRect kDropDivRect(9, 330, 52, 52);
const CefRect kDragDivRect(60, 330, 52, 52);
const int kVerticalScrollbarWidth = 15;

View File

@ -219,6 +219,34 @@ TEST(ParserTest, ParseURLNonStandard) {
EXPECT_STREQ("foo", query.ToString().c_str());
}
TEST(ParserTest, FormatUrlForSecurityDisplay) {
CefString result;
const char* kLang = "en-US";
// Omits the protocol if it's standard.
result = CefFormatUrlForSecurityDisplay("http://tests.com/foo.html", kLang);
EXPECT_STREQ("http://tests.com", result.ToString().c_str());
// Omits the port if it's the expected value for the protocol.
result = CefFormatUrlForSecurityDisplay("http://tests.com:80/foo.html",
kLang);
EXPECT_STREQ("http://tests.com", result.ToString().c_str());
// Don't omit non-standard ports.
result = CefFormatUrlForSecurityDisplay("http://tests.com:8088/foo.html",
kLang);
EXPECT_STREQ("http://tests.com:8088", result.ToString().c_str());
// Don't omit the protocol for file URLs.
result = CefFormatUrlForSecurityDisplay("file:///c/tests/foo.html", kLang);
EXPECT_STREQ("file:///c/tests/foo.html", result.ToString().c_str());
// Empty |languages| should be OK.
result = CefFormatUrlForSecurityDisplay("http://tests.com/foo.html",
CefString());
EXPECT_STREQ("http://tests.com", result.ToString().c_str());
}
TEST(ParserTest, GetMimeType) {
CefString mime_type;

View File

@ -51,11 +51,7 @@ const char kPdfHtmlUrl[] = "http://tests/pdf.html";
const char kPdfDirectUrl[] = "http://tests/pdf.pdf";
// Delay waiting for iframe tests to load the PDF file.
#if defined(OS_WIN) || defined(OS_MACOSX)
const int64 kPdfLoadDelayMs = 2000;
#else
const int64 kPdfLoadDelayMs = 5000;
#endif
// Browser-side test handler.
class PluginTestHandler : public RoutingTestHandler,

View File

@ -557,10 +557,8 @@ class ResourceResponseTest : public TestHandler {
// This method is only called for the main resource.
EXPECT_STREQ(kResourceTestHtml, request->GetURL().ToString().c_str());
// All loads of the main resource should keep the same request id.
EXPECT_EQ(0U, main_request_id_);
main_request_id_ = request->GetIdentifier();
EXPECT_GT(main_request_id_, 0U);
// Browser-side navigation no longer exposes the actual request information.
EXPECT_EQ(0U, request->GetIdentifier());
return false;
}
@ -574,7 +572,10 @@ class ResourceResponseTest : public TestHandler {
EXPECT_EQ(browser_id_, browser->GetIdentifier());
if (request->GetURL() == kResourceTestHtml) {
EXPECT_EQ(main_request_id_, request->GetIdentifier());
// All loads of the main resource should keep the same request id.
EXPECT_EQ(0U, main_request_id_);
main_request_id_ = request->GetIdentifier();
EXPECT_GT(main_request_id_, 0U);
return RV_CONTINUE;
}

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