diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 9324c407a..1f6beaeef 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': '149431', + 'chromium_revision': '153668', } diff --git a/cef.gyp b/cef.gyp index 0488a804b..125f9802a 100644 --- a/cef.gyp +++ b/cef.gyp @@ -159,7 +159,7 @@ # Modify the Info.plist as needed. 'postbuild_name': 'Tweak Info.plist', 'action': ['../build/mac/tweak_info_plist.py', - '--svn=1'], + '--scm=1'], }, { # This postbuid step is responsible for creating the following @@ -337,7 +337,7 @@ # Modify the Info.plist as needed. 'postbuild_name': 'Tweak Info.plist', 'action': ['../build/mac/tweak_info_plist.py', - '--svn=1'], + '--scm=1'], }, { # This postbuid step is responsible for creating the following @@ -932,6 +932,7 @@ '<@(includes_linux)', 'libcef/browser/browser_host_impl_gtk.cc', 'libcef/browser/browser_main_gtk.cc', + 'libcef/browser/download_manager_delegate_gtk.cc', 'libcef/browser/gtk_util_stub.cc', 'libcef/browser/javascript_dialog_gtk.cc', 'libcef/browser/menu_creator_runner_gtk.cc', @@ -1024,14 +1025,14 @@ { # Modify the Info.plist as needed. The script explains why this # is needed. This is also done in the chrome and chrome_dll - # targets. In this case, --breakpad=0, --keystone=0, and --svn=0 - # are used because Breakpad, Keystone, and Subversion keys are + # targets. In this case, --breakpad=0, --keystone=0, and --scm=0 + # are used because Breakpad, Keystone, and SCM keys are # never placed into the helper. 'postbuild_name': 'Tweak Info.plist', 'action': ['../build/mac/tweak_info_plist.py', '--breakpad=0', '--keystone=0', - '--svn=0'], + '--scm=0'], }, ], }, # target cefclient_helper_app @@ -1113,14 +1114,14 @@ { # Modify the Info.plist as needed. The script explains why this # is needed. This is also done in the chrome and chrome_dll - # targets. In this case, --breakpad=0, --keystone=0, and --svn=0 - # are used because Breakpad, Keystone, and Subversion keys are + # targets. In this case, --breakpad=0, --keystone=0, and --scm=0 + # are used because Breakpad, Keystone, and SCM keys are # never placed into the helper. 'postbuild_name': 'Tweak Info.plist', 'action': ['../build/mac/tweak_info_plist.py', '--breakpad=0', '--keystone=0', - '--svn=0'], + '--scm=0'], }, ], }, # target cef_unittests_helper_app diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index 10ba46f24..626915390 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -114,7 +114,9 @@ typedef struct _cef_browser_t { /// int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self); + /// // Returns true (1) if a document has been loaded in the browser. + /// int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self); /// diff --git a/include/capi/cef_menu_model_capi.h b/include/capi/cef_menu_model_capi.h index 6a4179998..9f8dda857 100644 --- a/include/capi/cef_menu_model_capi.h +++ b/include/capi/cef_menu_model_capi.h @@ -70,7 +70,8 @@ typedef struct _cef_menu_model_t { // // Add a separator to the menu. Returns true (1) on success. /// - int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self); + int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self, + enum cef_menu_separator_type_t type); // // Add an item to the menu. Returns true (1) on success. @@ -103,7 +104,7 @@ typedef struct _cef_menu_model_t { // on success. /// int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self, - int index); + int index, enum cef_menu_separator_type_t type); // // Insert an item in the menu at the specified |index|. Returns true (1) on @@ -205,6 +206,12 @@ typedef struct _cef_menu_model_t { enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)( struct _cef_menu_model_t* self, int index); + /// + // Returns the separator type at the specified |index|. + /// + enum cef_menu_separator_type_t (CEF_CALLBACK *get_separator_type_at)( + struct _cef_menu_model_t* self, int index); + /// // Returns the group id for the specified |command_id| or -1 if invalid. /// diff --git a/include/capi/cef_v8_capi.h b/include/capi/cef_v8_capi.h index a9cacc1f9..03dc58661 100644 --- a/include/capi/cef_v8_capi.h +++ b/include/capi/cef_v8_capi.h @@ -308,7 +308,7 @@ typedef struct _cef_v8exception_t { /// // Structure representing a V8 value. The functions of this structure may only -// be called on the UI thread. +// be called on the render process main thread. /// typedef struct _cef_v8value_t { /// diff --git a/include/cef_menu_model.h b/include/cef_menu_model.h index 84728c58b..8b9bcc8dd 100644 --- a/include/cef_menu_model.h +++ b/include/cef_menu_model.h @@ -50,6 +50,7 @@ class CefMenuModel : public virtual CefBase { public: typedef cef_menu_item_type_t MenuItemType; + typedef cef_menu_separator_type_t MenuSeparatorType; /// // Clears the menu. Returns true on success. @@ -67,7 +68,7 @@ class CefMenuModel : public virtual CefBase { // Add a separator to the menu. Returns true on success. /// /*--cef()--*/ - virtual bool AddSeparator() =0; + virtual bool AddSeparator(MenuSeparatorType type) =0; // // Add an item to the menu. Returns true on success. @@ -103,7 +104,7 @@ class CefMenuModel : public virtual CefBase { // success. /// /*--cef()--*/ - virtual bool InsertSeparatorAt(int index) =0; + virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) =0; // // Insert an item in the menu at the specified |index|. Returns true on @@ -212,6 +213,12 @@ class CefMenuModel : public virtual CefBase { /*--cef(default_retval=MENUITEMTYPE_NONE)--*/ virtual MenuItemType GetTypeAt(int index) =0; + /// + // Returns the separator type at the specified |index|. + /// + /*--cef(default_retval=MENUSEPARATORTYPE_NONE)--*/ + virtual MenuSeparatorType GetSeparatorTypeAt(int index) =0; + /// // Returns the group id for the specified |command_id| or -1 if invalid. /// diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 0d6cea0ff..d1c97435b 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -984,6 +984,33 @@ enum cef_menu_item_type_t { MENUITEMTYPE_SUBMENU, }; +/// +// Supported menu separator types. +/// +enum cef_menu_separator_type_t { + MENUSEPARATORTYPE_NONE, + + /// + // Normal - top to bottom: Spacing, line, spacing + /// + MENUSEPARATORTYPE_NORMAL, + + /// + // Upper - top to bottom: Line, spacing + /// + MENUSEPARATORTYPE_UPPER, + + /// + // Lower - top to bottom: Spacing, line + /// + MENUSEPARATORTYPE_LOWER, + + /// + // Spacing - top to bottom: Spacing only. + /// + MENUSEPARATORTYPE_SPACING, +}; + /// // Supported context menu type flags. /// diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index 56e53d58e..dfb9ba173 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -223,7 +223,13 @@ net::URLRequestContextGetter* } net::URLRequestContextGetter* - CefBrowserContext::GetRequestContextForMedia() { + CefBrowserContext::GetMediaRequestContext() { + return GetRequestContext(); +} + +net::URLRequestContextGetter* + CefBrowserContext::GetMediaRequestContextForRenderProcess( + int renderer_child_id) { return GetRequestContext(); } diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index 771f59fea..c8aeb0f86 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -32,7 +32,9 @@ class CefBrowserContext : public content::BrowserContext { virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; - virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE; + virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; + virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( + int renderer_child_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 048f5671d..ae7417071 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -181,7 +181,6 @@ CefRefPtr CefBrowserHostImpl::Create( _Context->browser_context(), NULL, MSG_ROUTING_NONE, - NULL, NULL); } @@ -909,7 +908,8 @@ void CefBrowserHostImpl::CloseContents(content::WebContents* source) { PlatformCloseWindow(); } -bool CefBrowserHostImpl::TakeFocus(bool reverse) { +bool CefBrowserHostImpl::TakeFocus(content::WebContents* source, + bool reverse) { if (client_.get()) { CefRefPtr handler = client_->GetFocusHandler(); if (handler.get()) @@ -935,6 +935,7 @@ bool CefBrowserHostImpl::HandleContextMenu( } bool CefBrowserHostImpl::PreHandleKeyboardEvent( + content::WebContents* source, const content::NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { if (client_.get()) { @@ -961,6 +962,7 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent( } void CefBrowserHostImpl::HandleKeyboardEvent( + content::WebContents* source, const content::NativeWebKeyboardEvent& event) { // Check to see if event should be ignored. if (event.skip_in_browser) diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 08fe6ca58..1a36c0c9a 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -205,14 +205,17 @@ class CefBrowserHostImpl : public CefBrowserHost, const content::OpenURLParams& params) OVERRIDE; virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; - virtual bool TakeFocus(bool reverse) OVERRIDE; + 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 PreHandleKeyboardEvent( + content::WebContents* source, const content::NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( + content::WebContents* source, const content::NativeWebKeyboardEvent& event) OVERRIDE; virtual bool ShouldCreateWebContents( content::WebContents* web_contents, diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc index a34ca6132..b4052fbb1 100644 --- a/libcef/browser/download_manager_delegate.cc +++ b/libcef/browser/download_manager_delegate.cc @@ -137,7 +137,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { FilePath result; if (show_dialog) { -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(OS_WIN) || defined(OS_MACOSX) || defined(TOOLKIT_GTK) WebContents* web_contents = item->GetWebContents(); result = CefDownloadManagerDelegate::PlatformChooseDownloadPath( web_contents, suggested_path); diff --git a/libcef/browser/download_manager_delegate_gtk.cc b/libcef/browser/download_manager_delegate_gtk.cc new file mode 100644 index 000000000..dbc7df9c7 --- /dev/null +++ b/libcef/browser/download_manager_delegate_gtk.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 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/download_manager_delegate.h" + +#include + +#include "base/string_util.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_view.h" + +// static +FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath( + content::WebContents* web_contents, + const FilePath& suggested_path) { + FilePath result; + + gfx::NativeWindow parent_window = + web_contents->GetView()->GetTopLevelNativeWindow(); + std::string base_name = suggested_path.BaseName().value(); + + GtkWidget* dialog = gtk_file_chooser_dialog_new( + "Save File", + parent_window, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), + TRUE); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), + base_name.c_str()); + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + result = FilePath(filename); + } + gtk_widget_destroy(dialog); + + return result; +} diff --git a/libcef/browser/menu_creator.cc b/libcef/browser/menu_creator.cc index 3bcf2a352..94b0e5a2e 100644 --- a/libcef/browser/menu_creator.cc +++ b/libcef/browser/menu_creator.cc @@ -206,13 +206,13 @@ void CefMenuCreator::CreateDefaultModel() { model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO)); model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO)); - model_->AddSeparator(); + model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT)); model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE)); model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE)); - model_->AddSeparator(); + model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL)); if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO)) @@ -237,7 +237,7 @@ void CefMenuCreator::CreateDefaultModel() { model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK)); model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD)); - model_->AddSeparator(); + model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT)); model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE)); diff --git a/libcef/browser/menu_model_impl.cc b/libcef/browser/menu_model_impl.cc index 10065197a..03acc65d0 100644 --- a/libcef/browser/menu_model_impl.cc +++ b/libcef/browser/menu_model_impl.cc @@ -56,6 +56,10 @@ class CefSimpleMenuModel : public ui::MenuModel { } } + virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE { + return ui::NORMAL_SEPARATOR; + } + virtual int GetCommandIdAt(int index) const OVERRIDE { return impl_->GetCommandIdAt(index); } @@ -99,7 +103,7 @@ class CefSimpleMenuModel : public ui::MenuModel { return impl_->GetGroupIdAt(index); } - virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE { + virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE { return false; } @@ -163,6 +167,7 @@ struct CefMenuModelImpl::Item { const CefString& label, int group_id) : type_(type), + separator_type_(MENUSEPARATORTYPE_NONE), command_id_(command_id), label_(label), group_id_(group_id), @@ -178,6 +183,7 @@ struct CefMenuModelImpl::Item { // Basic information. cef_menu_item_type_t type_; + cef_menu_separator_type_t separator_type_; int command_id_; CefString label_; int group_id_; @@ -221,11 +227,17 @@ int CefMenuModelImpl::GetCount() { return static_cast(items_.size()); } -bool CefMenuModelImpl::AddSeparator() { +bool CefMenuModelImpl::AddSeparator(MenuSeparatorType type) { if (!VerifyContext()) return false; - AppendItem(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1)); + DCHECK(type != MENUSEPARATORTYPE_NONE); + if (type == MENUSEPARATORTYPE_NONE) + return false; + + Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1); + item.separator_type_ = type; + AppendItem(item); return true; } @@ -265,12 +277,17 @@ CefRefPtr CefMenuModelImpl::AddSubMenu(int command_id, return item.submenu_.get(); } -bool CefMenuModelImpl::InsertSeparatorAt(int index) { +bool CefMenuModelImpl::InsertSeparatorAt(int index, MenuSeparatorType type) { if (!VerifyContext()) return false; - InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1), - index); + DCHECK(type != MENUSEPARATORTYPE_NONE); + if (type == MENUSEPARATORTYPE_NONE) + return false; + + Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1); + item.separator_type_ = type; + InsertItemAt(item, index); return true; } @@ -400,6 +417,16 @@ CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) { return MENUITEMTYPE_NONE; } +CefMenuModelImpl::MenuSeparatorType + CefMenuModelImpl::GetSeparatorTypeAt(int index) { + if (!VerifyContext()) + return MENUSEPARATORTYPE_NONE; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].separator_type_; + return MENUSEPARATORTYPE_NONE; +} + int CefMenuModelImpl::GetGroupId(int command_id) { return GetGroupIdAt(GetIndexOf(command_id)); } diff --git a/libcef/browser/menu_model_impl.h b/libcef/browser/menu_model_impl.h index 102b68d97..ad596c845 100644 --- a/libcef/browser/menu_model_impl.h +++ b/libcef/browser/menu_model_impl.h @@ -42,14 +42,14 @@ class CefMenuModelImpl : public CefMenuModel { // CefMenuModel methods. virtual bool Clear() OVERRIDE; virtual int GetCount() OVERRIDE; - virtual bool AddSeparator() OVERRIDE; + virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE; virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddRadioItem(int command_id, const CefString& label, int group_id) OVERRIDE; virtual CefRefPtr AddSubMenu(int command_id, const CefString& label) OVERRIDE; - virtual bool InsertSeparatorAt(int index) OVERRIDE; + virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE; virtual bool InsertItemAt(int index, int command_id, const CefString& label) OVERRIDE; virtual bool InsertCheckItemAt(int index, int command_id, @@ -69,6 +69,7 @@ class CefMenuModelImpl : public CefMenuModel { virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; virtual MenuItemType GetType(int command_id) OVERRIDE; virtual MenuItemType GetTypeAt(int index) OVERRIDE; + virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE; virtual int GetGroupId(int command_id) OVERRIDE; virtual int GetGroupIdAt(int index) OVERRIDE; virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; diff --git a/libcef/browser/resource_request_job.cc b/libcef/browser/resource_request_job.cc index 95d7898b6..11339b56a 100644 --- a/libcef/browser/resource_request_job.cc +++ b/libcef/browser/resource_request_job.cc @@ -125,8 +125,9 @@ class CefResourceRequestJobCallback : public CefCallback { CefResourceRequestJob::CefResourceRequestJob( net::URLRequest* request, + net::NetworkDelegate* network_delegate, CefRefPtr handler) - : net::URLRequestJob(request, request->context()->network_delegate()), + : net::URLRequestJob(request, network_delegate), handler_(handler), remaining_bytes_(0), response_cookies_save_index_(0), diff --git a/libcef/browser/resource_request_job.h b/libcef/browser/resource_request_job.h index b66115c87..8c7a7f6d9 100644 --- a/libcef/browser/resource_request_job.h +++ b/libcef/browser/resource_request_job.h @@ -25,6 +25,7 @@ class CefResourceRequestJobCallback; class CefResourceRequestJob : public net::URLRequestJob { public: CefResourceRequestJob(net::URLRequest* request, + net::NetworkDelegate* network_delegate, CefRefPtr handler); virtual ~CefResourceRequestJob(); diff --git a/libcef/browser/scheme_impl.cc b/libcef/browser/scheme_impl.cc index 631be6d2a..c021f2bca 100644 --- a/libcef/browser/scheme_impl.cc +++ b/libcef/browser/scheme_impl.cc @@ -71,12 +71,15 @@ bool IsBuiltinScheme(const std::string& scheme) { return false; } -net::URLRequestJob* GetBuiltinSchemeRequestJob(net::URLRequest* request, - const std::string& scheme) { +net::URLRequestJob* GetBuiltinSchemeRequestJob( + net::URLRequest* request, + net::NetworkDelegate* network_delegate, + const std::string& scheme) { // See if the request should be handled by a built-in protocol factory. for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { if (scheme == kBuiltinFactories[i].scheme) { - net::URLRequestJob* job = (kBuiltinFactories[i].factory)(request, scheme); + net::URLRequestJob* job = + (kBuiltinFactories[i].factory)(request, network_delegate, scheme); DCHECK(job); // The built-in factories are not expected to fail! return job; } @@ -104,10 +107,11 @@ class CefUrlRequestManager { // From net::URLRequestJobFactory::ProtocolHandler virtual net::URLRequestJob* MaybeCreateJob( - net::URLRequest* request) const OVERRIDE { + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE { CEF_REQUIRE_IOT(); - return CefUrlRequestManager::GetInstance()->GetRequestJob(request, - scheme_); + return CefUrlRequestManager::GetInstance()->GetRequestJob( + request, network_delegate, scheme_); } private: @@ -220,6 +224,7 @@ class CefUrlRequestManager { // Create the job that will handle the request. |scheme| will already be in // lower case. net::URLRequestJob* GetRequestJob(net::URLRequest* request, + net::NetworkDelegate* network_delegate, const std::string& scheme) { net::URLRequestJob* job = NULL; CefRefPtr factory = @@ -239,12 +244,12 @@ class CefUrlRequestManager { CefRefPtr handler = factory->Create(browser.get(), frame, scheme, requestPtr.get()); if (handler.get()) - job = new CefResourceRequestJob(request, handler); + job = new CefResourceRequestJob(request, network_delegate, handler); } if (!job && IsBuiltinScheme(scheme)) { // Give the built-in scheme handler a chance to handle the request. - job = GetBuiltinSchemeRequestJob(request, scheme); + job = GetBuiltinSchemeRequestJob(request, network_delegate, scheme); } #ifndef NDEBUG diff --git a/libcef/browser/url_network_delegate.cc b/libcef/browser/url_network_delegate.cc index 4ce6a17c8..2d5e4f55c 100644 --- a/libcef/browser/url_network_delegate.cc +++ b/libcef/browser/url_network_delegate.cc @@ -223,6 +223,6 @@ int CefNetworkDelegate::OnBeforeSocketStreamConnect( return net::OK; } -void CefNetworkDelegate::OnCacheWaitStateChange(const net::URLRequest& request, - CacheWaitState state) { +void CefNetworkDelegate::OnRequestWaitStateChange(const net::URLRequest& request, + RequestWaitState state) { } diff --git a/libcef/browser/url_network_delegate.h b/libcef/browser/url_network_delegate.h index 639bf112b..fd30b8402 100644 --- a/libcef/browser/url_network_delegate.h +++ b/libcef/browser/url_network_delegate.h @@ -57,8 +57,8 @@ class CefNetworkDelegate : public net::NetworkDelegate { virtual int OnBeforeSocketStreamConnect( net::SocketStream* stream, const net::CompletionCallback& callback) OVERRIDE; - virtual void OnCacheWaitStateChange(const net::URLRequest& request, - CacheWaitState state) OVERRIDE; + virtual void OnRequestWaitStateChange(const net::URLRequest& request, + RequestWaitState state) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate); }; diff --git a/libcef/browser/url_request_context_getter.cc b/libcef/browser/url_request_context_getter.cc index 7d48032ce..0178b573e 100644 --- a/libcef/browser/url_request_context_getter.cc +++ b/libcef/browser/url_request_context_getter.cc @@ -41,7 +41,7 @@ #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" -#include "net/url_request/url_request_job_factory.h" +#include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_manager.h" using content::BrowserThread; @@ -275,7 +275,7 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() { storage_->set_ftp_transaction_factory( new net::FtpNetworkLayer(url_request_context_->host_resolver())); - storage_->set_job_factory(new net::URLRequestJobFactory); + storage_->set_job_factory(new net::URLRequestJobFactoryImpl); request_interceptor_.reset(new CefRequestInterceptor); } diff --git a/libcef/browser/url_request_interceptor.cc b/libcef/browser/url_request_interceptor.cc index fdf32bf81..8d61f6715 100644 --- a/libcef/browser/url_request_interceptor.cc +++ b/libcef/browser/url_request_interceptor.cc @@ -26,7 +26,8 @@ CefRequestInterceptor::~CefRequestInterceptor() { } net::URLRequestJob* CefRequestInterceptor::MaybeIntercept( - net::URLRequest* request) { + net::URLRequest* request, + net::NetworkDelegate* network_delegate) { CefRefPtr browser = CefBrowserHostImpl::GetBrowserForRequest(request); if (browser.get()) { @@ -44,7 +45,8 @@ net::URLRequestJob* CefRequestInterceptor::MaybeIntercept( CefRefPtr resourceHandler = handler->GetResourceHandler(browser.get(), frame, req); if (resourceHandler.get()) - return new CefResourceRequestJob(request, resourceHandler); + return new CefResourceRequestJob(request, network_delegate, + resourceHandler); } } } @@ -53,7 +55,9 @@ net::URLRequestJob* CefRequestInterceptor::MaybeIntercept( } net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect( - net::URLRequest* request, const GURL& location) { + net::URLRequest* request, + net::NetworkDelegate* network_delegate, + const GURL& location) { CefRefPtr browser = CefBrowserHostImpl::GetBrowserForRequest(request); if (browser.get()) { @@ -70,7 +74,8 @@ net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect( if (newUrlStr != location.spec()) { GURL new_url = GURL(std::string(newUrlStr)); if (!new_url.is_empty() && new_url.is_valid()) - return new net::URLRequestRedirectJob(request, new_url); + return new net::URLRequestRedirectJob(request, network_delegate, + new_url); } } } @@ -80,6 +85,7 @@ net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect( } net::URLRequestJob* CefRequestInterceptor::MaybeInterceptResponse( - net::URLRequest* request) { + net::URLRequest* request, + net::NetworkDelegate* network_delegate) { return NULL; } diff --git a/libcef/browser/url_request_interceptor.h b/libcef/browser/url_request_interceptor.h index d8f82a4ec..6dacc7e15 100644 --- a/libcef/browser/url_request_interceptor.h +++ b/libcef/browser/url_request_interceptor.h @@ -16,12 +16,16 @@ class CefRequestInterceptor : public net::URLRequest::Interceptor { ~CefRequestInterceptor(); // net::URLRequest::Interceptor methods. - virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) - OVERRIDE; - virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, + virtual net::URLRequestJob* MaybeIntercept( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptRedirect( + net::URLRequest* request, + net::NetworkDelegate* network_delegate, const GURL& location) OVERRIDE; - virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) - OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptResponse( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(CefRequestInterceptor); }; diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 977a8d99f..139dc672d 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -407,8 +407,8 @@ void CefPostDataImpl::Set(const net::UploadData& data) { CefRefPtr postelem; - const std::vector* elements = data.elements(); - std::vector::const_iterator it = elements->begin(); + const std::vector* elements = data.elements(); + std::vector::const_iterator it = elements->begin(); for (; it != elements->end(); ++it) { postelem = CefPostDataElement::Create(); static_cast(postelem.get())->Set(*it); @@ -419,8 +419,8 @@ void CefPostDataImpl::Set(const net::UploadData& data) { void CefPostDataImpl::Get(net::UploadData& data) { AutoLock lock_scope(this); - net::UploadData::Element element; - std::vector data_elements; + net::UploadElement element; + std::vector data_elements; ElementVector::const_iterator it = elements_.begin(); for (; it != elements_.end(); ++it) { static_cast(it->get())->Get(element); @@ -574,23 +574,20 @@ size_t CefPostDataElementImpl::GetBytes(size_t size, void* bytes) { return rv; } -void CefPostDataElementImpl::Set(const net::UploadData::Element& element) { +void CefPostDataElementImpl::Set(const net::UploadElement& element) { AutoLock lock_scope(this); CHECK_READONLY_RETURN_VOID(); - if (element.type() == net::UploadData::TYPE_BYTES) { - SetToBytes(element.bytes().size(), - static_cast( - std::string(element.bytes().begin(), - element.bytes().end()).c_str())); - } else if (element.type() == net::UploadData::TYPE_FILE) { + if (element.type() == net::UploadElement::TYPE_BYTES) { + SetToBytes(element.bytes_length(), element.bytes()); + } else if (element.type() == net::UploadElement::TYPE_FILE) { SetToFile(element.file_path().value()); } else { NOTREACHED(); } } -void CefPostDataElementImpl::Get(net::UploadData::Element& element) { +void CefPostDataElementImpl::Get(net::UploadElement& element) { AutoLock lock_scope(this); if (type_ == PDE_TYPE_BYTES) { diff --git a/libcef/common/request_impl.h b/libcef/common/request_impl.h index 3c8c1e9e2..f4b150804 100644 --- a/libcef/common/request_impl.h +++ b/libcef/common/request_impl.h @@ -128,8 +128,8 @@ class CefPostDataElementImpl : public CefPostDataElement { void* GetBytes() { return data_.bytes.bytes; } - void Set(const net::UploadData::Element& element); - void Get(net::UploadData::Element& element); + void Set(const net::UploadElement& element); + void Get(net::UploadElement& element); void Set(const WebKit::WebHTTPBody::Element& element); void Get(WebKit::WebHTTPBody::Element& element); diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 2d2d2d548..5e1f4e96c 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -565,7 +565,7 @@ bool CefListValueImpl::Remove(int index) { CefValueType CefListValueImpl::GetType(int index) { CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; if (const_value().Get(index, &out_value)) { switch (out_value->GetType()) { case base::Value::TYPE_NULL: @@ -593,7 +593,7 @@ CefValueType CefListValueImpl::GetType(int index) { bool CefListValueImpl::GetBool(int index) { CEF_VALUE_VERIFY_RETURN(false, false); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; bool ret_value = false; if (const_value().Get(index, &out_value)) @@ -605,7 +605,7 @@ bool CefListValueImpl::GetBool(int index) { int CefListValueImpl::GetInt(int index) { CEF_VALUE_VERIFY_RETURN(false, 0); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; int ret_value = 0; if (const_value().Get(index, &out_value)) @@ -617,7 +617,7 @@ int CefListValueImpl::GetInt(int index) { double CefListValueImpl::GetDouble(int index) { CEF_VALUE_VERIFY_RETURN(false, 0); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; double ret_value = 0; if (const_value().Get(index, &out_value)) @@ -629,7 +629,7 @@ double CefListValueImpl::GetDouble(int index) { CefString CefListValueImpl::GetString(int index) { CEF_VALUE_VERIFY_RETURN(false, CefString()); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; string16 ret_value; if (const_value().Get(index, &out_value)) @@ -641,12 +641,12 @@ CefString CefListValueImpl::GetString(int index) { CefRefPtr CefListValueImpl::GetBinary(int index) { CEF_VALUE_VERIFY_RETURN(false, NULL); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && out_value->IsType(base::Value::TYPE_BINARY)) { base::BinaryValue* binary_value = - static_cast(out_value); + static_cast(const_cast(out_value)); return CefBinaryValueImpl::GetOrCreateRef(binary_value, const_cast(&const_value()), controller()); } @@ -657,12 +657,13 @@ CefRefPtr CefListValueImpl::GetBinary(int index) { CefRefPtr CefListValueImpl::GetDictionary(int index) { CEF_VALUE_VERIFY_RETURN(false, NULL); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && out_value->IsType(base::Value::TYPE_DICTIONARY)) { base::DictionaryValue* dict_value = - static_cast(out_value); + static_cast( + const_cast(out_value)); return CefDictionaryValueImpl::GetOrCreateRef( dict_value, const_cast(&const_value()), @@ -676,11 +677,12 @@ CefRefPtr CefListValueImpl::GetDictionary(int index) { CefRefPtr CefListValueImpl::GetList(int index) { CEF_VALUE_VERIFY_RETURN(false, NULL); - base::Value* out_value = NULL; + const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && out_value->IsType(base::Value::TYPE_LIST)) { - base::ListValue* list_value = static_cast(out_value); + base::ListValue* list_value = + static_cast(const_cast(out_value)); return CefListValueImpl::GetOrCreateRef( list_value, const_cast(&const_value()), diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 63c38fc11..e64c05b90 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -319,19 +319,17 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) { WebKit::WebHTTPBody body; body.initialize(); - const std::vector* elements = + const std::vector* elements = params.upload_data->elements(); - std::vector::const_iterator it = + std::vector::const_iterator it = elements->begin(); for (; it != elements->end(); ++it) { - const net::UploadData::Element& element = *it; - if (element.type() == net::UploadData::TYPE_BYTES) { + const net::UploadElement& element = *it; + if (element.type() == net::UploadElement::TYPE_BYTES) { WebKit::WebData data; - data.assign(std::string(element.bytes().begin(), - element.bytes().end()).c_str(), - element.bytes().size()); + data.assign(element.bytes(), element.bytes_length()); body.appendData(data); - } else if (element.type() == net::UploadData::TYPE_FILE) { + } else if (element.type() == net::UploadElement::TYPE_FILE) { body.appendFile(webkit_glue::FilePathToWebString(element.file_path())); } else { NOTREACHED(); diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 34fc9e681..53a19b92a 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -8,7 +8,10 @@ #include "third_party/WebKit/Source/WebCore/config.h" MSVC_PUSH_WARNING_LEVEL(0); -#include "V8Proxy.h" // NOLINT(build/include) +#include "Frame.h" // NOLINT(build/include) +#include "ScriptController.h" // NOLINT(build/include) +#include "ScriptControllerBase.h" // NOLINT(build/include) +#include "V8Binding.h" // NOLINT(build/include) #include "V8RecursionScope.h" // NOLINT(build/include) MSVC_POP_WARNING(); #undef LOG @@ -554,12 +557,14 @@ bool CefV8ContextImpl::Eval(const CefString& code, retval = NULL; exception = NULL; - // Execute the function call using the V8Proxy so that inspector + // Execute the function call using the ScriptController so that inspector // instrumentation works. - WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); - DCHECK(proxy); - if (proxy) - func_rv = proxy->callFunction(func, obj, 1, &code_val); + RefPtr frame = WebCore::toFrameIfNotDetached(GetHandle()); + DCHECK(frame); + if (frame && + frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) { + func_rv = frame->script()->callFunction(func, obj, 1, &code_val); + } if (try_catch.HasCaught()) { exception = new CefV8ExceptionImpl(try_catch.Message()); @@ -1288,12 +1293,14 @@ CefRefPtr CefV8ValueImpl::ExecuteFunctionWithContext( try_catch.SetVerbose(true); v8::Local func_rv; - // Execute the function call using the V8Proxy so that inspector + // Execute the function call using the ScriptController so that inspector // instrumentation works. - WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); - DCHECK(proxy); - if (proxy) - func_rv = proxy->callFunction(func, recv, argc, argv); + RefPtr frame = WebCore::toFrameIfNotDetached(context_local); + DCHECK(frame); + if (frame && + frame->script()->canExecuteScripts(WebCore::AboutToExecuteScript)) { + func_rv = frame->script()->callFunction(func, recv, argc, argv); + } if (!HasCaught(try_catch) && !func_rv.IsEmpty()) retval = new CefV8ValueImpl(func_rv); diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index 36dceb255..d7f69915e 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -10,6 +10,7 @@ #include "third_party/WebKit/Source/WebCore/config.h" MSVC_PUSH_WARNING_LEVEL(0); #include "Page.h" +#include "ScriptController.h" #include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h" #include "third_party/WebKit/Source/WebKit/chromium/src/WebViewImpl.h" MSVC_POP_WARNING(); @@ -33,8 +34,7 @@ void GoBackOrForward(WebKit::WebView* view, int distance) { v8::Handle GetV8Context(WebKit::WebFrame* frame) { WebKit::WebFrameImpl* impl = static_cast(frame); - WebCore::Frame* core_frame = impl->frame(); - return WebCore::V8Proxy::context(core_frame); + return WebCore::ScriptController::mainWorldContext(impl->frame()); } } // webkit_glue diff --git a/libcef_dll/cpptoc/menu_model_cpptoc.cc b/libcef_dll/cpptoc/menu_model_cpptoc.cc index 95519c86a..baf0db419 100644 --- a/libcef_dll/cpptoc/menu_model_cpptoc.cc +++ b/libcef_dll/cpptoc/menu_model_cpptoc.cc @@ -43,7 +43,8 @@ int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) { return _retval; } -int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) { +int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self, + enum cef_menu_separator_type_t type) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -51,7 +52,8 @@ int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) { return 0; // Execute - bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(); + bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator( + type); // Return type: bool return _retval; @@ -144,7 +146,7 @@ struct _cef_menu_model_t* CEF_CALLBACK menu_model_add_sub_menu( } int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self, - int index) { + int index, enum cef_menu_separator_type_t type) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -153,7 +155,8 @@ int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self, // Execute bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt( - index); + index, + type); // Return type: bool return _retval; @@ -437,6 +440,23 @@ enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at( return _retval; } +enum cef_menu_separator_type_t CEF_CALLBACK menu_model_get_separator_type_at( + struct _cef_menu_model_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return MENUSEPARATORTYPE_NONE; + + // Execute + cef_menu_separator_type_t _retval = CefMenuModelCppToC::Get( + self)->GetSeparatorTypeAt( + index); + + // Return type: simple + return _retval; +} + int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self, int command_id) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -985,6 +1005,7 @@ CefMenuModelCppToC::CefMenuModelCppToC(CefMenuModel* cls) struct_.struct_.set_label_at = menu_model_set_label_at; struct_.struct_.get_type = menu_model_get_type; struct_.struct_.get_type_at = menu_model_get_type_at; + struct_.struct_.get_separator_type_at = menu_model_get_separator_type_at; struct_.struct_.get_group_id = menu_model_get_group_id; struct_.struct_.get_group_id_at = menu_model_get_group_id_at; struct_.struct_.set_group_id = menu_model_set_group_id; diff --git a/libcef_dll/ctocpp/menu_model_ctocpp.cc b/libcef_dll/ctocpp/menu_model_ctocpp.cc index eea4a5dcb..6f33408ef 100644 --- a/libcef_dll/ctocpp/menu_model_ctocpp.cc +++ b/libcef_dll/ctocpp/menu_model_ctocpp.cc @@ -41,14 +41,15 @@ int CefMenuModelCToCpp::GetCount() { return _retval; } -bool CefMenuModelCToCpp::AddSeparator() { +bool CefMenuModelCToCpp::AddSeparator(MenuSeparatorType type) { if (CEF_MEMBER_MISSING(struct_, add_separator)) return false; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute - int _retval = struct_->add_separator(struct_); + int _retval = struct_->add_separator(struct_, + type); // Return type: bool return _retval?true:false; @@ -137,7 +138,7 @@ CefRefPtr CefMenuModelCToCpp::AddSubMenu(int command_id, return CefMenuModelCToCpp::Wrap(_retval); } -bool CefMenuModelCToCpp::InsertSeparatorAt(int index) { +bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) { if (CEF_MEMBER_MISSING(struct_, insert_separator_at)) return false; @@ -145,7 +146,8 @@ bool CefMenuModelCToCpp::InsertSeparatorAt(int index) { // Execute int _retval = struct_->insert_separator_at(struct_, - index); + index, + type); // Return type: bool return _retval?true:false; @@ -411,6 +413,21 @@ CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) { return _retval; } +CefMenuModel::MenuSeparatorType CefMenuModelCToCpp::GetSeparatorTypeAt( + int index) { + if (CEF_MEMBER_MISSING(struct_, get_separator_type_at)) + return MENUSEPARATORTYPE_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_menu_separator_type_t _retval = struct_->get_separator_type_at(struct_, + index); + + // Return type: simple + return _retval; +} + int CefMenuModelCToCpp::GetGroupId(int command_id) { if (CEF_MEMBER_MISSING(struct_, get_group_id)) return 0; diff --git a/libcef_dll/ctocpp/menu_model_ctocpp.h b/libcef_dll/ctocpp/menu_model_ctocpp.h index 892da8ca6..def5fac29 100644 --- a/libcef_dll/ctocpp/menu_model_ctocpp.h +++ b/libcef_dll/ctocpp/menu_model_ctocpp.h @@ -34,14 +34,14 @@ class CefMenuModelCToCpp // CefMenuModel methods virtual bool Clear() OVERRIDE; virtual int GetCount() OVERRIDE; - virtual bool AddSeparator() OVERRIDE; + virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE; virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddRadioItem(int command_id, const CefString& label, int group_id) OVERRIDE; virtual CefRefPtr AddSubMenu(int command_id, const CefString& label) OVERRIDE; - virtual bool InsertSeparatorAt(int index) OVERRIDE; + virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE; virtual bool InsertItemAt(int index, int command_id, const CefString& label) OVERRIDE; virtual bool InsertCheckItemAt(int index, int command_id, @@ -61,6 +61,7 @@ class CefMenuModelCToCpp virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; virtual MenuItemType GetType(int command_id) OVERRIDE; virtual MenuItemType GetTypeAt(int index) OVERRIDE; + virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE; virtual int GetGroupId(int command_id) OVERRIDE; virtual int GetGroupIdAt(int index) OVERRIDE; virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; diff --git a/tests/cefclient/client_app.cpp b/tests/cefclient/client_app.cpp index b6a26d150..0e91ed55b 100644 --- a/tests/cefclient/client_app.cpp +++ b/tests/cefclient/client_app.cpp @@ -222,6 +222,13 @@ void ClientApp::GetProxyForUrl(const CefString& url, CefString(&proxy_info.proxyList) = proxy_config_; } +void ClientApp::OnRenderThreadCreated() { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnRenderThreadCreated(this); +} + void ClientApp::OnWebKitInitialized() { // Register the client_app extension. std::string app_code = diff --git a/tests/cefclient/client_app.h b/tests/cefclient/client_app.h index 2a5e955aa..fed653033 100644 --- a/tests/cefclient/client_app.h +++ b/tests/cefclient/client_app.h @@ -23,9 +23,13 @@ class ClientApp : public CefApp, // constructor. class RenderDelegate : public virtual CefBase { public: + // Called after the render process main thread has been created. + virtual void OnRenderThreadCreated(CefRefPtr app) { + } + // Called when WebKit is initialized. Used to register V8 extensions. virtual void OnWebKitInitialized(CefRefPtr app) { - }; + } // Called when a V8 context is created. Used to create V8 window bindings // and set message callbacks. RenderDelegates should check for unique URLs @@ -34,7 +38,7 @@ class ClientApp : public CefApp, CefRefPtr browser, CefRefPtr frame, CefRefPtr context) { - }; + } // Called when a V8 context is released. Used to clean up V8 window // bindings. RenderDelegates should check for unique URLs to avoid @@ -43,7 +47,7 @@ class ClientApp : public CefApp, CefRefPtr browser, CefRefPtr frame, CefRefPtr context) { - }; + } // Called when the focused node in a frame has changed. virtual void OnFocusedNodeChanged(CefRefPtr app, @@ -120,6 +124,7 @@ class ClientApp : public CefApp, CefProxyInfo& proxy_info) OVERRIDE; // CefRenderProcessHandler methods. + virtual void OnRenderThreadCreated() OVERRIDE; virtual void OnWebKitInitialized() OVERRIDE; virtual void OnContextCreated(CefRefPtr browser, CefRefPtr frame, diff --git a/tests/cefclient/client_handler.cpp b/tests/cefclient/client_handler.cpp index e65bd98d3..aced92555 100644 --- a/tests/cefclient/client_handler.cpp +++ b/tests/cefclient/client_handler.cpp @@ -94,7 +94,7 @@ void ClientHandler::OnBeforeContextMenu( if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) { // Add a separator if the menu already has items. if (model->GetCount() > 0) - model->AddSeparator(); + model->AddSeparator(MENUSEPARATORTYPE_NORMAL); // Add a "Show DevTools" item to all context menus. model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools"); @@ -490,7 +490,7 @@ void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) { void ClientHandler::BuildTestMenu(CefRefPtr model) { if (model->GetCount() > 0) - model->AddSeparator(); + model->AddSeparator(MENUSEPARATORTYPE_NORMAL); // Build the sub menu. CefRefPtr submenu =