From 8078afe7bffa1063b5a40f9607c782dc21a63126 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 5 Feb 2014 20:35:45 +0000 Subject: [PATCH] Update to Chromium revision 248478. - Add new CefSettings.windowless_rendering_enabled value that must be enabled when using windowless (off-screen) rendering. - Improve naming and documentation for CefWindowInfo members. - CefBeginTracing now completes asynchronously. - Rename CefEndTracingAsync to CefEndTracing. - Rename CefCompletionHandler to CefCompletionCallback. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1592 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- cef.gyp | 6 +- cef_create_projects.bat | 2 +- cef_paths.gypi | 8 +- include/capi/cef_callback_capi.h | 6 +- include/capi/cef_cookie_capi.h | 4 +- include/capi/cef_trace_capi.h | 12 +- include/cef_callback.h | 2 +- include/cef_cookie.h | 4 +- include/cef_trace.h | 14 +- include/internal/cef_linux.h | 34 +- include/internal/cef_mac.h | 38 +- include/internal/cef_types.h | 10 +- include/internal/cef_types_linux.h | 32 +- include/internal/cef_types_mac.h | 34 +- include/internal/cef_types_win.h | 32 +- include/internal/cef_types_wrappers.h | 1 + include/internal/cef_win.h | 41 +- libcef/browser/browser_context_impl.cc | 13 + libcef/browser/browser_context_impl.h | 9 + libcef/browser/browser_context_proxy.cc | 13 + libcef/browser/browser_context_proxy.h | 9 + libcef/browser/browser_host_impl.cc | 19 +- libcef/browser/browser_host_impl.h | 5 +- libcef/browser/browser_host_impl_gtk.cc | 4 +- libcef/browser/browser_host_impl_mac.mm | 10 +- libcef/browser/browser_host_impl_win.cc | 8 +- libcef/browser/browser_main.cc | 2 +- libcef/browser/chrome_browser_process_stub.cc | 7 +- libcef/browser/chrome_browser_process_stub.h | 6 +- libcef/browser/cookie_manager_impl.cc | 25 +- libcef/browser/cookie_manager_impl.h | 2 +- .../media_capture_devices_dispatcher.cc | 409 +++++++++--------- .../media_capture_devices_dispatcher.h | 235 +++++----- libcef/browser/menu_creator.cc | 17 +- libcef/browser/menu_creator.h | 12 +- libcef/browser/navigate_params.h | 3 +- libcef/browser/render_widget_host_view_osr.cc | 3 +- libcef/browser/render_widget_host_view_osr.h | 3 +- libcef/browser/scheme_handler.cc | 2 +- libcef/browser/scheme_impl.cc | 2 +- libcef/browser/trace_impl.cc | 11 +- libcef/browser/trace_subscriber.cc | 13 +- libcef/browser/trace_subscriber.h | 7 +- libcef/browser/url_request_context_getter.cc | 2 +- libcef/common/cef_messages.h | 3 +- libcef/common/main_delegate.cc | 7 + libcef/common/request_impl.cc | 2 +- libcef/common/scheme_registration.cc | 4 +- libcef/common/upload_data.cc | 37 ++ libcef/common/upload_data.h | 83 ++++ libcef/renderer/browser_impl.cc | 1 - libcef/renderer/content_renderer_client.cc | 2 +- libcef/renderer/content_renderer_client.h | 2 +- libcef/renderer/dom_node_impl.cc | 6 - libcef/renderer/v8_impl.cc | 4 +- libcef/renderer/v8_impl.h | 4 +- libcef/resources/cef_strings.grd | 2 +- ...pptoc.cc => completion_callback_cpptoc.cc} | 22 +- ..._cpptoc.h => completion_callback_cpptoc.h} | 16 +- libcef_dll/cpptoc/cookie_manager_cpptoc.cc | 11 +- ...tocpp.cc => completion_callback_ctocpp.cc} | 8 +- ..._ctocpp.h => completion_callback_ctocpp.h} | 22 +- libcef_dll/ctocpp/cookie_manager_ctocpp.cc | 11 +- libcef_dll/ctocpp/cookie_manager_ctocpp.h | 2 +- libcef_dll/libcef_dll.cc | 18 +- libcef_dll/wrapper/libcef_dll_wrapper.cc | 18 +- patch/patch.cfg | 25 +- patch/patches/build.patch | 24 +- patch/patches/content_nav_1129.patch | 26 +- patch/patches/message_loop_443.patch | 4 +- patch/patches/native_theme_180.patch | 34 -- patch/patches/renderer_host_1161.patch | 52 +-- patch/patches/spi_webcore_364.patch | 18 +- patch/patches/tracing_1157.patch | 332 -------------- patch/patches/underlay_1051.patch | 4 +- patch/patches/views_widget_180.patch | 12 +- patch/patches/web_contents_304341.patch | 92 ++++ patch/patches/webkit_933.patch | 4 +- patch/patches/webkit_popups.patch | 18 +- tests/cefclient/cefclient.cpp | 3 + tests/cefclient/cefclient_gtk.cpp | 3 +- tests/cefclient/cefclient_mac.mm | 3 +- tests/cefclient/cefclient_win.cpp | 3 +- tests/cefclient/client_handler.cpp | 6 +- tests/unittests/cookie_unittest.cc | 10 +- tests/unittests/os_rendering_unittest.cc | 13 +- tests/unittests/test_handler.h | 1 + tests/unittests/test_suite.cc | 3 + tests/unittests/tracing_unittest.cc | 18 +- tools/check_style.bat | 2 +- tools/distrib/cefclient.gyp | 2 + tools/distrib/linux/README.redistrib.txt | 3 + tools/distrib/mac/README.redistrib.txt | 4 + tools/distrib/win/README.redistrib.txt | 2 +- tools/make_distrib.bat | 2 +- tools/make_distrib.py | 16 +- tools/make_version_header.bat | 2 +- tools/patch.bat | 2 +- tools/translator.bat | 2 +- 100 files changed, 1115 insertions(+), 1048 deletions(-) create mode 100644 libcef/common/upload_data.cc create mode 100644 libcef/common/upload_data.h rename libcef_dll/cpptoc/{completion_handler_cpptoc.cc => completion_callback_cpptoc.cc} (56%) rename libcef_dll/cpptoc/{completion_handler_cpptoc.h => completion_callback_cpptoc.h} (67%) rename libcef_dll/ctocpp/{completion_handler_ctocpp.cc => completion_callback_ctocpp.cc} (76%) rename libcef_dll/ctocpp/{completion_handler_ctocpp.h => completion_callback_ctocpp.h} (61%) delete mode 100644 patch/patches/native_theme_180.patch delete mode 100644 patch/patches/tracing_1157.patch create mode 100644 patch/patches/web_contents_304341.patch diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index ea850607a..fff9fef2e 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -17,5 +17,5 @@ { 'chromium_url': 'http://src.chromium.org/svn/trunk/src', - 'chromium_revision': '242756', + 'chromium_revision': '248478', } diff --git a/cef.gyp b/cef.gyp index 17f571775..7ff854dd2 100644 --- a/cef.gyp +++ b/cef.gyp @@ -868,7 +868,6 @@ '<(DEPTH)/ui/gl/gl.gyp:gl', '<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/v8/tools/gyp/v8.gyp:v8', - '<(DEPTH)/webkit/glue/webkit_glue.gyp:glue', '<(DEPTH)/webkit/storage_browser.gyp:webkit_storage_browser', '<(DEPTH)/webkit/storage_common.gyp:webkit_storage_common', # Necessary to generate the grit include files. @@ -1037,6 +1036,8 @@ 'libcef/common/value_base.h', 'libcef/common/values_impl.cc', 'libcef/common/values_impl.h', + 'libcef/common/upload_data.cc', + 'libcef/common/upload_data.h', 'libcef/renderer/browser_impl.cc', 'libcef/renderer/browser_impl.h', 'libcef/renderer/content_renderer_client.cc', @@ -1279,6 +1280,7 @@ 'mac_bundle_resources': [ '<(PRODUCT_DIR)/cef.pak', '<(PRODUCT_DIR)/devtools_resources.pak', + '<(PRODUCT_DIR)/icudtl.dat', 'libcef/resources/framework-Info.plist', ], 'mac_bundle_resources!': [ @@ -1635,7 +1637,7 @@ '<@(includes_win)', # TODO(cef): Remove ui_unscaled_resources.rc once custom cursor # resources can be loaded via ResourceBundle. See crbug.com/147663. - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/blink_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_unscaled_resources.rc', 'libcef_dll/libcef_dll.rc', ], diff --git a/cef_create_projects.bat b/cef_create_projects.bat index 9392c34f8..8dc778456 100644 --- a/cef_create_projects.bat +++ b/cef_create_projects.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_26\python.exe tools\gclient_hook.py +python.bat tools\gclient_hook.py diff --git a/cef_paths.gypi b/cef_paths.gypi index 6ec2b0a51..e322ce383 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -138,8 +138,8 @@ 'libcef_dll/ctocpp/client_ctocpp.h', 'libcef_dll/cpptoc/command_line_cpptoc.cc', 'libcef_dll/cpptoc/command_line_cpptoc.h', - 'libcef_dll/ctocpp/completion_handler_ctocpp.cc', - 'libcef_dll/ctocpp/completion_handler_ctocpp.h', + 'libcef_dll/ctocpp/completion_callback_ctocpp.cc', + 'libcef_dll/ctocpp/completion_callback_ctocpp.h', 'libcef_dll/ctocpp/context_menu_handler_ctocpp.cc', 'libcef_dll/ctocpp/context_menu_handler_ctocpp.h', 'libcef_dll/cpptoc/context_menu_params_cpptoc.cc', @@ -300,8 +300,8 @@ 'libcef_dll/cpptoc/client_cpptoc.h', 'libcef_dll/ctocpp/command_line_ctocpp.cc', 'libcef_dll/ctocpp/command_line_ctocpp.h', - 'libcef_dll/cpptoc/completion_handler_cpptoc.cc', - 'libcef_dll/cpptoc/completion_handler_cpptoc.h', + 'libcef_dll/cpptoc/completion_callback_cpptoc.cc', + 'libcef_dll/cpptoc/completion_callback_cpptoc.h', 'libcef_dll/cpptoc/context_menu_handler_cpptoc.cc', 'libcef_dll/cpptoc/context_menu_handler_cpptoc.h', 'libcef_dll/ctocpp/context_menu_params_ctocpp.cc', diff --git a/include/capi/cef_callback_capi.h b/include/capi/cef_callback_capi.h index 7a0ed06ca..d071099fd 100644 --- a/include/capi/cef_callback_capi.h +++ b/include/capi/cef_callback_capi.h @@ -69,7 +69,7 @@ typedef struct _cef_callback_t { /// // Generic callback structure used for asynchronous completion. /// -typedef struct _cef_completion_handler_t { +typedef struct _cef_completion_callback_t { /// // Base structure. /// @@ -78,8 +78,8 @@ typedef struct _cef_completion_handler_t { /// // Method that will be called once the task is complete. /// - void (CEF_CALLBACK *on_complete)(struct _cef_completion_handler_t* self); -} cef_completion_handler_t; + void (CEF_CALLBACK *on_complete)(struct _cef_completion_callback_t* self); +} cef_completion_callback_t; #ifdef __cplusplus diff --git a/include/capi/cef_cookie_capi.h b/include/capi/cef_cookie_capi.h index 2031a77bb..39caac0ff 100644 --- a/include/capi/cef_cookie_capi.h +++ b/include/capi/cef_cookie_capi.h @@ -120,11 +120,11 @@ typedef struct _cef_cookie_manager_t { /// // Flush the backing store (if any) to disk and execute the specified - // |handler| on the IO thread when done. Returns false (0) if cookies cannot + // |callback| on the IO thread when done. Returns false (0) if cookies cannot // be accessed. /// int (CEF_CALLBACK *flush_store)(struct _cef_cookie_manager_t* self, - struct _cef_completion_handler_t* handler); + struct _cef_completion_callback_t* callback); } cef_cookie_manager_t; diff --git a/include/capi/cef_trace_capi.h b/include/capi/cef_trace_capi.h index 0ac4898a3..4d9f458f2 100644 --- a/include/capi/cef_trace_capi.h +++ b/include/capi/cef_trace_capi.h @@ -43,6 +43,7 @@ extern "C" { #endif #include "include/capi/cef_base_capi.h" +#include "include/capi/cef_callback_capi.h" /// @@ -68,9 +69,9 @@ typedef struct _cef_end_tracing_callback_t { /// -// Start tracing events on all processes. Tracing begins immediately locally, -// and asynchronously on child processes as soon as they receive the -// BeginTracing request. +// Start tracing events on all processes. Tracing is initialized asynchronously +// and |callback| will be executed on the UI thread after initialization is +// complete. // // If CefBeginTracing was called previously, or if a CefEndTracingAsync call is // pending, CefBeginTracing will fail and return false (0). @@ -84,7 +85,8 @@ typedef struct _cef_end_tracing_callback_t { // // This function must be called on the browser process UI thread. /// -CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories); +CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories, + struct _cef_completion_callback_t* callback); /// // Stop tracing events on all processes. @@ -99,7 +101,7 @@ CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories); // // This function must be called on the browser process UI thread. /// -CEF_EXPORT int cef_end_tracing_async(const cef_string_t* tracing_file, +CEF_EXPORT int cef_end_tracing(const cef_string_t* tracing_file, cef_end_tracing_callback_t* callback); /// diff --git a/include/cef_callback.h b/include/cef_callback.h index 9b4e5321e..e5efebd2d 100644 --- a/include/cef_callback.h +++ b/include/cef_callback.h @@ -63,7 +63,7 @@ class CefCallback : public virtual CefBase { // Generic callback interface used for asynchronous completion. /// /*--cef(source=client)--*/ -class CefCompletionHandler : public virtual CefBase { +class CefCompletionCallback : public virtual CefBase { public: /// // Method that will be called once the task is complete. diff --git a/include/cef_cookie.h b/include/cef_cookie.h index 807279b72..73506dc46 100644 --- a/include/cef_cookie.h +++ b/include/cef_cookie.h @@ -136,11 +136,11 @@ class CefCookieManager : public virtual CefBase { /// // Flush the backing store (if any) to disk and execute the specified - // |handler| on the IO thread when done. Returns false if cookies cannot be + // |callback| on the IO thread when done. Returns false if cookies cannot be // accessed. /// /*--cef(optional_param=handler)--*/ - virtual bool FlushStore(CefRefPtr handler) =0; + virtual bool FlushStore(CefRefPtr callback) =0; }; diff --git a/include/cef_trace.h b/include/cef_trace.h index d40e46c78..ebcb6a4dc 100644 --- a/include/cef_trace.h +++ b/include/cef_trace.h @@ -42,6 +42,7 @@ #pragma once #include "include/cef_base.h" +#include "include/cef_callback.h" /// // Implement this interface to receive notification when tracing has completed. @@ -61,9 +62,9 @@ class CefEndTracingCallback : public virtual CefBase { /// -// Start tracing events on all processes. Tracing begins immediately locally, -// and asynchronously on child processes as soon as they receive the -// BeginTracing request. +// Start tracing events on all processes. Tracing is initialized asynchronously +// and |callback| will be executed on the UI thread after initialization is +// complete. // // If CefBeginTracing was called previously, or if a CefEndTracingAsync call is // pending, CefBeginTracing will fail and return false. @@ -79,7 +80,8 @@ class CefEndTracingCallback : public virtual CefBase { // This function must be called on the browser process UI thread. /// /*--cef(optional_param=categories)--*/ -bool CefBeginTracing(const CefString& categories); +bool CefBeginTracing(const CefString& categories, + CefRefPtr callback); /// // Stop tracing events on all processes. @@ -95,8 +97,8 @@ bool CefBeginTracing(const CefString& categories); // This function must be called on the browser process UI thread. /// /*--cef(optional_param=tracing_file,optional_param=callback)--*/ -bool CefEndTracingAsync(const CefString& tracing_file, - CefRefPtr callback); +bool CefEndTracing(const CefString& tracing_file, + CefRefPtr callback); /// // Returns the current system trace time or, if none is defined, the current diff --git a/include/internal/cef_linux.h b/include/internal/cef_linux.h index ddf15ce56..fba5a678f 100644 --- a/include/internal/cef_linux.h +++ b/include/internal/cef_linux.h @@ -110,8 +110,8 @@ struct CefWindowInfoTraits { static inline void set(const struct_type* src, struct_type* target, bool copy) { target->parent_widget = src->parent_widget; - target->window_rendering_disabled = src->window_rendering_disabled; - target->transparent_painting = src->transparent_painting; + target->windowless_rendering_enabled = src->windowless_rendering_enabled; + target->transparent_painting_enabled = src->transparent_painting_enabled; target->widget = src->widget; } }; @@ -125,17 +125,29 @@ class CefWindowInfo : public CefStructBase { explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} - void SetAsChild(CefWindowHandle ParentWidget) { - parent_widget = ParentWidget; + /// + // Create the browser as a child widget. + /// + void SetAsChild(CefWindowHandle parent) { + parent_widget = parent; } - void SetTransparentPainting(bool transparentPainting) { - transparent_painting = transparentPainting; - } - - void SetAsOffScreen(CefWindowHandle ParentWidget) { - window_rendering_disabled = true; - parent_widget = ParentWidget; + /// + // Create the browser using windowless (off-screen) rendering. No widget + // will be created for the browser and all rendering will occur via the + // CefRenderHandler interface. The |parent| value will be used to identify + // monitor info and to act as the parent widget for dialogs, context menus, + // etc. If |parent| is not provided then the main screen monitor will be used + // and some functionality that requires a parent widget may not function + // correctly. If |transparent| is true a transparent background color will be + // used (RGBA=0x00000000). If |transparent| is false the background will be + // white and opaque. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + void SetAsWindowless(CefWindowHandle parent, bool transparent) { + windowless_rendering_enabled = true; + parent_widget = parent; + transparent_painting_enabled = transparent; } }; diff --git a/include/internal/cef_mac.h b/include/internal/cef_mac.h index 352a5c2b5..2e4bcbc07 100644 --- a/include/internal/cef_mac.h +++ b/include/internal/cef_mac.h @@ -112,8 +112,6 @@ struct CefWindowInfoTraits { static inline void set(const struct_type* src, struct_type* target, bool copy) { - target->view = src->view; - target->parent_view = src->parent_view; cef_string_set(src->window_name.str, src->window_name.length, &target->window_name, copy); target->x = src->x; @@ -121,8 +119,10 @@ struct CefWindowInfoTraits { target->width = src->width; target->height = src->height; target->hidden = src->hidden; - target->transparent_painting = src->transparent_painting; - target->window_rendering_disabled = src->window_rendering_disabled; + target->parent_view = src->parent_view; + target->windowless_rendering_enabled = src->windowless_rendering_enabled; + target->transparent_painting_enabled = src->transparent_painting_enabled; + target->view = src->view; } }; @@ -135,9 +135,12 @@ class CefWindowInfo : public CefStructBase { explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} - void SetAsChild(CefWindowHandle ParentView, int x, int y, int width, + /// + // Create the browser as a child view. + /// + void SetAsChild(CefWindowHandle parent, int x, int y, int width, int height) { - parent_view = ParentView; + parent_view = parent; this->x = x; this->y = y; this->width = width; @@ -145,13 +148,22 @@ class CefWindowInfo : public CefStructBase { hidden = false; } - void SetTransparentPainting(bool transparentPainting) { - transparent_painting = transparentPainting; - } - - void SetAsOffScreen(NSView* view) { - window_rendering_disabled = true; - parent_view = view; + /// + // Create the browser using windowless (off-screen) rendering. No view + // will be created for the browser and all rendering will occur via the + // CefRenderHandler interface. The |parent| value will be used to identify + // monitor info and to act as the parent view for dialogs, context menus, + // etc. If |parent| is not provided then the main screen monitor will be used + // and some functionality that requires a parent view may not function + // correctly. If |transparent| is true a transparent background color will be + // used (RGBA=0x00000000). If |transparent| is false the background will be + // white and opaque. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + void SetAsWindowless(CefWindowHandle parent, bool transparent) { + windowless_rendering_enabled = true; + parent_view = parent; + transparent_painting_enabled = transparent; } }; diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index cf8eb39ac..2d4c90f25 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -223,6 +223,13 @@ typedef struct _cef_settings_t { /// int multi_threaded_message_loop; + /// + // Set to true to enable windowless (off-screen) rendering support. Do not + // enable this value if the application does not use windowless rendering as + // it may reduce rendering performance on some systems. + /// + bool windowless_rendering_enabled; + /// // Set to true (1) to disable configuration of browser process features using // standard CEF and Chromium command-line arguments. Configuration can still @@ -1650,14 +1657,11 @@ typedef enum { DOM_NODE_TYPE_ATTRIBUTE, DOM_NODE_TYPE_TEXT, DOM_NODE_TYPE_CDATA_SECTION, - DOM_NODE_TYPE_ENTITY, DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS, DOM_NODE_TYPE_COMMENT, DOM_NODE_TYPE_DOCUMENT, DOM_NODE_TYPE_DOCUMENT_TYPE, DOM_NODE_TYPE_DOCUMENT_FRAGMENT, - DOM_NODE_TYPE_NOTATION, - DOM_NODE_TYPE_XPATH_NAMESPACE, } cef_dom_node_type_t; /// diff --git a/include/internal/cef_types_linux.h b/include/internal/cef_types_linux.h index 24d299bb5..cac156906 100644 --- a/include/internal/cef_types_linux.h +++ b/include/internal/cef_types_linux.h @@ -60,18 +60,34 @@ typedef struct _cef_main_args_t { // Class representing window information. /// typedef struct _cef_window_info_t { - // Pointer for the parent GtkBox widget. + /// + // Pointer for the parent widget. + /// cef_window_handle_t parent_widget; - // If window rendering is disabled no browser window will be created. Set - // |parent_widget| to the window that will act as the parent for popup menus, - // dialog boxes, etc. - int window_rendering_disabled; + /// + // Set to true (1) to create the browser using windowless (off-screen) + // rendering. No widget will be created for the browser and all rendering will + // occur via the CefRenderHandler interface. The |parent_widget| value will be + // used to identify monitor info and to act as the parent widget for dialogs, + // context menus, etc. If |parent_widget| is not provided then the main screen + // monitor will be used and some functionality that requires a parent widget + // may not function correctly. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + int windowless_rendering_enabled; - // Set to true to enable transparent painting. - int transparent_painting; + /// + // Set to true (1) to enable transparent painting in combination with + // windowless rendering. When this value is true a transparent background + // color will be used (RGBA=0x00000000). When this value is false the + // background will be white and opaque. + /// + int transparent_painting_enabled; - // Pointer for the new browser widget. + /// + // Pointer for the new browser widget. Only used with windowed rendering. + /// cef_window_handle_t widget; } cef_window_info_t; diff --git a/include/internal/cef_types_mac.h b/include/internal/cef_types_mac.h index 5a973d3be..8d66705b8 100644 --- a/include/internal/cef_types_mac.h +++ b/include/internal/cef_types_mac.h @@ -82,20 +82,40 @@ typedef struct _cef_window_info_t { int y; int width; int height; + + /// + // Set to true (1) to create the view initially hidden. + /// int hidden; + /// // NSView pointer for the parent view. + /// cef_window_handle_t parent_view; - // If window rendering is disabled no browser window will be created. Set - // |parent_view| to the window that will act as the parent for popup menus, - // dialog boxes, etc. - int window_rendering_disabled; + /// + // Set to true (1) to create the browser using windowless (off-screen) + // rendering. No view will be created for the browser and all rendering will + // occur via the CefRenderHandler interface. The |parent_view| value will be + // used to identify monitor info and to act as the parent view for dialogs, + // context menus, etc. If |parent_view| is not provided then the main screen + // monitor will be used and some functionality that requires a parent view + // may not function correctly. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + int windowless_rendering_enabled; - // Set to true to enable transparent painting. - int transparent_painting; + /// + // Set to true (1) to enable transparent painting in combination with + // windowless rendering. When this value is true a transparent background + // color will be used (RGBA=0x00000000). When this value is false the + // background will be white and opaque. + /// + int transparent_painting_enabled; - // NSView pointer for the new browser view. + /// + // NSView pointer for the new browser view. Only used with windowed rendering. + /// cef_window_handle_t view; } cef_window_info_t; diff --git a/include/internal/cef_types_win.h b/include/internal/cef_types_win.h index 8c4693cd6..e3d53c5bb 100644 --- a/include/internal/cef_types_win.h +++ b/include/internal/cef_types_win.h @@ -70,19 +70,29 @@ typedef struct _cef_window_info_t { cef_window_handle_t parent_window; HMENU menu; - // If window rendering is disabled no browser window will be created. Set - // |parent_window| to be used for identifying monitor info - // (MonitorFromWindow). If |parent_window| is not provided the main screen - // monitor will be used. - BOOL window_rendering_disabled; + /// + // Set to true (1) to create the browser using windowless (off-screen) + // rendering. No window will be created for the browser and all rendering will + // occur via the CefRenderHandler interface. The |parent_window| value will be + // used to identify monitor info and to act as the parent window for dialogs, + // context menus, etc. If |parent_window| is not provided then the main screen + // monitor will be used and some functionality that requires a parent window + // may not function correctly. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + int windowless_rendering_enabled; - // Set to true to enable transparent painting. - // If window rendering is disabled and |transparent_painting| is set to true - // WebKit rendering will draw on a transparent background (RGBA=0x00000000). - // When this value is false the background will be white and opaque. - BOOL transparent_painting; + /// + // Set to true (1) to enable transparent painting in combination with + // windowless rendering. When this value is true a transparent background + // color will be used (RGBA=0x00000000). When this value is false the + // background will be white and opaque. + /// + int transparent_painting_enabled; - // Handle for the new browser window. + /// + // Handle for the new browser window. Only used with windowed rendering. + /// cef_window_handle_t window; } cef_window_info_t; diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 5aa689d6a..ef259c3e8 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -349,6 +349,7 @@ struct CefSettingsTraits { src->browser_subprocess_path.length, &target->browser_subprocess_path, copy); target->multi_threaded_message_loop = src->multi_threaded_message_loop; + target->windowless_rendering_enabled = src->windowless_rendering_enabled; target->command_line_args_disabled = src->command_line_args_disabled; cef_string_set(src->cache_path.str, src->cache_path.length, diff --git a/include/internal/cef_win.h b/include/internal/cef_win.h index 29e26c456..4346f2b64 100644 --- a/include/internal/cef_win.h +++ b/include/internal/cef_win.h @@ -119,9 +119,9 @@ struct CefWindowInfoTraits { target->height = src->height; target->parent_window = src->parent_window; target->menu = src->menu; + target->transparent_painting_enabled = src->transparent_painting_enabled; + target->windowless_rendering_enabled = src->windowless_rendering_enabled; target->window = src->window; - target->transparent_painting = src->transparent_painting; - target->window_rendering_disabled = src->window_rendering_disabled; } }; @@ -136,20 +136,26 @@ class CefWindowInfo : public CefStructBase { explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} - void SetAsChild(HWND hWndParent, RECT windowRect) { + /// + // Create the browser as a child window. + /// + void SetAsChild(CefWindowHandle parent, RECT windowRect) { style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_TABSTOP | WS_VISIBLE; - parent_window = hWndParent; + parent_window = parent; x = windowRect.left; y = windowRect.top; width = windowRect.right - windowRect.left; height = windowRect.bottom - windowRect.top; } - void SetAsPopup(HWND hWndParent, const CefString& windowName) { + /// + // Create the browser as a popup window. + /// + void SetAsPopup(CefWindowHandle parent, const CefString& windowName) { style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE; - parent_window = hWndParent; + parent_window = parent; x = CW_USEDEFAULT; y = CW_USEDEFAULT; width = CW_USEDEFAULT; @@ -158,13 +164,22 @@ class CefWindowInfo : public CefStructBase { cef_string_copy(windowName.c_str(), windowName.length(), &window_name); } - void SetTransparentPainting(BOOL transparentPainting) { - transparent_painting = transparentPainting; - } - - void SetAsOffScreen(HWND hWndParent) { - window_rendering_disabled = TRUE; - parent_window = hWndParent; + /// + // Create the browser using windowless (off-screen) rendering. No window + // will be created for the browser and all rendering will occur via the + // CefRenderHandler interface. The |parent| value will be used to identify + // monitor info and to act as the parent window for dialogs, context menus, + // etc. If |parent| is not provided then the main screen monitor will be used + // and some functionality that requires a parent window may not function + // correctly. If |transparent| is true a transparent background color will be + // used (RGBA=0x00000000). If |transparent| is false the background will be + // white and opaque. In order to create windowless browsers the + // CefSettings.windowless_rendering_enabled value must be set to true. + /// + void SetAsWindowless(CefWindowHandle parent, bool transparent) { + windowless_rendering_enabled = TRUE; + parent_window = parent; + transparent_painting_enabled = transparent; } }; diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index 1820fb522..8b9bc4584 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -267,6 +267,19 @@ void CefBrowserContextImpl::CancelMIDISysExPermissionRequest( const GURL& requesting_frame) { } +void CefBrowserContextImpl::RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) { +} + +void CefBrowserContextImpl::CancelProtectedMediaIdentifierPermissionRequests( + int group_id) { +} + content::ResourceContext* CefBrowserContextImpl::GetResourceContext() { return resource_context_.get(); } diff --git a/libcef/browser/browser_context_impl.h b/libcef/browser/browser_context_impl.h index e03592baf..4b0a41902 100644 --- a/libcef/browser/browser_context_impl.h +++ b/libcef/browser/browser_context_impl.h @@ -50,6 +50,15 @@ class CefBrowserContextImpl : public CefBrowserContext { int render_view_id, int bridge_id, const GURL& requesting_frame) OVERRIDE; + virtual void RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; + virtual void CancelProtectedMediaIdentifierPermissionRequests( + int group_id) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/libcef/browser/browser_context_proxy.cc b/libcef/browser/browser_context_proxy.cc index 2c9df8942..d5ff85891 100644 --- a/libcef/browser/browser_context_proxy.cc +++ b/libcef/browser/browser_context_proxy.cc @@ -129,6 +129,19 @@ void CefBrowserContextProxy::CancelMIDISysExPermissionRequest( const GURL& requesting_frame) { } +void CefBrowserContextProxy::RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) { +} + +void CefBrowserContextProxy::CancelProtectedMediaIdentifierPermissionRequests( + int group_id) { +} + content::ResourceContext* CefBrowserContextProxy::GetResourceContext() { return resource_context_.get(); } diff --git a/libcef/browser/browser_context_proxy.h b/libcef/browser/browser_context_proxy.h index 7887b52eb..fd889792e 100644 --- a/libcef/browser/browser_context_proxy.h +++ b/libcef/browser/browser_context_proxy.h @@ -58,6 +58,15 @@ class CefBrowserContextProxy : public CefBrowserContext { int render_view_id, int bridge_id, const GURL& requesting_frame) OVERRIDE; + virtual void RequestProtectedMediaIdentifierPermission( + int render_process_id, + int render_view_id, + int bridge_id, + int group_id, + const GURL& requesting_frame, + const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE; + virtual void CancelProtectedMediaIdentifierPermissionRequests( + int group_id) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 401dd3aa7..4bcbf16dd 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -290,6 +290,10 @@ bool CefBrowserHost::CreateBrowser( // Verify that render handler is in place for a windowless browser. if (CefBrowserHostImpl::IsWindowRenderingDisabled(windowInfo)) { + if (!CefContext::Get()->settings().windowless_rendering_enabled) { + NOTREACHED() << "Windowless rendering must be enabled"; + return false; + } if (!client->GetRenderHandler().get()) { NOTREACHED() << "CefRenderHandler implementation is required"; return false; @@ -358,6 +362,10 @@ CefRefPtr CefBrowserHostImpl::Create( // Verify that render handler is in place for a windowless browser. if (CefBrowserHostImpl::IsWindowRenderingDisabled(windowInfo)) { + if (!CefContext::Get()->settings().windowless_rendering_enabled) { + NOTREACHED() << "Windowless rendering must be enabled"; + return NULL; + } if (!client->GetRenderHandler().get()) { NOTREACHED() << "CefRenderHandler implementation is required"; return NULL; @@ -715,8 +723,8 @@ double CefBrowserHostImpl::GetZoomLevel() { void CefBrowserHostImpl::SetZoomLevel(double zoomLevel) { if (CEF_CURRENTLY_ON_UIT()) { - if (web_contents_.get() && web_contents_->GetRenderViewHost()) - web_contents_->GetRenderViewHost()->SetZoomLevel(zoomLevel); + if (web_contents_.get()) + web_contents_->SetZoomLevel(zoomLevel); } else { CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SetZoomLevel, this, zoomLevel)); @@ -812,7 +820,7 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText, options.forward = forward; options.matchCase = matchCase; options.findNext = findNext; - web_contents()->GetRenderViewHost()->Find(identifier, searchText, options); + web_contents()->Find(identifier, searchText, options); } else { CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Find, this, identifier, searchText, @@ -828,7 +836,7 @@ void CefBrowserHostImpl::StopFinding(bool clearSelection) { content::StopFindAction action = clearSelection ? content::STOP_FIND_ACTION_CLEAR_SELECTION : content::STOP_FIND_ACTION_KEEP_SELECTION; - web_contents()->GetRenderViewHost()->StopFinding(action); + web_contents()->StopFinding(action); } else { CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopFinding, this, clearSelection)); @@ -1846,9 +1854,10 @@ void CefBrowserHostImpl::WebContentsFocused(content::WebContents* contents) { } bool CefBrowserHostImpl::HandleContextMenu( + content::RenderFrameHost* render_frame_host, const content::ContextMenuParams& params) { if (!menu_creator_.get()) - menu_creator_.reset(new CefMenuCreator(this)); + menu_creator_.reset(new CefMenuCreator(this, render_frame_host)); return menu_creator_->CreateContextMenu(params); } diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 3b1091c47..82f210d1b 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -330,8 +330,9 @@ class CefBrowserHostImpl : public CefBrowserHost, virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; - virtual bool HandleContextMenu(const content::ContextMenuParams& params) - OVERRIDE; + virtual bool HandleContextMenu( + content::RenderFrameHost* render_frame_host, + const content::ContextMenuParams& params) OVERRIDE; virtual bool PreHandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event, diff --git a/libcef/browser/browser_host_impl_gtk.cc b/libcef/browser/browser_host_impl_gtk.cc index 676ac0e25..3f381da68 100644 --- a/libcef/browser/browser_host_impl_gtk.cc +++ b/libcef/browser/browser_host_impl_gtk.cc @@ -385,11 +385,11 @@ void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) { // static bool CefBrowserHostImpl::IsWindowRenderingDisabled(const CefWindowInfo& info) { - return info.window_rendering_disabled ? true : false; + return info.windowless_rendering_enabled ? true : false; } bool CefBrowserHostImpl::IsTransparent() { - return window_info_.transparent_painting != 0; + return window_info_.transparent_painting_enabled ? true : false; } void CefBrowserHostImpl::PlatformTranslateKeyEvent( diff --git a/libcef/browser/browser_host_impl_mac.mm b/libcef/browser/browser_host_impl_mac.mm index ea93838f1..75a4dc1e9 100644 --- a/libcef/browser/browser_host_impl_mac.mm +++ b/libcef/browser/browser_host_impl_mac.mm @@ -436,7 +436,11 @@ void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) { // static bool CefBrowserHostImpl::IsWindowRenderingDisabled(const CefWindowInfo& info) { - return info.window_rendering_disabled ? true : false; + return info.windowless_rendering_enabled ? true : false; +} + +bool CefBrowserHostImpl::IsTransparent() { + return window_info_.transparent_painting_enabled ? true : false; } static NSTimeInterval currentEventTimestamp() { @@ -453,10 +457,6 @@ static NSTimeInterval currentEventTimestamp() { } } -bool CefBrowserHostImpl::IsTransparent() { - return window_info_.transparent_painting != 0; -} - static NSUInteger NativeModifiers(int cef_modifiers) { NSUInteger native_modifiers = 0; if (cef_modifiers & EVENTFLAG_SHIFT_DOWN) diff --git a/libcef/browser/browser_host_impl_win.cc b/libcef/browser/browser_host_impl_win.cc index f386fdf92..0e8c170c7 100644 --- a/libcef/browser/browser_host_impl_win.cc +++ b/libcef/browser/browser_host_impl_win.cc @@ -701,7 +701,7 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message, case WM_DWMCOMPOSITIONCHANGED: // Message sent to top-level windows when composition has been enabled or // disabled. - if (browser && browser->window_info_.transparent_painting) + if (browser && browser->IsTransparent()) SetAeroGlass(hwnd); break; } @@ -739,7 +739,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() { if (!window_info_.window) return false; - if (window_info_.transparent_painting && + if (window_info_.transparent_painting_enabled && !(window_info_.style & WS_CHILD)) { // Transparent top-level windows will be given "sheet of glass" effect. SetAeroGlass(window_info_.window); @@ -885,11 +885,11 @@ void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) { // static bool CefBrowserHostImpl::IsWindowRenderingDisabled(const CefWindowInfo& info) { - return info.window_rendering_disabled ? true : false; + return info.windowless_rendering_enabled ? true : false; } bool CefBrowserHostImpl::IsTransparent() { - return window_info_.transparent_painting != 0; + return window_info_.transparent_painting_enabled ? true : false; } void CefBrowserHostImpl::PlatformTranslateKeyEvent( diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index 85b3da5b9..11c56621b 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -70,7 +70,7 @@ void CefBrowserMainParts::PostMainMessageLoopStart() { content::ContentWebUIControllerFactory::GetInstance()); #if defined(OS_LINUX) - printing::PrintingContextGtk::SetCreatePrintDialogFunction( + printing::PrintingContextLinux::SetCreatePrintDialogFunction( &PrintDialogGtk::CreatePrintDialog); #endif } diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index 73ce2b5e4..d7bfe0c97 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -225,7 +225,8 @@ prerender::PrerenderTracker* ChromeBrowserProcessStub::prerender_tracker() { return NULL; } -ComponentUpdateService* ChromeBrowserProcessStub::component_updater() { +component_updater::ComponentUpdateService* + ChromeBrowserProcessStub::component_updater() { NOTIMPLEMENTED(); return NULL; } @@ -235,8 +236,8 @@ CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() { return NULL; } -PnaclComponentInstaller* - ChromeBrowserProcessStub::pnacl_component_installer() { +component_updater::PnaclComponentInstaller* + ChromeBrowserProcessStub::pnacl_component_installer() { NOTIMPLEMENTED(); return NULL; } diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index c95aa9f9e..157ef5892 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -82,9 +82,11 @@ class ChromeBrowserProcessStub : public BrowserProcess { virtual ChromeNetLog* net_log() OVERRIDE; virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; - virtual ComponentUpdateService* component_updater() OVERRIDE; + virtual component_updater::ComponentUpdateService* + component_updater() OVERRIDE; virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; - virtual PnaclComponentInstaller* pnacl_component_installer() OVERRIDE; + virtual component_updater::PnaclComponentInstaller* + pnacl_component_installer() OVERRIDE; virtual BookmarkPromptController* bookmark_prompt_controller() OVERRIDE; virtual MediaFileSystemRegistry* media_file_system_registry() OVERRIDE; diff --git a/libcef/browser/cookie_manager_impl.cc b/libcef/browser/cookie_manager_impl.cc index d8139c853..443e5b795 100644 --- a/libcef/browser/cookie_manager_impl.cc +++ b/libcef/browser/cookie_manager_impl.cc @@ -81,9 +81,9 @@ bool GetCookieDomain(const GURL& url, result); } -void RunCompletionOnIOThread(CefRefPtr handler) { +void RunCompletionOnIOThread(CefRefPtr callback) { CEF_POST_TASK(CEF_IOT, - base::Bind(&CefCompletionHandler::OnComplete, handler.get())); + base::Bind(&CefCompletionCallback::OnComplete, callback.get())); } } // namespace @@ -300,7 +300,7 @@ bool CefCookieManagerImpl::SetStoragePath( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), persist_session_cookies, NULL, - scoped_ptr()); + NULL); } else { NOTREACHED() << "The cookie storage directory could not be created"; storage_path_.clear(); @@ -327,26 +327,27 @@ bool CefCookieManagerImpl::SetStoragePath( return true; } -bool CefCookieManagerImpl::FlushStore(CefRefPtr handler) { +bool CefCookieManagerImpl::FlushStore( + CefRefPtr callback) { if (CEF_CURRENTLY_ON_IOT()) { if (!cookie_monster_) { - if (handler.get()) - RunCompletionOnIOThread(handler); + if (callback.get()) + RunCompletionOnIOThread(callback); return true; } - base::Closure callback; - if (handler.get()) - callback = base::Bind(RunCompletionOnIOThread, handler); + base::Closure flush_callback; + if (callback.get()) + flush_callback = base::Bind(RunCompletionOnIOThread, callback); else - callback = base::Bind(&base::DoNothing); + flush_callback = base::Bind(&base::DoNothing); - cookie_monster_->FlushStore(callback); + cookie_monster_->FlushStore(flush_callback); } else { // Execute on the IO thread. CEF_POST_TASK(CEF_IOT, base::Bind(base::IgnoreResult(&CefCookieManagerImpl::FlushStore), - this, handler)); + this, callback)); } return true; diff --git a/libcef/browser/cookie_manager_impl.h b/libcef/browser/cookie_manager_impl.h index 8fc353b1b..9de25ed5d 100644 --- a/libcef/browser/cookie_manager_impl.h +++ b/libcef/browser/cookie_manager_impl.h @@ -31,7 +31,7 @@ class CefCookieManagerImpl : public CefCookieManager { const CefString& cookie_name) OVERRIDE; virtual bool SetStoragePath(const CefString& path, bool persist_session_cookies) OVERRIDE; - virtual bool FlushStore(CefRefPtr handler) OVERRIDE; + virtual bool FlushStore(CefRefPtr callback) OVERRIDE; net::CookieMonster* cookie_monster() { return cookie_monster_; } diff --git a/libcef/browser/media_capture_devices_dispatcher.cc b/libcef/browser/media_capture_devices_dispatcher.cc index 7f3ced996..a4b778280 100644 --- a/libcef/browser/media_capture_devices_dispatcher.cc +++ b/libcef/browser/media_capture_devices_dispatcher.cc @@ -1,215 +1,216 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/browser/media_capture_devices_dispatcher.h" - -#include "base/prefs/pref_registry_simple.h" -#include "base/prefs/pref_service.h" -#include "chrome/common/pref_names.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/media_devices_monitor.h" -#include "content/public/common/media_stream_request.h" - -using content::BrowserThread; -using content::MediaStreamDevices; - -namespace { - -const content::MediaStreamDevice* FindDefaultDeviceWithId( - const content::MediaStreamDevices& devices, - const std::string& device_id) { - if (devices.empty()) - return NULL; - - content::MediaStreamDevices::const_iterator iter = devices.begin(); - for (; iter != devices.end(); ++iter) { - if (iter->id == device_id) { - return &(*iter); - } - } - - return &(*devices.begin()); -}; - -} // namespace - - -CefMediaCaptureDevicesDispatcher* - CefMediaCaptureDevicesDispatcher::GetInstance() { - return Singleton::get(); -} - -CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher() - : devices_enumerated_(false) {} - -CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() {} - -void CefMediaCaptureDevicesDispatcher::RegisterPrefs( - PrefRegistrySimple* registry) { - registry->RegisterStringPref(prefs::kDefaultAudioCaptureDevice, - std::string()); - registry->RegisterStringPref(prefs::kDefaultVideoCaptureDevice, - std::string()); -} - -void CefMediaCaptureDevicesDispatcher::AddObserver(Observer* observer) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!observers_.HasObserver(observer)) - observers_.AddObserver(observer); -} - -void CefMediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - observers_.RemoveObserver(observer); -} - -const MediaStreamDevices& -CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!devices_enumerated_) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&content::EnsureMonitorCaptureDevices)); - devices_enumerated_ = true; - } - return audio_devices_; -} - -const MediaStreamDevices& -CefMediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!devices_enumerated_) { - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&content::EnsureMonitorCaptureDevices)); - devices_enumerated_ = true; - } - return video_devices_; -} - -void CefMediaCaptureDevicesDispatcher::GetDefaultDevices( - PrefService* prefs, - bool audio, - bool video, - content::MediaStreamDevices* devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(audio || video); - - std::string default_device; - if (audio) { - default_device = prefs->GetString(prefs::kDefaultAudioCaptureDevice); - GetRequestedDevice(default_device, true, false, devices); - } - - if (video) { - default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice); - GetRequestedDevice(default_device, false, true, devices); - } -} - -void CefMediaCaptureDevicesDispatcher::GetRequestedDevice( - const std::string& requested_device_id, - bool audio, - bool video, - content::MediaStreamDevices* devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(audio || video); - - if (audio) { - const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); - const content::MediaStreamDevice* const device = - FindDefaultDeviceWithId(audio_devices, requested_device_id); - if (device) - devices->push_back(*device); - } - if (video) { - const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices(); - const content::MediaStreamDevice* const device = - FindDefaultDeviceWithId(video_devices, requested_device_id); - if (device) - devices->push_back(*device); - } -} - -void CefMediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind( - &CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread, - base::Unretained(this), devices)); -} - -void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind( - &CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread, - base::Unretained(this), devices)); -} - -void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged( +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/media_capture_devices_dispatcher.h" + +#include "base/prefs/pref_registry_simple.h" +#include "base/prefs/pref_service.h" +#include "chrome/common/pref_names.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/media_devices_monitor.h" +#include "content/public/common/media_stream_request.h" + +using content::BrowserThread; +using content::MediaStreamDevices; + +namespace { + +const content::MediaStreamDevice* FindDefaultDeviceWithId( + const content::MediaStreamDevices& devices, + const std::string& device_id) { + if (devices.empty()) + return NULL; + + content::MediaStreamDevices::const_iterator iter = devices.begin(); + for (; iter != devices.end(); ++iter) { + if (iter->id == device_id) { + return &(*iter); + } + } + + return &(*devices.begin()); +}; + +} // namespace + + +CefMediaCaptureDevicesDispatcher* + CefMediaCaptureDevicesDispatcher::GetInstance() { + return Singleton::get(); +} + +CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher() + : devices_enumerated_(false) {} + +CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() {} + +void CefMediaCaptureDevicesDispatcher::RegisterPrefs( + PrefRegistrySimple* registry) { + registry->RegisterStringPref(prefs::kDefaultAudioCaptureDevice, + std::string()); + registry->RegisterStringPref(prefs::kDefaultVideoCaptureDevice, + std::string()); +} + +void CefMediaCaptureDevicesDispatcher::AddObserver(Observer* observer) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (!observers_.HasObserver(observer)) + observers_.AddObserver(observer); +} + +void CefMediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + observers_.RemoveObserver(observer); +} + +const MediaStreamDevices& +CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (!devices_enumerated_) { + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&content::EnsureMonitorCaptureDevices)); + devices_enumerated_ = true; + } + return audio_devices_; +} + +const MediaStreamDevices& +CefMediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + if (!devices_enumerated_) { + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&content::EnsureMonitorCaptureDevices)); + devices_enumerated_ = true; + } + return video_devices_; +} + +void CefMediaCaptureDevicesDispatcher::GetDefaultDevices( + PrefService* prefs, + bool audio, + bool video, + content::MediaStreamDevices* devices) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(audio || video); + + std::string default_device; + if (audio) { + default_device = prefs->GetString(prefs::kDefaultAudioCaptureDevice); + GetRequestedDevice(default_device, true, false, devices); + } + + if (video) { + default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice); + GetRequestedDevice(default_device, false, true, devices); + } +} + +void CefMediaCaptureDevicesDispatcher::GetRequestedDevice( + const std::string& requested_device_id, + bool audio, + bool video, + content::MediaStreamDevices* devices) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(audio || video); + + if (audio) { + const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); + const content::MediaStreamDevice* const device = + FindDefaultDeviceWithId(audio_devices, requested_device_id); + if (device) + devices->push_back(*device); + } + if (video) { + const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices(); + const content::MediaStreamDevice* const device = + FindDefaultDeviceWithId(video_devices, requested_device_id); + if (device) + devices->push_back(*device); + } +} + +void CefMediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged( + const content::MediaStreamDevices& devices) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind( + &CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread, + base::Unretained(this), devices)); +} + +void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged( + const content::MediaStreamDevices& devices) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind( + &CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread, + base::Unretained(this), devices)); +} + +void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged( int render_process_id, int render_view_id, int page_request_id, + const GURL& security_origin, const content::MediaStreamDevice& device, - content::MediaRequestState state) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind( - &CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread, - base::Unretained(this), render_process_id, render_view_id, - page_request_id, device, state)); - -} - -void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged( + content::MediaRequestState state) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind( + &CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread, + base::Unretained(this), render_process_id, render_view_id, + page_request_id, device, state)); + +} + +void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged( int render_process_id, int render_view_id, int stream_id, bool is_playing, float power_dbfs, - bool clipped) { -} - + bool clipped) { +} + void CefMediaCaptureDevicesDispatcher::OnCreatingAudioStream( int render_process_id, - int render_view_id) { -} - -void CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread( - const content::MediaStreamDevices& devices) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - devices_enumerated_ = true; - audio_devices_ = devices; - FOR_EACH_OBSERVER(Observer, observers_, - OnUpdateAudioDevices(audio_devices_)); -} - -void CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread( - const content::MediaStreamDevices& devices){ - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - devices_enumerated_ = true; - video_devices_ = devices; - FOR_EACH_OBSERVER(Observer, observers_, - OnUpdateVideoDevices(video_devices_)); -} - -void CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread( - int render_process_id, - int render_view_id, - int page_request_id, - const content::MediaStreamDevice& device, - content::MediaRequestState state) { - FOR_EACH_OBSERVER(Observer, observers_, - OnRequestUpdate(render_process_id, - render_view_id, - page_request_id, - device, - state)); -} + int render_view_id) { +} + +void CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread( + const content::MediaStreamDevices& devices) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + devices_enumerated_ = true; + audio_devices_ = devices; + FOR_EACH_OBSERVER(Observer, observers_, + OnUpdateAudioDevices(audio_devices_)); +} + +void CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread( + const content::MediaStreamDevices& devices){ + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + devices_enumerated_ = true; + video_devices_ = devices; + FOR_EACH_OBSERVER(Observer, observers_, + OnUpdateVideoDevices(video_devices_)); +} + +void CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread( + int render_process_id, + int render_view_id, + int page_request_id, + const content::MediaStreamDevice& device, + content::MediaRequestState state) { + FOR_EACH_OBSERVER(Observer, observers_, + OnRequestUpdate(render_process_id, + render_view_id, + page_request_id, + device, + state)); +} diff --git a/libcef/browser/media_capture_devices_dispatcher.h b/libcef/browser/media_capture_devices_dispatcher.h index 91ad52309..95f0b5816 100644 --- a/libcef/browser/media_capture_devices_dispatcher.h +++ b/libcef/browser/media_capture_devices_dispatcher.h @@ -1,127 +1,128 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ -#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ - -#include "base/callback.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/singleton.h" -#include "base/observer_list.h" -#include "content/public/browser/media_observer.h" -#include "content/public/common/media_stream_request.h" - -class PrefRegistrySimple; -class PrefService; - -// This singleton is used to receive updates about media events from the content -// layer. Based on chrome/browser/media/media_capture_devices_dispatcher.[h|cc]. -class CefMediaCaptureDevicesDispatcher : public content::MediaObserver { - public: - class Observer { - public: - // Handle an information update consisting of a up-to-date audio capture - // device lists. This happens when a microphone is plugged in or unplugged. - virtual void OnUpdateAudioDevices( - const content::MediaStreamDevices& devices) {} - - // Handle an information update consisting of a up-to-date video capture - // device lists. This happens when a camera is plugged in or unplugged. - virtual void OnUpdateVideoDevices( - const content::MediaStreamDevices& devices) {} - - // Handle an information update related to a media stream request. - virtual void OnRequestUpdate( - int render_process_id, - int render_view_id, - int page_request_id, - const content::MediaStreamDevice& device, - const content::MediaRequestState state) {} - - virtual ~Observer() {} - }; - - static CefMediaCaptureDevicesDispatcher* GetInstance(); - - // Registers the preferences related to Media Stream default devices. - static void RegisterPrefs(PrefRegistrySimple* registry); - - // Methods for observers. Called on UI thread. - // Observers should add themselves on construction and remove themselves - // on destruction. - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); - const content::MediaStreamDevices& GetAudioCaptureDevices(); - const content::MediaStreamDevices& GetVideoCaptureDevices(); - - // Helper to get the default devices which can be used by the media request, - // if the return list is empty, it means there is no available device on the - // OS. - // Called on the UI thread. - void GetDefaultDevices(PrefService* prefs, - bool audio, - bool video, - content::MediaStreamDevices* devices); - - // Helper for picking the device that was requested for an OpenDevice request. - // If the device requested is not available it will revert to using the first - // available one instead or will return an empty list if no devices of the - // requested kind are present. - void GetRequestedDevice(const std::string& requested_device_id, - bool audio, - bool video, - content::MediaStreamDevices* devices); - - // Overridden from content::MediaObserver: - virtual void OnAudioCaptureDevicesChanged( - const content::MediaStreamDevices& devices) OVERRIDE; - virtual void OnVideoCaptureDevicesChanged( - const content::MediaStreamDevices& devices) OVERRIDE; - virtual void OnMediaRequestStateChanged( +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ +#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ + +#include "base/callback.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/singleton.h" +#include "base/observer_list.h" +#include "content/public/browser/media_observer.h" +#include "content/public/common/media_stream_request.h" + +class PrefRegistrySimple; +class PrefService; + +// This singleton is used to receive updates about media events from the content +// layer. Based on chrome/browser/media/media_capture_devices_dispatcher.[h|cc]. +class CefMediaCaptureDevicesDispatcher : public content::MediaObserver { + public: + class Observer { + public: + // Handle an information update consisting of a up-to-date audio capture + // device lists. This happens when a microphone is plugged in or unplugged. + virtual void OnUpdateAudioDevices( + const content::MediaStreamDevices& devices) {} + + // Handle an information update consisting of a up-to-date video capture + // device lists. This happens when a camera is plugged in or unplugged. + virtual void OnUpdateVideoDevices( + const content::MediaStreamDevices& devices) {} + + // Handle an information update related to a media stream request. + virtual void OnRequestUpdate( + int render_process_id, + int render_view_id, + int page_request_id, + const content::MediaStreamDevice& device, + const content::MediaRequestState state) {} + + virtual ~Observer() {} + }; + + static CefMediaCaptureDevicesDispatcher* GetInstance(); + + // Registers the preferences related to Media Stream default devices. + static void RegisterPrefs(PrefRegistrySimple* registry); + + // Methods for observers. Called on UI thread. + // Observers should add themselves on construction and remove themselves + // on destruction. + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + const content::MediaStreamDevices& GetAudioCaptureDevices(); + const content::MediaStreamDevices& GetVideoCaptureDevices(); + + // Helper to get the default devices which can be used by the media request, + // if the return list is empty, it means there is no available device on the + // OS. + // Called on the UI thread. + void GetDefaultDevices(PrefService* prefs, + bool audio, + bool video, + content::MediaStreamDevices* devices); + + // Helper for picking the device that was requested for an OpenDevice request. + // If the device requested is not available it will revert to using the first + // available one instead or will return an empty list if no devices of the + // requested kind are present. + void GetRequestedDevice(const std::string& requested_device_id, + bool audio, + bool video, + content::MediaStreamDevices* devices); + + // Overridden from content::MediaObserver: + virtual void OnAudioCaptureDevicesChanged( + const content::MediaStreamDevices& devices) OVERRIDE; + virtual void OnVideoCaptureDevicesChanged( + const content::MediaStreamDevices& devices) OVERRIDE; + virtual void OnMediaRequestStateChanged( int render_process_id, int render_view_id, int page_request_id, + const GURL& security_origin, const content::MediaStreamDevice& device, - content::MediaRequestState state) OVERRIDE; - virtual void OnAudioStreamPlayingChanged( + content::MediaRequestState state) OVERRIDE; + virtual void OnAudioStreamPlayingChanged( int render_process_id, int render_view_id, int stream_id, bool is_playing, float power_dbfs, - bool clipped) OVERRIDE; + bool clipped) OVERRIDE; virtual void OnCreatingAudioStream(int render_process_id, - int render_view_id) OVERRIDE; - - private: - friend struct DefaultSingletonTraits; - - CefMediaCaptureDevicesDispatcher(); - virtual ~CefMediaCaptureDevicesDispatcher(); - - // Called by the MediaObserver() functions, executed on UI thread. - void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); - void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); - void UpdateMediaRequestStateOnUIThread( - int render_process_id, - int render_view_id, - int page_request_id, - const content::MediaStreamDevice& device, - content::MediaRequestState state); - - // A list of cached audio capture devices. - content::MediaStreamDevices audio_devices_; - - // A list of cached video capture devices. - content::MediaStreamDevices video_devices_; - - // A list of observers for the device update notifications. - ObserverList observers_; - - // Flag to indicate if device enumeration has been done/doing. - // Only accessed on UI thread. - bool devices_enumerated_; -}; - -#endif // CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ + int render_view_id) OVERRIDE; + + private: + friend struct DefaultSingletonTraits; + + CefMediaCaptureDevicesDispatcher(); + virtual ~CefMediaCaptureDevicesDispatcher(); + + // Called by the MediaObserver() functions, executed on UI thread. + void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); + void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); + void UpdateMediaRequestStateOnUIThread( + int render_process_id, + int render_view_id, + int page_request_id, + const content::MediaStreamDevice& device, + content::MediaRequestState state); + + // A list of cached audio capture devices. + content::MediaStreamDevices audio_devices_; + + // A list of cached video capture devices. + content::MediaStreamDevices video_devices_; + + // A list of observers for the device update notifications. + ObserverList observers_; + + // Flag to indicate if device enumeration has been done/doing. + // Only accessed on UI thread. + bool devices_enumerated_; +}; + +#endif // CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ diff --git a/libcef/browser/menu_creator.cc b/libcef/browser/menu_creator.cc index 0f9b62ddf..0676cd919 100644 --- a/libcef/browser/menu_creator.cc +++ b/libcef/browser/menu_creator.cc @@ -9,7 +9,8 @@ #include "base/compiler_specific.h" #include "base/logging.h" -#include "content/public/browser/render_view_host.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_widget_host_view.h" #include "grit/cef_strings.h" @@ -32,8 +33,12 @@ CefString GetLabel(int message_id) { } // namespace -CefMenuCreator::CefMenuCreator(CefBrowserHostImpl* browser) +CefMenuCreator::CefMenuCreator(CefBrowserHostImpl* browser, + content::RenderFrameHost* render_frame_host) : browser_(browser) { + DCHECK(render_frame_host); + render_process_id_ = render_frame_host->GetProcess()->GetID(); + render_frame_id_ = render_frame_host->GetRoutingID(); model_ = new CefMenuModelImpl(this); } @@ -199,10 +204,10 @@ void CefMenuCreator::MenuClosed(CefRefPtr source) { browser_->GetWebContents()->GetRenderWidgetHostView(); if (view) view->SetShowingContextMenu(false); - content::RenderViewHost* rvh = - browser_->GetWebContents()->GetRenderViewHost(); - if (rvh) - rvh->NotifyContextMenuClosed(params_.custom_context); + content::RenderFrameHost* render_frame_host = + content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); + if (render_frame_host) + render_frame_host->NotifyContextMenuClosed(params_.custom_context); } } diff --git a/libcef/browser/menu_creator.h b/libcef/browser/menu_creator.h index 60c3f2ced..99f0eed73 100644 --- a/libcef/browser/menu_creator.h +++ b/libcef/browser/menu_creator.h @@ -11,6 +11,10 @@ #include "base/memory/scoped_ptr.h" #include "content/public/common/context_menu_params.h" +namespace content { +class RenderFrameHost; +}; + class CefBrowserHostImpl; class CefMenuCreator : public CefMenuModelImpl::Delegate { @@ -22,7 +26,8 @@ class CefMenuCreator : public CefMenuModelImpl::Delegate { virtual bool RunContextMenu(CefMenuCreator* manager) =0; }; - explicit CefMenuCreator(CefBrowserHostImpl* browser); + CefMenuCreator(CefBrowserHostImpl* browser, + content::RenderFrameHost* render_frame_host); virtual ~CefMenuCreator(); // Returns true if the context menu is currently showing. @@ -53,6 +58,11 @@ class CefMenuCreator : public CefMenuModelImpl::Delegate { // CefBrowserHostImpl pointer is guaranteed to outlive this object. CefBrowserHostImpl* browser_; + + // The RenderFrameHost's IDs. + int render_process_id_; + int render_frame_id_; + CefRefPtr model_; content::ContextMenuParams params_; scoped_ptr runner_; diff --git a/libcef/browser/navigate_params.h b/libcef/browser/navigate_params.h index d846d19ba..b5058b106 100644 --- a/libcef/browser/navigate_params.h +++ b/libcef/browser/navigate_params.h @@ -9,10 +9,11 @@ #include +#include "libcef/common/upload_data.h" + #include "content/public/browser/global_request_id.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/referrer.h" -#include "net/base/upload_data.h" #include "ui/base/window_open_disposition.h" #include "url/gurl.h" diff --git a/libcef/browser/render_widget_host_view_osr.cc b/libcef/browser/render_widget_host_view_osr.cc index 72b1bc03e..54969236b 100644 --- a/libcef/browser/render_widget_host_view_osr.cc +++ b/libcef/browser/render_widget_host_view_osr.cc @@ -369,7 +369,8 @@ content::BackingStore* CefRenderWidgetHostViewOSR::AllocBackingStore( void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback& callback) { + const base::Callback& callback, + const SkBitmap::Config config) { } void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame( diff --git a/libcef/browser/render_widget_host_view_osr.h b/libcef/browser/render_widget_host_view_osr.h index 64c21f8cc..5a7daf305 100644 --- a/libcef/browser/render_widget_host_view_osr.h +++ b/libcef/browser/render_widget_host_view_osr.h @@ -156,7 +156,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, - const base::Callback& callback) OVERRIDE; + const base::Callback& callback, + const SkBitmap::Config config) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr& target, diff --git a/libcef/browser/scheme_handler.cc b/libcef/browser/scheme_handler.cc index 96a668392..0bbe9a80f 100644 --- a/libcef/browser/scheme_handler.cc +++ b/libcef/browser/scheme_handler.cc @@ -25,7 +25,7 @@ void InstallInternalProtectedHandlers( content::ProtocolHandlerMap* protocol_handlers, net::FtpTransactionFactory* ftp_transaction_factory) { protocol_handlers->insert( - std::make_pair(chrome::kDataScheme, + std::make_pair(content::kDataScheme, linked_ptr( new net::DataProtocolHandler))); protocol_handlers->insert( diff --git a/libcef/browser/scheme_impl.cc b/libcef/browser/scheme_impl.cc index 69118a68c..925d58620 100644 --- a/libcef/browser/scheme_impl.cc +++ b/libcef/browser/scheme_impl.cc @@ -18,6 +18,7 @@ #include "libcef/common/request_impl.h" #include "libcef/common/response_impl.h" #include "libcef/common/scheme_registration.h" +#include "libcef/common/upload_data.h" #include "base/bind.h" #include "base/lazy_instance.h" @@ -27,7 +28,6 @@ #include "base/synchronization/lock.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" -#include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" diff --git a/libcef/browser/trace_impl.cc b/libcef/browser/trace_impl.cc index 227ef8946..017ed6213 100644 --- a/libcef/browser/trace_impl.cc +++ b/libcef/browser/trace_impl.cc @@ -11,7 +11,8 @@ #include "base/debug/trace_event.h" #include "base/time/time.h" -bool CefBeginTracing(const CefString& categories) { +bool CefBeginTracing(const CefString& categories, + CefRefPtr callback) { if (!CONTEXT_STATE_VALID()) { NOTREACHED() << "context not valid"; return false; @@ -26,11 +27,11 @@ bool CefBeginTracing(const CefString& categories) { if (!subscriber) return false; - return subscriber->BeginTracing(categories); + return subscriber->BeginTracing(categories, callback); } -bool CefEndTracingAsync(const CefString& tracing_file, - CefRefPtr callback) { +bool CefEndTracing(const CefString& tracing_file, + CefRefPtr callback) { if (!CONTEXT_STATE_VALID()) { NOTREACHED() << "context not valid"; return false; @@ -45,7 +46,7 @@ bool CefEndTracingAsync(const CefString& tracing_file, if (!subscriber) return false; - return subscriber->EndTracingAsync(base::FilePath(tracing_file), callback); + return subscriber->EndTracing(base::FilePath(tracing_file), callback); } int64 CefNowFromSystemTraceTime() { diff --git a/libcef/browser/trace_subscriber.cc b/libcef/browser/trace_subscriber.cc index d3e48ed76..158281d55 100644 --- a/libcef/browser/trace_subscriber.cc +++ b/libcef/browser/trace_subscriber.cc @@ -26,7 +26,9 @@ CefTraceSubscriber::~CefTraceSubscriber() { } } -bool CefTraceSubscriber::BeginTracing(const std::string& categories) { +bool CefTraceSubscriber::BeginTracing( + const std::string& categories, + CefRefPtr callback) { CEF_REQUIRE_UIT(); if (collecting_trace_data_) @@ -34,13 +36,16 @@ bool CefTraceSubscriber::BeginTracing(const std::string& categories) { collecting_trace_data_ = true; + TracingController::EnableRecordingDoneCallback done_callback; + if (callback.get()) + done_callback = base::Bind(&CefCompletionCallback::OnComplete, callback); + TracingController::GetInstance()->EnableRecording( - categories, TracingController::DEFAULT_OPTIONS, - TracingController::EnableRecordingDoneCallback()); + categories, TracingController::DEFAULT_OPTIONS, done_callback); return true; } -bool CefTraceSubscriber::EndTracingAsync( +bool CefTraceSubscriber::EndTracing( const base::FilePath& tracing_file, CefRefPtr callback) { CEF_REQUIRE_UIT(); diff --git a/libcef/browser/trace_subscriber.h b/libcef/browser/trace_subscriber.h index d140b70dd..c26332fd2 100644 --- a/libcef/browser/trace_subscriber.h +++ b/libcef/browser/trace_subscriber.h @@ -19,9 +19,10 @@ class CefTraceSubscriber { CefTraceSubscriber(); virtual ~CefTraceSubscriber(); - bool BeginTracing(const std::string& categories); - bool EndTracingAsync(const base::FilePath& tracing_file, - CefRefPtr callback); + bool BeginTracing(const std::string& categories, + CefRefPtr callback); + bool EndTracing(const base::FilePath& tracing_file, + CefRefPtr callback); private: void OnTracingFileResult(CefRefPtr callback, diff --git a/libcef/browser/url_request_context_getter.cc b/libcef/browser/url_request_context_getter.cc index 2780a58b6..7f7e4e94c 100644 --- a/libcef/browser/url_request_context_getter.cc +++ b/libcef/browser/url_request_context_getter.cc @@ -274,7 +274,7 @@ void CefURLRequestContextGetter::SetCookieStoragePath( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), persist_session_cookies, NULL, - scoped_ptr()); + NULL); } else { NOTREACHED() << "The cookie storage directory could not be created"; } diff --git a/libcef/common/cef_messages.h b/libcef/common/cef_messages.h index 1a8c4ef20..e149796cc 100644 --- a/libcef/common/cef_messages.h +++ b/libcef/common/cef_messages.h @@ -6,12 +6,13 @@ // IPC messages for CEF. // Multiply-included message file, hence no include guard. +#include "libcef/common/upload_data.h" + #include "base/memory/shared_memory.h" #include "base/values.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/referrer.h" #include "ipc/ipc_message_macros.h" -#include "net/base/upload_data.h" // TODO(cef): Re-using the message start for extensions may be problematic in // the future. It would be better if ipc_message_utils.h contained a value diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 3e7330269..16e0c7bf5 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -291,6 +291,13 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { command_line->AppendSwitchASCII(switches::kContextSafetyImplementation, base::IntToString(settings.context_safety_implementation)); } + + if (settings.windowless_rendering_enabled) { + // Must disable delegated renderer and threaded compositing for select + // popups to display correctly in a windowless browser. + command_line->AppendSwitch(switches::kDisableDelegatedRenderer); + command_line->AppendSwitch(switches::kDisableThreadedCompositing); + } } if (content_client_.application().get()) { diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 669cb39b6..583271493 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -8,10 +8,10 @@ #include "libcef/common/http_header_utils.h" #include "libcef/common/request_impl.h" #include "libcef/common/task_runner_impl.h" +#include "libcef/common/upload_data.h" #include "base/logging.h" #include "content/public/browser/resource_request_info.h" -#include "net/base/upload_data.h" #include "net/base/upload_data_stream.h" #include "net/base/upload_element_reader.h" #include "net/base/upload_bytes_element_reader.h" diff --git a/libcef/common/scheme_registration.cc b/libcef/common/scheme_registration.cc index b359ca723..900013474 100644 --- a/libcef/common/scheme_registration.cc +++ b/libcef/common/scheme_registration.cc @@ -28,7 +28,7 @@ bool IsInternalHandledScheme(const std::string& scheme) { chrome::kBlobScheme, chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme, - chrome::kDataScheme, + content::kDataScheme, content::kFileScheme, content::kFileSystemScheme, }; @@ -48,7 +48,7 @@ bool IsInternalProtectedScheme(const std::string& scheme) { static const char* schemes[] = { chrome::kBlobScheme, chrome::kChromeUIScheme, - chrome::kDataScheme, + content::kDataScheme, content::kFileScheme, content::kFileSystemScheme, #if !defined(DISABLE_FTP_SUPPORT) diff --git a/libcef/common/upload_data.cc b/libcef/common/upload_data.cc new file mode 100644 index 000000000..9fd260a39 --- /dev/null +++ b/libcef/common/upload_data.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cef/libcef/common/upload_data.h" + +#include "base/logging.h" + +namespace net { + +UploadData::UploadData() + : identifier_(0), + is_chunked_(false), + last_chunk_appended_(false) { +} + +void UploadData::AppendBytes(const char* bytes, int bytes_len) { + DCHECK(!is_chunked_); + if (bytes_len > 0) { + elements_.push_back(new UploadElement()); + elements_.back()->SetToBytes(bytes, bytes_len); + } +} + +void UploadData::AppendFileRange(const base::FilePath& file_path, + uint64 offset, uint64 length, + const base::Time& expected_modification_time) { + DCHECK(!is_chunked_); + elements_.push_back(new UploadElement()); + elements_.back()->SetToFilePathRange(file_path, offset, length, + expected_modification_time); +} + +UploadData::~UploadData() { +} + +} // namespace net diff --git a/libcef/common/upload_data.h b/libcef/common/upload_data.h new file mode 100644 index 000000000..2299f8d86 --- /dev/null +++ b/libcef/common/upload_data.h @@ -0,0 +1,83 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_UPLOAD_DATA_H_ +#define CEF_LIBCEF_COMMON_UPLOAD_DATA_H_ + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_vector.h" +#include "base/supports_user_data.h" +#include "net/base/net_export.h" +#include "net/base/upload_element.h" + +namespace base { +class FilePath; +class Time; +} // namespace base + +namespace net { + +//----------------------------------------------------------------------------- +// A very concrete class representing the data to be uploaded as part of a +// URLRequest. +// +// Until there is a more abstract class for this, this one derives from +// SupportsUserData to allow users to stash random data by +// key and ensure its destruction when UploadData is finally deleted. +class NET_EXPORT UploadData + : public base::RefCounted, + public base::SupportsUserData { + public: + UploadData(); + + void AppendBytes(const char* bytes, int bytes_len); + + void AppendFileRange(const base::FilePath& file_path, + uint64 offset, uint64 length, + const base::Time& expected_modification_time); + + // Initializes the object to send chunks of upload data over time rather + // than all at once. Chunked data may only contain bytes, not files. + void set_is_chunked(bool set) { is_chunked_ = set; } + bool is_chunked() const { return is_chunked_; } + + // set_last_chunk_appended() is only used for serialization. + void set_last_chunk_appended(bool set) { last_chunk_appended_ = set; } + bool last_chunk_appended() const { return last_chunk_appended_; } + + const ScopedVector& elements() const { + return elements_; + } + + ScopedVector* elements_mutable() { + return &elements_; + } + + void swap_elements(ScopedVector* elements) { + elements_.swap(*elements); + } + + // Identifies a particular upload instance, which is used by the cache to + // formulate a cache key. This value should be unique across browser + // sessions. A value of 0 is used to indicate an unspecified identifier. + void set_identifier(int64 id) { identifier_ = id; } + int64 identifier() const { return identifier_; } + + private: + friend class base::RefCounted; + + virtual ~UploadData(); + + ScopedVector elements_; + int64 identifier_; + bool is_chunked_; + bool last_chunk_appended_; + + DISALLOW_COPY_AND_ASSIGN(UploadData); +}; + +} // namespace net + +#endif // CEF_LIBCEF_COMMON_UPLOAD_DATA_H_ diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 3513046fb..210cd69f7 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -37,7 +37,6 @@ #include "third_party/WebKit/public/web/WebScriptSource.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h" #include "third_party/WebKit/public/web/WebView.h" -#include "webkit/glue/webkit_glue.h" using blink::WebFrame; using blink::WebScriptSource; diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 05ed8266b..3611c0a3a 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -517,7 +517,7 @@ bool CefContentRendererClient::OverrideCreatePlugin( } bool CefContentRendererClient::HandleNavigation( - content::RenderView* view, + content::RenderFrame* render_frame, content::DocumentState* document_state, int opener_id, blink::WebFrame* frame, diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index 3476754a6..6a8d9c1fc 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -82,7 +82,7 @@ class CefContentRendererClient : public content::ContentRendererClient, blink::WebFrame* frame, const blink::WebPluginParams& params, blink::WebPlugin** plugin) OVERRIDE; - virtual bool HandleNavigation(content::RenderView* view, + virtual bool HandleNavigation(content::RenderFrame* render_frame, content::DocumentState* document_state, int opener_id, blink::WebFrame* frame, diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index f0916bc78..13b96e24c 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -112,8 +112,6 @@ CefDOMNodeImpl::Type CefDOMNodeImpl::GetType() { return DOM_NODE_TYPE_TEXT; case WebNode::CDataSectionNode: return DOM_NODE_TYPE_CDATA_SECTION; - case WebNode::EntityNode: - return DOM_NODE_TYPE_ENTITY; case WebNode::ProcessingInstructionsNode: return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS; case WebNode::CommentNode: @@ -124,10 +122,6 @@ CefDOMNodeImpl::Type CefDOMNodeImpl::GetType() { return DOM_NODE_TYPE_DOCUMENT_TYPE; case WebNode::DocumentFragmentNode: return DOM_NODE_TYPE_DOCUMENT_FRAGMENT; - case WebNode::NotationNode: - return DOM_NODE_TYPE_NOTATION; - case WebNode::XPathNamespaceNode: - return DOM_NODE_TYPE_XPATH_NAMESPACE; default: return DOM_NODE_TYPE_UNSUPPORTED; } diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index a4e1c701e..bf7b8fadd 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -620,7 +620,7 @@ v8::Local CallV8Function(v8::Handle context, } } else { WebCore::WorkerScriptController* controller = - WebCore::WorkerScriptController::controllerForContext(); + WebCore::WorkerScriptController::controllerForContext(isolate); DCHECK(controller); if (controller) { func_rv = WebCore::ScriptController::callFunction( @@ -1154,7 +1154,7 @@ CefRefPtr CefV8Value::CreateObject( } // Create the new V8 object. - v8::Local obj = v8::Object::New(); + v8::Local obj = v8::Object::New(isolate); // Create a tracker object that will cause the user data and/or accessor // reference to be released when the V8 object is destroyed. diff --git a/libcef/renderer/v8_impl.h b/libcef/renderer/v8_impl.h index 1684c3de2..c2178c3fa 100644 --- a/libcef/renderer/v8_impl.h +++ b/libcef/renderer/v8_impl.h @@ -124,7 +124,7 @@ class CefV8HandleBase : template class CefV8Handle : public CefV8HandleBase { public: - typedef v8::Handle handleType; + typedef v8::Local handleType; typedef v8::Persistent persistentType; CefV8Handle(v8::Isolate* isolate, @@ -275,7 +275,7 @@ class CefV8ValueImpl : public CefV8Value { class Handle : public CefV8HandleBase { public: - typedef v8::Handle handleType; + typedef v8::Local handleType; typedef v8::Persistent persistentType; Handle(v8::Isolate* isolate, diff --git a/libcef/resources/cef_strings.grd b/libcef/resources/cef_strings.grd index cd2172aa6..e72d539ce 100644 --- a/libcef/resources/cef_strings.grd +++ b/libcef/resources/cef_strings.grd @@ -274,7 +274,7 @@ need to be translated for each locale.--> Something went wrong when trying to print. Please check your printer and try again. - + The selected printer is not available or not installed correctly. Check your printer or try selecting another printer. diff --git a/libcef_dll/cpptoc/completion_handler_cpptoc.cc b/libcef_dll/cpptoc/completion_callback_cpptoc.cc similarity index 56% rename from libcef_dll/cpptoc/completion_handler_cpptoc.cc rename to libcef_dll/cpptoc/completion_callback_cpptoc.cc index 9e0c13d51..fb0ca10c3 100644 --- a/libcef_dll/cpptoc/completion_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/completion_callback_cpptoc.cc @@ -10,13 +10,13 @@ // for more information. // -#include "libcef_dll/cpptoc/completion_handler_cpptoc.h" +#include "libcef_dll/cpptoc/completion_callback_cpptoc.h" // MEMBER FUNCTIONS - Body may be edited by hand. -void CEF_CALLBACK completion_handler_on_complete( - struct _cef_completion_handler_t* self) { +void CEF_CALLBACK completion_callback_on_complete( + struct _cef_completion_callback_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -24,21 +24,21 @@ void CEF_CALLBACK completion_handler_on_complete( return; // Execute - CefCompletionHandlerCppToC::Get(self)->OnComplete(); + CefCompletionCallbackCppToC::Get(self)->OnComplete(); } // CONSTRUCTOR - Do not edit by hand. -CefCompletionHandlerCppToC::CefCompletionHandlerCppToC( - CefCompletionHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_complete = completion_handler_on_complete; +CefCompletionCallbackCppToC::CefCompletionCallbackCppToC( + CefCompletionCallback* cls) + : CefCppToC(cls) { + struct_.struct_.on_complete = completion_callback_on_complete; } #ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; +template<> long CefCppToC::DebugObjCt = 0; #endif diff --git a/libcef_dll/cpptoc/completion_handler_cpptoc.h b/libcef_dll/cpptoc/completion_callback_cpptoc.h similarity index 67% rename from libcef_dll/cpptoc/completion_handler_cpptoc.h rename to libcef_dll/cpptoc/completion_callback_cpptoc.h index a4b04949b..b198ad8ab 100644 --- a/libcef_dll/cpptoc/completion_handler_cpptoc.h +++ b/libcef_dll/cpptoc/completion_callback_cpptoc.h @@ -10,8 +10,8 @@ // for more information. // -#ifndef CEF_LIBCEF_DLL_CPPTOC_COMPLETION_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_COMPLETION_HANDLER_CPPTOC_H_ +#ifndef CEF_LIBCEF_DLL_CPPTOC_COMPLETION_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_COMPLETION_CALLBACK_CPPTOC_H_ #pragma once #ifndef USING_CEF_SHARED @@ -24,14 +24,14 @@ // Wrap a C++ class with a C structure. // This class may be instantiated and accessed wrapper-side only. -class CefCompletionHandlerCppToC - : public CefCppToC { +class CefCompletionCallbackCppToC + : public CefCppToC { public: - explicit CefCompletionHandlerCppToC(CefCompletionHandler* cls); - virtual ~CefCompletionHandlerCppToC() {} + explicit CefCompletionCallbackCppToC(CefCompletionCallback* cls); + virtual ~CefCompletionCallbackCppToC() {} }; #endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_COMPLETION_HANDLER_CPPTOC_H_ +#endif // CEF_LIBCEF_DLL_CPPTOC_COMPLETION_CALLBACK_CPPTOC_H_ diff --git a/libcef_dll/cpptoc/cookie_manager_cpptoc.cc b/libcef_dll/cpptoc/cookie_manager_cpptoc.cc index 33a44c13a..f486b43d0 100644 --- a/libcef_dll/cpptoc/cookie_manager_cpptoc.cc +++ b/libcef_dll/cpptoc/cookie_manager_cpptoc.cc @@ -11,7 +11,7 @@ // #include "libcef_dll/cpptoc/cookie_manager_cpptoc.h" -#include "libcef_dll/ctocpp/completion_handler_ctocpp.h" +#include "libcef_dll/ctocpp/completion_callback_ctocpp.h" #include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h" #include "libcef_dll/transfer_util.h" @@ -184,17 +184,20 @@ int CEF_CALLBACK cookie_manager_set_storage_path( } int CEF_CALLBACK cookie_manager_flush_store(struct _cef_cookie_manager_t* self, - cef_completion_handler_t* handler) { + cef_completion_callback_t* callback) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); if (!self) return 0; - // Unverified params: handler + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; // Execute bool _retval = CefCookieManagerCppToC::Get(self)->FlushStore( - CefCompletionHandlerCToCpp::Wrap(handler)); + CefCompletionCallbackCToCpp::Wrap(callback)); // Return type: bool return _retval; diff --git a/libcef_dll/ctocpp/completion_handler_ctocpp.cc b/libcef_dll/ctocpp/completion_callback_ctocpp.cc similarity index 76% rename from libcef_dll/ctocpp/completion_handler_ctocpp.cc rename to libcef_dll/ctocpp/completion_callback_ctocpp.cc index 53174378e..9481c9101 100644 --- a/libcef_dll/ctocpp/completion_handler_ctocpp.cc +++ b/libcef_dll/ctocpp/completion_callback_ctocpp.cc @@ -10,12 +10,12 @@ // for more information. // -#include "libcef_dll/ctocpp/completion_handler_ctocpp.h" +#include "libcef_dll/ctocpp/completion_callback_ctocpp.h" // VIRTUAL METHODS - Body may be edited by hand. -void CefCompletionHandlerCToCpp::OnComplete() { +void CefCompletionCallbackCToCpp::OnComplete() { if (CEF_MEMBER_MISSING(struct_, on_complete)) return; @@ -27,7 +27,7 @@ void CefCompletionHandlerCToCpp::OnComplete() { #ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; +template<> long CefCToCpp::DebugObjCt = 0; #endif diff --git a/libcef_dll/ctocpp/completion_handler_ctocpp.h b/libcef_dll/ctocpp/completion_callback_ctocpp.h similarity index 61% rename from libcef_dll/ctocpp/completion_handler_ctocpp.h rename to libcef_dll/ctocpp/completion_callback_ctocpp.h index 4ba568b03..7435c0088 100644 --- a/libcef_dll/ctocpp/completion_handler_ctocpp.h +++ b/libcef_dll/ctocpp/completion_callback_ctocpp.h @@ -10,8 +10,8 @@ // for more information. // -#ifndef CEF_LIBCEF_DLL_CTOCPP_COMPLETION_HANDLER_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_COMPLETION_HANDLER_CTOCPP_H_ +#ifndef CEF_LIBCEF_DLL_CTOCPP_COMPLETION_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_COMPLETION_CALLBACK_CTOCPP_H_ #pragma once #ifndef BUILDING_CEF_SHARED @@ -24,19 +24,19 @@ // Wrap a C structure with a C++ class. // This class may be instantiated and accessed DLL-side only. -class CefCompletionHandlerCToCpp - : public CefCToCpp { +class CefCompletionCallbackCToCpp + : public CefCToCpp { public: - explicit CefCompletionHandlerCToCpp(cef_completion_handler_t* str) - : CefCToCpp(str) {} - virtual ~CefCompletionHandlerCToCpp() {} + explicit CefCompletionCallbackCToCpp(cef_completion_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefCompletionCallbackCToCpp() {} - // CefCompletionHandler methods + // CefCompletionCallback methods virtual void OnComplete() OVERRIDE; }; #endif // BUILDING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_COMPLETION_HANDLER_CTOCPP_H_ +#endif // CEF_LIBCEF_DLL_CTOCPP_COMPLETION_CALLBACK_CTOCPP_H_ diff --git a/libcef_dll/ctocpp/cookie_manager_ctocpp.cc b/libcef_dll/ctocpp/cookie_manager_ctocpp.cc index 34168be96..dd9895525 100644 --- a/libcef_dll/ctocpp/cookie_manager_ctocpp.cc +++ b/libcef_dll/ctocpp/cookie_manager_ctocpp.cc @@ -10,7 +10,7 @@ // for more information. // -#include "libcef_dll/cpptoc/completion_handler_cpptoc.h" +#include "libcef_dll/cpptoc/completion_callback_cpptoc.h" #include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h" #include "libcef_dll/ctocpp/cookie_manager_ctocpp.h" #include "libcef_dll/transfer_util.h" @@ -172,17 +172,20 @@ bool CefCookieManagerCToCpp::SetStoragePath(const CefString& path, } bool CefCookieManagerCToCpp::FlushStore( - CefRefPtr handler) { + CefRefPtr callback) { if (CEF_MEMBER_MISSING(struct_, flush_store)) return false; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Unverified params: handler + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; // Execute int _retval = struct_->flush_store(struct_, - CefCompletionHandlerCppToC::Wrap(handler)); + CefCompletionCallbackCppToC::Wrap(callback)); // Return type: bool return _retval?true:false; diff --git a/libcef_dll/ctocpp/cookie_manager_ctocpp.h b/libcef_dll/ctocpp/cookie_manager_ctocpp.h index cc4c847f7..f6c2127c7 100644 --- a/libcef_dll/ctocpp/cookie_manager_ctocpp.h +++ b/libcef_dll/ctocpp/cookie_manager_ctocpp.h @@ -46,7 +46,7 @@ class CefCookieManagerCToCpp const CefString& cookie_name) OVERRIDE; virtual bool SetStoragePath(const CefString& path, bool persist_session_cookies) OVERRIDE; - virtual bool FlushStore(CefRefPtr handler) OVERRIDE; + virtual bool FlushStore(CefRefPtr callback) OVERRIDE; }; #endif // USING_CEF_SHARED diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index 5eccc717a..960d68a87 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -71,7 +71,7 @@ #include "libcef_dll/cpptoc/zip_reader_cpptoc.h" #include "libcef_dll/ctocpp/app_ctocpp.h" #include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h" -#include "libcef_dll/ctocpp/completion_handler_ctocpp.h" +#include "libcef_dll/ctocpp/completion_callback_ctocpp.h" #include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h" #include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h" #include "libcef_dll/ctocpp/domevent_listener_ctocpp.h" @@ -184,7 +184,7 @@ CEF_EXPORT void cef_shutdown() { DCHECK_EQ(CefBrowserHostCppToC::DebugObjCt, 0); DCHECK_EQ(CefBrowserProcessHandlerCToCpp::DebugObjCt, 0); DCHECK_EQ(CefCallbackCppToC::DebugObjCt, 0); - DCHECK_EQ(CefCompletionHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefCompletionCallbackCToCpp::DebugObjCt, 0); DCHECK_EQ(CefContextMenuHandlerCToCpp::DebugObjCt, 0); DCHECK_EQ(CefContextMenuParamsCppToC::DebugObjCt, 0); DCHECK_EQ(CefCookieVisitorCToCpp::DebugObjCt, 0); @@ -472,27 +472,33 @@ CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId, return _retval; } -CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories) { +CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories, + struct _cef_completion_callback_t* callback) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; // Unverified params: categories // Execute bool _retval = CefBeginTracing( - CefString(categories)); + CefString(categories), + CefCompletionCallbackCToCpp::Wrap(callback)); // Return type: bool return _retval; } -CEF_EXPORT int cef_end_tracing_async(const cef_string_t* tracing_file, +CEF_EXPORT int cef_end_tracing(const cef_string_t* tracing_file, struct _cef_end_tracing_callback_t* callback) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Unverified params: tracing_file, callback // Execute - bool _retval = CefEndTracingAsync( + bool _retval = CefEndTracing( CefString(tracing_file), CefEndTracingCallbackCToCpp::Wrap(callback)); diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 3bbd9fc2c..94f69577e 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -35,7 +35,7 @@ #include "include/cef_version.h" #include "libcef_dll/cpptoc/app_cpptoc.h" #include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" -#include "libcef_dll/cpptoc/completion_handler_cpptoc.h" +#include "libcef_dll/cpptoc/completion_callback_cpptoc.h" #include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h" #include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h" #include "libcef_dll/cpptoc/domevent_listener_cpptoc.h" @@ -176,7 +176,7 @@ CEF_GLOBAL void CefShutdown() { DCHECK_EQ(CefBrowserHostCToCpp::DebugObjCt, 0); DCHECK_EQ(CefBrowserProcessHandlerCppToC::DebugObjCt, 0); DCHECK_EQ(CefCallbackCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefCompletionHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefCompletionCallbackCppToC::DebugObjCt, 0); DCHECK_EQ(CefContextMenuHandlerCppToC::DebugObjCt, 0); DCHECK_EQ(CefContextMenuParamsCToCpp::DebugObjCt, 0); DCHECK_EQ(CefCookieVisitorCppToC::DebugObjCt, 0); @@ -455,27 +455,33 @@ CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId, return _retval?true:false; } -CEF_GLOBAL bool CefBeginTracing(const CefString& categories) { +CEF_GLOBAL bool CefBeginTracing(const CefString& categories, + CefRefPtr callback) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; // Unverified params: categories // Execute int _retval = cef_begin_tracing( - categories.GetStruct()); + categories.GetStruct(), + CefCompletionCallbackCppToC::Wrap(callback)); // Return type: bool return _retval?true:false; } -CEF_GLOBAL bool CefEndTracingAsync(const CefString& tracing_file, +CEF_GLOBAL bool CefEndTracing(const CefString& tracing_file, CefRefPtr callback) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Unverified params: tracing_file, callback // Execute - int _retval = cef_end_tracing_async( + int _retval = cef_end_tracing( tracing_file.GetStruct(), CefEndTracingCallbackCppToC::Wrap(callback)); diff --git a/patch/patch.cfg b/patch/patch.cfg index 292e1d47b..1a1eff1d3 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -15,10 +15,7 @@ patches = [ # Fix Xcode 4 build on OS X Lion. # http://codereview.chromium.org/8086022/ # - # Set use_default_render_theme=0 to use native-styled scrollbars with aura. - # Needs to be set here because setting the value in cef.gypi isn't picked up - # by third_party/WebKit/Source/build/features.gypi. - # https://code.google.com/p/chromiumembedded/issues/detail?id=180 + # Don't use aura on Linux. 'name': 'build', 'path': '../build/', }, @@ -63,32 +60,24 @@ patches = [ 'name': 'views_widget_180', 'path': '../ui/views/widget/', }, - { - # Use native-styled scrollbars with aura on Windows. - # https://code.google.com/p/chromiumembedded/issues/detail?id=180 - 'name': 'native_theme_180', - 'path': '../ui/native_theme/', - }, { # Allow continued use of ContentRendererClient::HandleNavigation. # https://code.google.com/p/chromiumembedded/issues/detail?id=1129 'name': 'content_nav_1129', 'path': '../content/', }, - { - # Fix TracingController to properly track response callbacks when a - # TraceMessageFilter is removed before a response is received from - # the associated subprocess. - # https://code.google.com/p/chromiumembedded/issues/detail?id=1157 - 'name': 'tracing_1157', - 'path': '../content/browser/tracing/', - }, { # Allow customization of the background color on OS X. # http://code.google.com/p/chromiumembedded/issues/detail?id=1161 'name': 'renderer_host_1161', 'path': '../content/browser/renderer_host/', }, + { + # Pass RenderFrameHost to WebContentsDelegate::HandleContextMenu. + # https://codereview.chromium.org/148843003/ + 'name': 'web_contents_304341', + 'path': '../content/', + }, { # Disable scollbar bounce and overlay on OS X. # http://code.google.com/p/chromiumembedded/issues/detail?id=364 diff --git a/patch/patches/build.patch b/patch/patches/build.patch index 4fe682d52..f2dbba046 100644 --- a/patch/patches/build.patch +++ b/patch/patches/build.patch @@ -1,6 +1,6 @@ Index: common.gypi =================================================================== ---- common.gypi (revision 240657) +--- common.gypi (revision 248478) +++ common.gypi (working copy) @@ -9,6 +9,9 @@ # Variables expected to be overriden on the GYP command line (-D) or by @@ -12,18 +12,22 @@ Index: common.gypi # Putting a variables dict inside another variables dict looks kind of # weird. This is done so that 'host_arch', 'chromeos', etc are defined as # variables within the outer variables dict here. This is necessary -@@ -201,7 +204,7 @@ - 'enable_app_list%': 0, - }], +@@ -88,9 +91,9 @@ + # + # TODO(erg): Merge this into the previous block once compiling with + # aura safely implies including ash capabilities. +- ['OS=="linux"', { +- 'use_aura%': 1, +- }], ++ #['OS=="linux"', { ++ # 'use_aura%': 1, ++ #}], -- ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', { -+ ['OS!="win" and OS!="mac" and OS!="ios" and OS!="android"', { - 'use_default_render_theme%': 1, - }, { - 'use_default_render_theme%': 0, + # Whether we're a traditional desktop unix. + ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and chromeos==0', { Index: mac/strip_save_dsym =================================================================== ---- mac/strip_save_dsym (revision 240657) +--- mac/strip_save_dsym (revision 248478) +++ mac/strip_save_dsym (working copy) @@ -48,7 +48,7 @@ "bundle"] diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index 7b6fcf1ce..3a4776770 100644 --- a/patch/patches/content_nav_1129.patch +++ b/patch/patches/content_nav_1129.patch @@ -1,16 +1,16 @@ Index: public/renderer/content_renderer_client.cc =================================================================== ---- public/renderer/content_renderer_client.cc (revision 242756) +--- public/renderer/content_renderer_client.cc (revision 248478) +++ public/renderer/content_renderer_client.cc (working copy) -@@ -91,7 +91,6 @@ +@@ -92,7 +92,6 @@ return false; } -#ifdef OS_ANDROID bool ContentRendererClient::HandleNavigation( - RenderView* view, + RenderFrame* render_frame, DocumentState* document_state, -@@ -103,7 +102,6 @@ +@@ -104,7 +103,6 @@ bool is_redirect) { return false; } @@ -20,9 +20,9 @@ Index: public/renderer/content_renderer_client.cc const GURL& url, Index: public/renderer/content_renderer_client.h =================================================================== ---- public/renderer/content_renderer_client.h (revision 242756) +--- public/renderer/content_renderer_client.h (revision 248478) +++ public/renderer/content_renderer_client.h (working copy) -@@ -172,7 +172,6 @@ +@@ -175,7 +175,6 @@ // Returns true if a popup window should be allowed. virtual bool AllowPopup(); @@ -30,7 +30,7 @@ Index: public/renderer/content_renderer_client.h // TODO(sgurun) This callback is deprecated and will be removed as soon // as android webview completes implementation of a resource throttle based // shouldoverrideurl implementation. See crbug.com/325351 -@@ -187,7 +186,6 @@ +@@ -190,7 +189,6 @@ blink::WebNavigationType type, blink::WebNavigationPolicy default_policy, bool is_redirect); @@ -40,17 +40,17 @@ Index: public/renderer/content_renderer_client.h // If |send_referrer| is set to false (which is the default), no referrer Index: renderer/render_view_impl.cc =================================================================== ---- renderer/render_view_impl.cc (revision 242756) +--- renderer/render_view_impl.cc (revision 248478) +++ renderer/render_view_impl.cc (working copy) -@@ -3124,7 +3124,6 @@ - WebFrame* frame, WebDataSource::ExtraData* extraData, - const WebURLRequest& request, WebNavigationType type, - WebNavigationPolicy default_policy, bool is_redirect) { +@@ -3071,7 +3071,6 @@ + WebDataSource::ExtraData* extraData, const WebURLRequest& request, + WebNavigationType type, WebNavigationPolicy default_policy, + bool is_redirect) { -#ifdef OS_ANDROID // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (request.url() != GURL(kSwappedOutURL) && -@@ -3139,7 +3138,6 @@ +@@ -3086,7 +3085,6 @@ is_redirect)) { return blink::WebNavigationPolicyIgnore; } diff --git a/patch/patches/message_loop_443.patch b/patch/patches/message_loop_443.patch index 5af5d5b03..344e9bd84 100644 --- a/patch/patches/message_loop_443.patch +++ b/patch/patches/message_loop_443.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 237081) +--- message_loop.cc (revision 248478) +++ message_loop.cc (working copy) -@@ -166,7 +166,7 @@ +@@ -142,7 +142,7 @@ MessageLoop::~MessageLoop() { DCHECK_EQ(this, current()); diff --git a/patch/patches/native_theme_180.patch b/patch/patches/native_theme_180.patch deleted file mode 100644 index 6ecf7722d..000000000 --- a/patch/patches/native_theme_180.patch +++ /dev/null @@ -1,34 +0,0 @@ -Index: native_theme_aura.cc -=================================================================== ---- native_theme_aura.cc (revision 237081) -+++ native_theme_aura.cc (working copy) -@@ -17,10 +17,12 @@ - - namespace ui { - -+#if !defined(OS_WIN) - // static - NativeTheme* NativeTheme::instance() { - return NativeThemeAura::instance(); - } -+#endif - - // static - NativeThemeAura* NativeThemeAura::instance() { -Index: native_theme_win.cc -=================================================================== ---- native_theme_win.cc (revision 237081) -+++ native_theme_win.cc (working copy) -@@ -211,12 +211,10 @@ - // TODO(sky): seems like we should default to NativeThemeWin, but that currently - // breaks a couple of tests (FocusTraversalTest.NormalTraversal in - // views_unittests). --#if !defined(USE_AURA) - // static - NativeTheme* NativeTheme::instance() { - return NativeThemeWin::instance(); - } --#endif - - // static - NativeThemeWin* NativeThemeWin::instance() { diff --git a/patch/patches/renderer_host_1161.patch b/patch/patches/renderer_host_1161.patch index b16c3cf59..544ae3d01 100644 --- a/patch/patches/renderer_host_1161.patch +++ b/patch/patches/renderer_host_1161.patch @@ -1,8 +1,21 @@ +Index: compositing_iosurface_layer_mac.mm +=================================================================== +--- compositing_iosurface_layer_mac.mm (revision 248478) ++++ compositing_iosurface_layer_mac.mm (working copy) +@@ -119,7 +119,7 @@ + + if (!context_.get() || !renderWidgetHostView_ || + !renderWidgetHostView_->compositing_iosurface_) { +- glClearColor(1, 1, 1, 1); ++ glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + return; + } Index: compositing_iosurface_mac.mm =================================================================== ---- compositing_iosurface_mac.mm (revision 242756) +--- compositing_iosurface_mac.mm (revision 248478) +++ compositing_iosurface_mac.mm (working copy) -@@ -433,7 +433,7 @@ +@@ -424,7 +424,7 @@ glUseProgram(0); CHECK_AND_SAVE_GL_ERROR(); } else { // Should match the clear color of RenderWidgetHostViewMac. @@ -11,10 +24,9 @@ Index: compositing_iosurface_mac.mm glClear(GL_COLOR_BUFFER_BIT); } - Index: compositing_iosurface_shader_programs_mac.cc =================================================================== ---- compositing_iosurface_shader_programs_mac.cc (revision 242756) +--- compositing_iosurface_shader_programs_mac.cc (revision 248478) +++ compositing_iosurface_shader_programs_mac.cc (working copy) @@ -11,6 +11,7 @@ #include "base/debug/trace_event.h" @@ -49,7 +61,7 @@ Index: compositing_iosurface_shader_programs_mac.cc // Select and compile the shader program source code. if (shader_type == GL_VERTEX_SHADER) { const GLchar* source_snippets[] = { -@@ -414,6 +426,14 @@ +@@ -412,6 +424,14 @@ Reset(); } @@ -66,7 +78,7 @@ Index: compositing_iosurface_shader_programs_mac.cc shader_programs_[which] = Index: compositing_iosurface_shader_programs_mac.h =================================================================== ---- compositing_iosurface_shader_programs_mac.h (revision 242756) +--- compositing_iosurface_shader_programs_mac.h (revision 248478) +++ compositing_iosurface_shader_programs_mac.h (working copy) @@ -48,6 +48,8 @@ return rgb_to_yv12_output_format_; @@ -77,26 +89,11 @@ Index: compositing_iosurface_shader_programs_mac.h protected: FRIEND_TEST_ALL_PREFIXES(CompositingIOSurfaceTransformerTest, TransformsRGBToYV12); - -Index: compositing_iosurface_layer_mac.mm -=================================================================== ---- compositing_iosurface_layer_mac.mm (revision 242756) -+++ compositing_iosurface_layer_mac.mm (working copy) -@@ -89,7 +89,7 @@ - - if (!context_.get() || !renderWidgetHostView_ || - !renderWidgetHostView_->compositing_iosurface_) { -- glClearColor(1, 1, 1, 1); -+ glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - return; - } - Index: render_widget_host_view_mac.mm =================================================================== ---- render_widget_host_view_mac.mm (revision 242756) +--- render_widget_host_view_mac.mm (revision 248478) +++ render_widget_host_view_mac.mm (working copy) -@@ -490,7 +490,7 @@ +@@ -494,7 +494,7 @@ software_layer_.reset([[CALayer alloc] init]); if (!software_layer_) LOG(ERROR) << "Failed to create CALayer for software rendering"; @@ -105,7 +102,7 @@ Index: render_widget_host_view_mac.mm [software_layer_ setDelegate:cocoa_view_]; [software_layer_ setContentsGravity:kCAGravityTopLeft]; [software_layer_ setFrame:NSRectToCGRect([cocoa_view_ bounds])]; -@@ -2737,7 +2737,7 @@ +@@ -2846,7 +2846,7 @@ NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; CGContextSetFillColorWithColor(context, @@ -114,7 +111,7 @@ Index: render_widget_host_view_mac.mm CGContextFillRect(context, NSRectToCGRect(r)); } if (damagedRect.bottom() > rect.bottom()) { -@@ -2759,7 +2759,7 @@ +@@ -2868,7 +2868,7 @@ NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; CGContextSetFillColorWithColor(context, @@ -123,7 +120,7 @@ Index: render_widget_host_view_mac.mm CGContextFillRect(context, NSRectToCGRect(r)); } } -@@ -2918,7 +2918,7 @@ +@@ -3029,7 +3029,7 @@ } } else { CGContextSetFillColorWithColor(context, @@ -132,7 +129,7 @@ Index: render_widget_host_view_mac.mm CGContextFillRect(context, dirtyRect); if (renderWidgetHostView_->whiteout_start_time_.is_null()) renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); -@@ -3925,7 +3925,7 @@ +@@ -4037,7 +4037,7 @@ if (!renderWidgetHostView_->render_widget_host_ || renderWidgetHostView_->render_widget_host_->is_hidden()) { CGContextSetFillColorWithColor(context, @@ -141,4 +138,3 @@ Index: render_widget_host_view_mac.mm CGContextFillRect(context, clipRect); return; } - diff --git a/patch/patches/spi_webcore_364.patch b/patch/patches/spi_webcore_364.patch index cc8e570d7..274747a5c 100644 --- a/patch/patches/spi_webcore_364.patch +++ b/patch/patches/spi_webcore_364.patch @@ -1,8 +1,8 @@ Index: core/frame/FrameView.cpp =================================================================== ---- core/frame/FrameView.cpp (revision 163979) +--- core/frame/FrameView.cpp (revision 166298) +++ core/frame/FrameView.cpp (working copy) -@@ -200,8 +200,10 @@ +@@ -168,8 +168,10 @@ if (!isMainFrame()) return; @@ -13,13 +13,13 @@ Index: core/frame/FrameView.cpp } PassRefPtr FrameView::create(Frame* frame) -Index: platform/mac/NSScrollerImpDetails.mm +Index: platform/scroll/ScrollbarThemeMacCommon.mm =================================================================== ---- platform/mac/NSScrollerImpDetails.mm (revision 163979) -+++ platform/mac/NSScrollerImpDetails.mm (working copy) -@@ -73,10 +73,14 @@ - - bool isScrollbarOverlayAPIAvailable() +--- platform/scroll/ScrollbarThemeMacCommon.mm (revision 166298) ++++ platform/scroll/ScrollbarThemeMacCommon.mm (working copy) +@@ -369,10 +369,14 @@ + // static + bool ScrollbarThemeMacCommon::isOverlayAPIAvailable() { +#if 0 static bool apiAvailable = @@ -31,4 +31,4 @@ Index: platform/mac/NSScrollerImpDetails.mm +#endif } - NSScrollerStyle recommendedScrollerStyle() + } // namespace WebCore diff --git a/patch/patches/tracing_1157.patch b/patch/patches/tracing_1157.patch deleted file mode 100644 index 61d4b6888..000000000 --- a/patch/patches/tracing_1157.patch +++ /dev/null @@ -1,332 +0,0 @@ -Index: trace_message_filter.cc -=================================================================== ---- trace_message_filter.cc (revision 241258) -+++ trace_message_filter.cc (working copy) -@@ -121,7 +121,7 @@ - if (is_awaiting_end_ack_) { - is_awaiting_end_ack_ = false; - TracingControllerImpl::GetInstance()->OnDisableRecordingAcked( -- known_categories); -+ this, known_categories); - } else { - NOTREACHED(); - } -@@ -132,7 +132,8 @@ - // but check in case the child process is compromised. - if (is_awaiting_capture_monitoring_snapshot_ack_) { - is_awaiting_capture_monitoring_snapshot_ack_ = false; -- TracingControllerImpl::GetInstance()->OnCaptureMonitoringSnapshotAcked(); -+ TracingControllerImpl::GetInstance()->OnCaptureMonitoringSnapshotAcked( -+ this); - } else { - NOTREACHED(); - } -@@ -160,7 +161,7 @@ - if (is_awaiting_buffer_percent_full_ack_) { - is_awaiting_buffer_percent_full_ack_ = false; - TracingControllerImpl::GetInstance()->OnTraceBufferPercentFullReply( -- percent_full); -+ this, percent_full); - } else { - NOTREACHED(); - } -Index: tracing_controller_impl.cc -=================================================================== ---- tracing_controller_impl.cc (revision 241258) -+++ tracing_controller_impl.cc (working copy) -@@ -177,7 +177,7 @@ - is_recording_ = true; - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendBeginTracing(category_filter, trace_options); - } -@@ -212,6 +212,7 @@ - // Count myself (local trace) in pending_disable_recording_ack_count_, - // acked below. - pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1; -+ pending_disable_recording_filters_ = trace_message_filters_; - - // Handle special case of zero child processes by immediately flushing the - // trace log. Once the flush has completed the caller will be notified that -@@ -224,7 +225,7 @@ - } - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendEndTracing(); - } -@@ -254,7 +255,7 @@ - static_cast(monitoring_tracing_options)); - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendEnableMonitoring(category_filter, - static_cast(monitoring_tracing_options)); -@@ -276,7 +277,7 @@ - TraceLog::GetInstance()->SetDisabled(); - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendDisableMonitoring(); - } -@@ -311,6 +312,7 @@ - // acked below. - pending_capture_monitoring_snapshot_ack_count_ = - trace_message_filters_.size() + 1; -+ pending_capture_monitoring_filters_ = trace_message_filters_; - - // Handle special case of zero child processes by immediately flushing the - // trace log. Once the flush has completed the caller will be notified that -@@ -323,7 +325,7 @@ - } - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendCaptureMonitoringSnapshot(); - } -@@ -347,6 +349,7 @@ - // Count myself in pending_trace_buffer_percent_full_ack_count_, acked below. - pending_trace_buffer_percent_full_ack_count_ = - trace_message_filters_.size() + 1; -+ pending_trace_buffer_percent_full_filters_ = trace_message_filters_; - maximum_trace_buffer_percent_full_ = 0; - - // Handle special case of zero child processes. -@@ -354,11 +357,12 @@ - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, - base::Unretained(this), -+ scoped_refptr(), - TraceLog::GetInstance()->GetBufferPercentFull())); - } - - // Notify all child processes. -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendGetTraceBufferPercentFull(); - } -@@ -383,7 +387,7 @@ - base::Bind(&TracingControllerImpl::OnWatchEventMatched, - base::Unretained(this))); - -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendSetWatchEvent(category_name, event_name); - } -@@ -396,7 +400,7 @@ - if (!can_cancel_watch_event()) - return false; - -- for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin(); -+ for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendCancelWatchEvent(); - } -@@ -437,15 +441,54 @@ - return; - } - -+ // If a filter is removed while a response from that filter is pending then -+ // simulate the response. Otherwise the response count will be wrong and the -+ // completion callback will never be executed. -+ if (pending_disable_recording_ack_count_ > 0) { -+ TraceMessageFilterSet::const_iterator it = -+ pending_disable_recording_filters_.find(trace_message_filter); -+ if (it != pending_disable_recording_filters_.end()) { -+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, -+ base::Bind(&TracingControllerImpl::OnDisableRecordingAcked, -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter), -+ std::vector())); -+ } -+ } -+ if (pending_capture_monitoring_snapshot_ack_count_ > 0) { -+ TraceMessageFilterSet::const_iterator it = -+ pending_capture_monitoring_filters_.find(trace_message_filter); -+ if (it != pending_capture_monitoring_filters_.end()) { -+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, -+ base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter))); -+ } -+ } -+ if (pending_trace_buffer_percent_full_ack_count_ > 0) { -+ TraceMessageFilterSet::const_iterator it = -+ pending_trace_buffer_percent_full_filters_.find(trace_message_filter); -+ if (it != pending_trace_buffer_percent_full_filters_.end()) { -+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, -+ base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter), -+ 0)); -+ } -+ } -+ - trace_message_filters_.erase(trace_message_filter); - } - - void TracingControllerImpl::OnDisableRecordingAcked( -+ TraceMessageFilter* trace_message_filter, - const std::vector& known_category_groups) { - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnDisableRecordingAcked, -- base::Unretained(this), known_category_groups)); -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter), -+ known_category_groups)); - return; - } - -@@ -456,6 +499,12 @@ - if (pending_disable_recording_ack_count_ == 0) - return; - -+ if (trace_message_filter && -+ !pending_disable_recording_filters_.erase(trace_message_filter)) { -+ // The response from the specified message filter has already been received. -+ return; -+ } -+ - if (--pending_disable_recording_ack_count_ == 1) { - // All acks from subprocesses have been received. Now flush the local trace. - // During or after this call, our OnLocalTraceDataCollected will be -@@ -497,17 +546,25 @@ - result_file_.reset(); - } - --void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked() { -+void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked( -+ TraceMessageFilter* trace_message_filter) { - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, -- base::Unretained(this))); -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter))); - return; - } - - if (pending_capture_monitoring_snapshot_ack_count_ == 0) - return; - -+ if (trace_message_filter && -+ !pending_capture_monitoring_filters_.erase(trace_message_filter)) { -+ // The response from the specified message filter has already been received. -+ return; -+ } -+ - if (--pending_capture_monitoring_snapshot_ack_count_ == 1) { - // All acks from subprocesses have been received. Now flush the local trace. - // During or after this call, our OnLocalMonitoringTraceDataCollected -@@ -582,7 +639,7 @@ - // Simulate an DisableRecordingAcked for the local trace. - std::vector category_groups; - TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups); -- OnDisableRecordingAcked(category_groups); -+ OnDisableRecordingAcked(NULL, category_groups); - } - - void TracingControllerImpl::OnLocalMonitoringTraceDataCollected( -@@ -595,20 +652,30 @@ - return; - - // Simulate an CaptureMonitoringSnapshotAcked for the local trace. -- OnCaptureMonitoringSnapshotAcked(); -+ OnCaptureMonitoringSnapshotAcked(NULL); - } - --void TracingControllerImpl::OnTraceBufferPercentFullReply(float percent_full) { -+void TracingControllerImpl::OnTraceBufferPercentFullReply( -+ TraceMessageFilter* trace_message_filter, -+ float percent_full) { - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, -- base::Unretained(this), percent_full)); -+ base::Unretained(this), -+ make_scoped_refptr(trace_message_filter), -+ percent_full)); - return; - } - - if (pending_trace_buffer_percent_full_ack_count_ == 0) - return; - -+ if (trace_message_filter && -+ !pending_trace_buffer_percent_full_filters_.erase(trace_message_filter)) { -+ // The response from the specified message filter has already been received. -+ return; -+ } -+ - maximum_trace_buffer_percent_full_ = - std::max(maximum_trace_buffer_percent_full_, percent_full); - -@@ -625,6 +692,7 @@ - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, - base::Unretained(this), -+ make_scoped_refptr(trace_message_filter), - TraceLog::GetInstance()->GetBufferPercentFull())); - } - } -Index: tracing_controller_impl.h -=================================================================== ---- tracing_controller_impl.h (revision 241258) -+++ tracing_controller_impl.h (working copy) -@@ -55,7 +55,7 @@ - virtual bool CancelWatchEvent() OVERRIDE; - - private: -- typedef std::set > TraceMessageFilterMap; -+ typedef std::set > TraceMessageFilterSet; - class ResultFile; - - friend struct base::DefaultLazyInstanceTraits; -@@ -107,23 +107,30 @@ - bool has_more_events); - - void OnDisableRecordingAcked( -+ TraceMessageFilter* trace_message_filter, - const std::vector& known_category_groups); - void OnResultFileClosed(); - -- void OnCaptureMonitoringSnapshotAcked(); -+ void OnCaptureMonitoringSnapshotAcked( -+ TraceMessageFilter* trace_message_filter); - void OnMonitoringSnapshotFileClosed(); - -- void OnTraceBufferPercentFullReply(float percent_full); -+ void OnTraceBufferPercentFullReply( -+ TraceMessageFilter* trace_message_filter, -+ float percent_full); - - void OnWatchEventMatched(); - -- TraceMessageFilterMap trace_message_filters_; -+ TraceMessageFilterSet trace_message_filters_; - // Pending acks for DisableRecording. - int pending_disable_recording_ack_count_; -+ TraceMessageFilterSet pending_disable_recording_filters_; - // Pending acks for CaptureMonitoringSnapshot. - int pending_capture_monitoring_snapshot_ack_count_; -+ TraceMessageFilterSet pending_capture_monitoring_filters_; - // Pending acks for GetTraceBufferPercentFull. - int pending_trace_buffer_percent_full_ack_count_; -+ TraceMessageFilterSet pending_trace_buffer_percent_full_filters_; - float maximum_trace_buffer_percent_full_; - - bool is_recording_; diff --git a/patch/patches/underlay_1051.patch b/patch/patches/underlay_1051.patch index 1c837493f..9064c03f9 100644 --- a/patch/patches/underlay_1051.patch +++ b/patch/patches/underlay_1051.patch @@ -1,12 +1,12 @@ Index: underlay_opengl_hosting_window.h =================================================================== ---- underlay_opengl_hosting_window.h (revision 214871) +--- underlay_opengl_hosting_window.h (revision 248478) +++ underlay_opengl_hosting_window.h (working copy) @@ -12,7 +12,7 @@ // Common base class for windows that host a OpenGL surface that renders under // the window. Contains methods relating to hole punching so that the OpenGL // surface is visible through the window. --UI_EXPORT +-UI_BASE_EXPORT +__attribute__((visibility("default"))) @interface UnderlayOpenGLHostingWindow : NSWindow @end diff --git a/patch/patches/views_widget_180.patch b/patch/patches/views_widget_180.patch index 7335324bc..2f66824ba 100644 --- a/patch/patches/views_widget_180.patch +++ b/patch/patches/views_widget_180.patch @@ -1,8 +1,8 @@ Index: desktop_aura/desktop_root_window_host_win.cc =================================================================== ---- desktop_aura/desktop_root_window_host_win.cc (revision 242756) +--- desktop_aura/desktop_root_window_host_win.cc (revision 248478) +++ desktop_aura/desktop_root_window_host_win.cc (working copy) -@@ -131,7 +131,9 @@ +@@ -132,7 +132,9 @@ native_widget_delegate_); HWND parent_hwnd = NULL; @@ -13,9 +13,9 @@ Index: desktop_aura/desktop_root_window_host_win.cc parent_hwnd = params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); } -@@ -752,7 +754,7 @@ +@@ -771,7 +773,7 @@ - void DesktopRootWindowHostWin::HandleCreate() { + void DesktopWindowTreeHostWin::HandleCreate() { // TODO(beng): moar - NOTIMPLEMENTED(); + // NOTIMPLEMENTED(); @@ -24,7 +24,7 @@ Index: desktop_aura/desktop_root_window_host_win.cc Index: desktop_aura/desktop_screen_win.cc =================================================================== ---- desktop_aura/desktop_screen_win.cc (revision 242756) +--- desktop_aura/desktop_screen_win.cc (revision 248478) +++ desktop_aura/desktop_screen_win.cc (working copy) @@ -54,6 +54,8 @@ } @@ -37,7 +37,7 @@ Index: desktop_aura/desktop_screen_win.cc } Index: widget.h =================================================================== ---- widget.h (revision 242756) +--- widget.h (revision 248478) +++ widget.h (working copy) @@ -197,6 +197,7 @@ // Should the widget be double buffered? Default is false. diff --git a/patch/patches/web_contents_304341.patch b/patch/patches/web_contents_304341.patch new file mode 100644 index 000000000..9212d43e3 --- /dev/null +++ b/patch/patches/web_contents_304341.patch @@ -0,0 +1,92 @@ +Index: browser/browser_plugin/browser_plugin_guest.cc +=================================================================== +--- browser/browser_plugin/browser_plugin_guest.cc (revision 248478) ++++ browser/browser_plugin/browser_plugin_guest.cc (working copy) +@@ -785,7 +785,8 @@ + return this; + } + +-bool BrowserPluginGuest::HandleContextMenu(const ContextMenuParams& params) { ++bool BrowserPluginGuest::HandleContextMenu(RenderFrameHost* render_frame_host, ++ const ContextMenuParams& params) { + // TODO(fsamuel): We show the regular page context menu handler for now until + // we implement the Apps Context Menu API for Browser Plugin (see + // http://crbug.com/140315). +Index: browser/browser_plugin/browser_plugin_guest.h +=================================================================== +--- browser/browser_plugin/browser_plugin_guest.h (revision 248478) ++++ browser/browser_plugin/browser_plugin_guest.h (working copy) +@@ -200,7 +200,8 @@ + double progress) OVERRIDE; + virtual void CloseContents(WebContents* source) OVERRIDE; + virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE; +- virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; ++ virtual bool HandleContextMenu(RenderFrameHost* render_frame_host, ++ const ContextMenuParams& params) OVERRIDE; + virtual void HandleKeyboardEvent( + WebContents* source, + const NativeWebKeyboardEvent& event) OVERRIDE; +Index: browser/web_contents/web_contents_impl.cc +=================================================================== +--- browser/web_contents/web_contents_impl.cc (revision 248478) ++++ browser/web_contents/web_contents_impl.cc (working copy) +@@ -2687,7 +2687,7 @@ + void WebContentsImpl::ShowContextMenu(RenderFrameHost* render_frame_host, + const ContextMenuParams& params) { + // Allow WebContentsDelegates to handle the context menu operation first. +- if (delegate_ && delegate_->HandleContextMenu(params)) ++ if (delegate_ && delegate_->HandleContextMenu(render_frame_host, params)) + return; + + render_view_host_delegate_view_->ShowContextMenu(render_frame_host, params); +Index: browser/web_contents/web_contents_view_mac.mm +=================================================================== +--- browser/web_contents/web_contents_view_mac.mm (revision 248478) ++++ browser/web_contents/web_contents_view_mac.mm (working copy) +@@ -233,12 +233,6 @@ + void WebContentsViewMac::ShowContextMenu( + content::RenderFrameHost* render_frame_host, + const ContextMenuParams& params) { +- // Allow delegates to handle the context menu operation first. +- if (web_contents_->GetDelegate() && +- web_contents_->GetDelegate()->HandleContextMenu(params)) { +- return; +- } +- + if (delegate()) + delegate()->ShowContextMenu(render_frame_host, params); + else +Index: public/browser/web_contents_delegate.cc +=================================================================== +--- public/browser/web_contents_delegate.cc (revision 248478) ++++ public/browser/web_contents_delegate.cc (working copy) +@@ -76,6 +76,7 @@ + } + + bool WebContentsDelegate::HandleContextMenu( ++ RenderFrameHost* render_frame_host, + const content::ContextMenuParams& params) { + return false; + } +Index: public/browser/web_contents_delegate.h +=================================================================== +--- public/browser/web_contents_delegate.h (revision 248478) ++++ public/browser/web_contents_delegate.h (working copy) +@@ -35,6 +35,7 @@ + class DownloadItem; + class JavaScriptDialogManager; + class PageState; ++class RenderFrameHost; + class RenderViewHost; + class SessionStorageNamespace; + class WebContents; +@@ -228,7 +229,8 @@ + virtual int GetExtraRenderViewHeight() const; + + // Returns true if the context menu operation was handled by the delegate. +- virtual bool HandleContextMenu(const content::ContextMenuParams& params); ++ virtual bool HandleContextMenu(RenderFrameHost* render_frame_host, ++ const content::ContextMenuParams& params); + + // Opens source view for given WebContents that is navigated to the given + // page url. diff --git a/patch/patches/webkit_933.patch b/patch/patches/webkit_933.patch index 8f5271f1b..bdcfcb527 100644 --- a/patch/patches/webkit_933.patch +++ b/patch/patches/webkit_933.patch @@ -1,8 +1,8 @@ Index: WebNode.cpp =================================================================== ---- WebNode.cpp (revision 160715) +--- WebNode.cpp (revision 166298) +++ WebNode.cpp (working copy) -@@ -169,7 +169,7 @@ +@@ -171,7 +171,7 @@ void WebNode::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { // Please do not add more eventTypes to this list without an API review. diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 4b0e58080..aaca50052 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,6 +1,6 @@ Index: public/web/WebView.h =================================================================== ---- public/web/WebView.h (revision 164381) +--- public/web/WebView.h (revision 166298) +++ public/web/WebView.h (working copy) @@ -417,6 +417,7 @@ @@ -12,9 +12,9 @@ Index: public/web/WebView.h virtual void hidePopups() = 0; Index: Source/web/ChromeClientImpl.cpp =================================================================== ---- Source/web/ChromeClientImpl.cpp (revision 164381) +--- Source/web/ChromeClientImpl.cpp (revision 166298) +++ Source/web/ChromeClientImpl.cpp (working copy) -@@ -851,7 +851,7 @@ +@@ -828,7 +828,7 @@ PassRefPtr ChromeClientImpl::createPopupMenu(Frame& frame, PopupMenuClient* client) const { @@ -25,9 +25,9 @@ Index: Source/web/ChromeClientImpl.cpp return adoptRef(new PopupMenuChromium(frame, client)); Index: Source/web/WebViewImpl.cpp =================================================================== ---- Source/web/WebViewImpl.cpp (revision 164381) +--- Source/web/WebViewImpl.cpp (revision 166298) +++ Source/web/WebViewImpl.cpp (working copy) -@@ -348,6 +348,7 @@ +@@ -340,6 +340,7 @@ , m_fakePageScaleAnimationPageScaleFactor(0) , m_fakePageScaleAnimationUseAnchor(false) , m_contextMenuAllowed(false) @@ -35,7 +35,7 @@ Index: Source/web/WebViewImpl.cpp , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) , m_compositorDeviceScaleFactorOverride(0) -@@ -3552,9 +3553,14 @@ +@@ -3517,9 +3518,14 @@ updateLayerTreeViewport(); } @@ -53,9 +53,9 @@ Index: Source/web/WebViewImpl.cpp void WebViewImpl::startDragging(Frame* frame, Index: Source/web/WebViewImpl.h =================================================================== ---- Source/web/WebViewImpl.h (revision 164381) +--- Source/web/WebViewImpl.h (revision 166298) +++ Source/web/WebViewImpl.h (working copy) -@@ -398,7 +398,8 @@ +@@ -397,7 +397,8 @@ // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -65,7 +65,7 @@ Index: Source/web/WebViewImpl.h bool contextMenuAllowed() const { -@@ -680,6 +681,8 @@ +@@ -683,6 +684,8 @@ bool m_contextMenuAllowed; diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp index 855a30d70..1f4e37b52 100644 --- a/tests/cefclient/cefclient.cpp +++ b/tests/cefclient/cefclient.cpp @@ -62,6 +62,9 @@ void AppGetSettings(CefSettings& settings) { CefString(&settings.cache_path) = g_command_line->GetSwitchValue(cefclient::kCachePath); + + if (g_command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled)) + settings.windowless_rendering_enabled = true; } bool AppIsOffScreenRenderingEnabled() { diff --git a/tests/cefclient/cefclient_gtk.cpp b/tests/cefclient/cefclient_gtk.cpp index e45fca952..47bc608c1 100644 --- a/tests/cefclient/cefclient_gtk.cpp +++ b/tests/cefclient/cefclient_gtk.cpp @@ -360,8 +360,7 @@ int main(int argc, char* argv[]) { CefRefPtr osr_window = OSRWindow::Create(&g_main_browser_provider, transparent, vbox); - window_info.SetAsOffScreen(osr_window->GetWindowHandle()); - window_info.SetTransparentPainting(transparent); + window_info.SetAsWindowless(osr_window->GetWindowHandle(), transparent); g_handler->SetOSRHandler(osr_window.get()); } else { window_info.SetAsChild(vbox); diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index 37d04a6f5..ddec9b35a 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -355,8 +355,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { CefRefPtr osr_window = OSRWindow::Create(&g_main_browser_provider, transparent, contentView, CefRect(0, 0, kWindowWidth, kWindowHeight)); - window_info.SetAsOffScreen(osr_window->GetWindowHandle()); - window_info.SetTransparentPainting(transparent); + window_info.SetAsWindowless(osr_window->GetWindowHandle(), transparent); g_handler->SetOSRHandler(osr_window->GetRenderHandler().get()); } else { // Initialize window info to the defaults for a child window. diff --git a/tests/cefclient/cefclient_win.cpp b/tests/cefclient/cefclient_win.cpp index 0efce4c5f..5320244e2 100644 --- a/tests/cefclient/cefclient_win.cpp +++ b/tests/cefclient/cefclient_win.cpp @@ -394,8 +394,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, CefRefPtr osr_window = OSRWindow::Create(&g_main_browser_provider, transparent); osr_window->CreateWidget(hWnd, rect, hInst, szOSRWindowClass); - info.SetAsOffScreen(osr_window->hwnd()); - info.SetTransparentPainting(transparent ? TRUE : FALSE); + info.SetAsWindowless(osr_window->hwnd(), transparent); g_handler->SetOSRHandler(osr_window.get()); } else { // Initialize window info to the defaults for a child window. diff --git a/tests/cefclient/client_handler.cpp b/tests/cefclient/client_handler.cpp index 4cded3396..15a56aa53 100644 --- a/tests/cefclient/client_handler.cpp +++ b/tests/cefclient/client_handler.cpp @@ -644,7 +644,7 @@ void ClientHandler::CloseDevTools(CefRefPtr browser) { void ClientHandler::BeginTracing() { if (CefCurrentlyOn(TID_UI)) { - CefBeginTracing(CefString()); + CefBeginTracing(CefString(), NULL); } else { CefPostTask(TID_UI, NewCefRunnableMethod(this, &ClientHandler::BeginTracing)); @@ -678,10 +678,10 @@ void ClientHandler::EndTracing() { const std::vector& file_paths) OVERRIDE { if (!file_paths.empty()) { // File selected. Results in a call to OnEndTracingComplete. - CefEndTracingAsync(file_paths.front(), this); + CefEndTracing(file_paths.front(), this); } else { // No file selected. Discard the trace data. - CefEndTracingAsync(CefString(), NULL); + CefEndTracing(CefString(), NULL); } } diff --git a/tests/unittests/cookie_unittest.cc b/tests/unittests/cookie_unittest.cc index 0441f98c1..16cd0b252 100644 --- a/tests/unittests/cookie_unittest.cc +++ b/tests/unittests/cookie_unittest.cc @@ -574,9 +574,9 @@ TEST(CookieTest, ChangeDirectoryCreated) { namespace { -class TestCompletionHandler : public CefCompletionHandler { +class TestCompletionCallback : public CefCompletionCallback { public: - explicit TestCompletionHandler(base::WaitableEvent* event) + explicit TestCompletionCallback(base::WaitableEvent* event) : event_(event) {} virtual void OnComplete() OVERRIDE { @@ -586,7 +586,7 @@ class TestCompletionHandler : public CefCompletionHandler { private: base::WaitableEvent* event_; - IMPLEMENT_REFCOUNTING(TestCompletionHandler); + IMPLEMENT_REFCOUNTING(TestCompletionCallback); }; } // namespace @@ -610,7 +610,7 @@ TEST(CookieTest, SessionCookieNoPersist) { GetCookie(manager, cookie, true, event, false); // Flush the cookie store to disk. - manager->FlushStore(new TestCompletionHandler(&event)); + manager->FlushStore(new TestCompletionCallback(&event)); event.Wait(); // Create a new manager to read the same cookie store. @@ -640,7 +640,7 @@ TEST(CookieTest, SessionCookieWillPersist) { GetCookie(manager, cookie, true, event, false); // Flush the cookie store to disk. - manager->FlushStore(new TestCompletionHandler(&event)); + manager->FlushStore(new TestCompletionCallback(&event)); event.Wait(); // Create a new manager to read the same cookie store. diff --git a/tests/unittests/os_rendering_unittest.cc b/tests/unittests/os_rendering_unittest.cc index 276a5996d..0b8ac7996 100644 --- a/tests/unittests/os_rendering_unittest.cc +++ b/tests/unittests/os_rendering_unittest.cc @@ -826,22 +826,23 @@ class OSRTestHandler : public RoutingTestHandler, void CreateOSRBrowser(const CefString& url) { CefWindowInfo windowInfo; CefBrowserSettings settings; + + const bool transparent = (test_type_ == OSR_TEST_TRANSPARENCY); + #if defined(OS_WIN) - windowInfo.SetAsOffScreen(GetDesktopWindow()); + windowInfo.SetAsWindowless(GetDesktopWindow(), transparent); #elif defined(OS_MACOSX) // An actual vies is needed only for the ContextMenu test. The menu runner // checks if the view is not nil before showing the context menu. if (test_type_ == OSR_TEST_CONTEXT_MENU) - windowInfo.SetAsOffScreen(osr_unittests::GetFakeView()); + windowInfo.SetAsWindowless(osr_unittests::GetFakeView(), transparent); else - windowInfo.SetAsOffScreen(NULL); + windowInfo.SetAsWindowless(NULL, transparent); #elif defined(OS_LINUX) - windowInfo.SetAsOffScreen(NULL); + windowInfo.SetAsWindowless(NULL, transparent); #else #error "Unsupported platform" #endif - if (test_type_ == OSR_TEST_TRANSPARENCY) - windowInfo.SetTransparentPainting(TRUE); CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL); } diff --git a/tests/unittests/test_handler.h b/tests/unittests/test_handler.h index 8034144cf..fa4fc008e 100644 --- a/tests/unittests/test_handler.h +++ b/tests/unittests/test_handler.h @@ -245,6 +245,7 @@ bool TestFailed(); #define EXPECT_UI_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_UI)); #define EXPECT_IO_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_IO)); +#define EXPECT_FILE_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); #define EXPECT_RENDERER_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_RENDERER)); #endif // CEF_TESTS_UNITTESTS_TEST_HANDLER_H_ diff --git a/tests/unittests/test_suite.cc b/tests/unittests/test_suite.cc index 6d4448c4f..7b3b4ab49 100644 --- a/tests/unittests/test_suite.cc +++ b/tests/unittests/test_suite.cc @@ -61,6 +61,9 @@ void CefTestSuite::GetSettings(CefSettings& settings) { // Necessary for V8Test.OnUncaughtException tests. settings.uncaught_exception_stack_size = 10; + + // Necessary for the OSRTest tests. + settings.windowless_rendering_enabled = true; } // static diff --git a/tests/unittests/tracing_unittest.cc b/tests/unittests/tracing_unittest.cc index 32a9de438..2848e50c2 100644 --- a/tests/unittests/tracing_unittest.cc +++ b/tests/unittests/tracing_unittest.cc @@ -65,7 +65,8 @@ enum TracingTestType { const char kTraceTestCategory[] = "test_category"; -class TracingTestHandler : public CefEndTracingCallback { +class TracingTestHandler : public CefEndTracingCallback, + public CefCompletionCallback { public: TracingTestHandler(TracingTestType type, const char* trace_type) : completion_event_(true, false), @@ -74,7 +75,7 @@ class TracingTestHandler : public CefEndTracingCallback { } void ReadTracingFile(const base::FilePath& file_path) { - EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); + EXPECT_FILE_THREAD(); base::ReadFileToString(file_path, &trace_data_); base::DeleteFile(file_path, false); @@ -84,7 +85,7 @@ class TracingTestHandler : public CefEndTracingCallback { // CefEndTracingCallback method: virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE { - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); + EXPECT_UI_THREAD(); base::FilePath file_path(tracing_file); CefPostTask(TID_FILE, @@ -93,9 +94,14 @@ class TracingTestHandler : public CefEndTracingCallback { } void RunTracing() { - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); + EXPECT_UI_THREAD(); - CefBeginTracing(kTraceTestCategory); + // Results in a call to OnComplete. + CefBeginTracing(kTraceTestCategory, this); + } + + virtual void OnComplete() OVERRIDE { + EXPECT_UI_THREAD(); switch (type_) { case CEF_TRACE_EVENT0: { @@ -313,7 +319,7 @@ class TracingTestHandler : public CefEndTracingCallback { } // Results in a call to OnEndTracingComplete. - CefEndTracingAsync(CefString(), this); + CefEndTracing(CefString(), this); } void ExecuteTest() { diff --git a/tools/check_style.bat b/tools/check_style.bat index 43612cf91..8bd86b20c 100644 --- a/tools/check_style.bat +++ b/tools/check_style.bat @@ -1,2 +1,2 @@ @echo off -..\..\third_party\python_26\python.exe check_style.py %* +python.bat check_style.py %* diff --git a/tools/distrib/cefclient.gyp b/tools/distrib/cefclient.gyp index e549f9b71..f8f040bb3 100644 --- a/tools/distrib/cefclient.gyp +++ b/tools/distrib/cefclient.gyp @@ -221,6 +221,7 @@ 'files': [ 'Resources/cef.pak', 'Resources/devtools_resources.pak', + 'Resources/icudtl.dat', 'Resources/locales/', '$(BUILDTYPE)/chrome-sandbox', '$(BUILDTYPE)/libcef.so', @@ -433,6 +434,7 @@ 'files': [ 'Resources/cef.pak', 'Resources/devtools_resources.pak', + 'Resources/icudtl.dat', 'Resources/locales/', '$(BUILDTYPE)/chrome-sandbox', '$(BUILDTYPE)/libcef.so', diff --git a/tools/distrib/linux/README.redistrib.txt b/tools/distrib/linux/README.redistrib.txt index dedadf2b8..f1690c466 100644 --- a/tools/distrib/linux/README.redistrib.txt +++ b/tools/distrib/linux/README.redistrib.txt @@ -11,6 +11,9 @@ Required components: * CEF core library libcef.so +* Unicode support + icudtl.dat + Optional components: * Localized resources diff --git a/tools/distrib/mac/README.redistrib.txt b/tools/distrib/mac/README.redistrib.txt index f413f9703..ff15436d9 100644 --- a/tools/distrib/mac/README.redistrib.txt +++ b/tools/distrib/mac/README.redistrib.txt @@ -19,6 +19,7 @@ cefclient.app/ Resources/ cef.pak, devtools_resources.pak <= non-localized resources and strings crash_inspector, crash_report_sender <= breakpad support + icudtl.dat <= unicode support en.lproj/, ... <= locale-specific resources and strings Info.plist libplugin_carbon_interpose.dylib <= plugin support library @@ -68,6 +69,9 @@ Required components: * CEF framework library Chromium Embedded Framework.framework/Chromium Embedded Framework +* Unicode support + Chromium Embedded Framework.framework/Resources/icudtl.dat + * Plugin support library libplugin_carbon_interpose.dylib diff --git a/tools/distrib/win/README.redistrib.txt b/tools/distrib/win/README.redistrib.txt index a2583bf3e..9a97610e8 100644 --- a/tools/distrib/win/README.redistrib.txt +++ b/tools/distrib/win/README.redistrib.txt @@ -12,7 +12,7 @@ Required components: libcef.dll * Unicode support - icudt.dll + icudtl.dat Optional components: diff --git a/tools/make_distrib.bat b/tools/make_distrib.bat index b6663905d..c92dc7a46 100644 --- a/tools/make_distrib.bat +++ b/tools/make_distrib.bat @@ -1,2 +1,2 @@ @echo off -..\..\third_party\python_26\python.exe make_distrib.py --output-dir ..\binary_distrib\ %* +python.bat make_distrib.py --output-dir ..\binary_distrib\ %* diff --git a/tools/make_distrib.py b/tools/make_distrib.py index db187b17e..d969ea494 100644 --- a/tools/make_distrib.py +++ b/tools/make_distrib.py @@ -490,6 +490,14 @@ if mode == 'standard': output_dir, options.quiet) if platform == 'windows': + binaries = [ + 'd3dcompiler_46.dll', + 'ffmpegsumo.dll', + 'libcef.dll', + 'libEGL.dll', + 'libGLESv2.dll', + ] + if options.ninjabuild: out_dir = os.path.join(src_dir, 'out') libcef_dll_file = 'libcef.dll.lib' @@ -525,7 +533,8 @@ if platform == 'windows': dst_dir = os.path.join(output_dir, 'Debug') make_dir(dst_dir, options.quiet) copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) - copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet) + for binary in binaries: + copy_file(os.path.join(build_dir, binary), os.path.join(dst_dir, binary), options.quiet) copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \ options.quiet) combine_libs(build_dir, sandbox_libs, os.path.join(dst_dir, 'cef_sandbox.lib')); @@ -545,7 +554,8 @@ if platform == 'windows': dst_dir = os.path.join(output_dir, 'Release') make_dir(dst_dir, options.quiet) copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) - copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet) + for binary in binaries: + copy_file(os.path.join(build_dir, binary), os.path.join(dst_dir, binary), options.quiet) if mode != 'client': copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \ @@ -572,6 +582,7 @@ if platform == 'windows': make_dir(dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'icudtl.dat'), dst_dir, options.quiet) copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) if mode == 'standard': @@ -735,6 +746,7 @@ elif platform == 'linux': make_dir(dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'icudtl.dat'), dst_dir, options.quiet) copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) if mode == 'standard': diff --git a/tools/make_version_header.bat b/tools/make_version_header.bat index c143163a5..86e3094f8 100644 --- a/tools/make_version_header.bat +++ b/tools/make_version_header.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_26\python.exe tools\make_version_header.py --header include\cef_version.h --cef_version VERSION --chrome_version ../chrome/VERSION --cpp_header_dir include +python.bat tools\make_version_header.py --header include\cef_version.h --cef_version VERSION --chrome_version ../chrome/VERSION --cpp_header_dir include diff --git a/tools/patch.bat b/tools/patch.bat index b21981a0d..0b68f6193 100644 --- a/tools/patch.bat +++ b/tools/patch.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_26\python.exe tools\patcher.py --patch-config patch/patch.cfg \ No newline at end of file +python.bat tools\patcher.py --patch-config patch/patch.cfg \ No newline at end of file diff --git a/tools/translator.bat b/tools/translator.bat index 44b80f385..4e5d7727f 100644 --- a/tools/translator.bat +++ b/tools/translator.bat @@ -1,3 +1,3 @@ @echo off -..\..\third_party\python_26\python.exe translator.py --cpp-header-dir ..\include --capi-header-dir ..\include\capi --cpptoc-global-impl ..\libcef_dll\libcef_dll.cc --ctocpp-global-impl ..\libcef_dll\wrapper\libcef_dll_wrapper.cc --cpptoc-dir ..\libcef_dll\cpptoc --ctocpp-dir ..\libcef_dll\ctocpp --gypi-file ..\cef_paths.gypi +call python.bat translator.py --cpp-header-dir ..\include --capi-header-dir ..\include\capi --cpptoc-global-impl ..\libcef_dll\libcef_dll.cc --ctocpp-global-impl ..\libcef_dll\wrapper\libcef_dll_wrapper.cc --cpptoc-dir ..\libcef_dll\cpptoc --ctocpp-dir ..\libcef_dll\ctocpp --gypi-file ..\cef_paths.gypi pause \ No newline at end of file