diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index a9b1f142b..0b1944f9b 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=15f23de47af54fa690b6c5810e3049f97ae2aabd$ +// $hash=2385e0531c91a419fe7f4036b5a59da743b1622e$ // #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ @@ -869,25 +869,33 @@ typedef struct _cef_browser_host_t { // |windowInfo|. All values will be copied internally and the actual window will // be created on the UI thread. If |request_context| is NULL the global request // context will be used. This function can be called on any browser process -// thread and will not block. +// thread and will not block. The optional |extra_info| parameter provides an +// opportunity to specify extra information specific to the created browser that +// will be passed to cef_render_process_handler_t::on_browser_created() in the +// render process. /// CEF_EXPORT int cef_browser_host_create_browser( const cef_window_info_t* windowInfo, struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context); /// // Create a new browser window using the window parameters specified by // |windowInfo|. If |request_context| is NULL the global request context will be -// used. This function can only be called on the browser process UI thread. +// used. This function can only be called on the browser process UI thread. The +// optional |extra_info| parameter provides an opportunity to specify extra +// information specific to the created browser that will be passed to +// cef_render_process_handler_t::on_browser_created() in the render process. /// CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( const cef_window_info_t* windowInfo, struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context); #ifdef __cplusplus diff --git a/include/capi/cef_life_span_handler_capi.h b/include/capi/cef_life_span_handler_capi.h index c9cc49353..52d5520b2 100644 --- a/include/capi/cef_life_span_handler_capi.h +++ b/include/capi/cef_life_span_handler_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=a1648c803a6d72e004e523cd4c02530702635d1e$ +// $hash=9756fec933d13ecb320b0ec8c3bd8c9fcddfef47$ // #ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_ @@ -80,7 +80,10 @@ typedef struct _cef_life_span_handler_t { // modifications to |windowInfo| will be ignored if the parent browser is // wrapped in a cef_browser_view_t. Popup browser creation will be canceled if // the parent browser is destroyed before the popup browser creation completes - // (indicated by a call to OnAfterCreated for the popup browser). + // (indicated by a call to OnAfterCreated for the popup browser). The + // |extra_info| parameter provides an opportunity to specify extra information + // specific to the created popup browser that will be passed to + // cef_render_process_handler_t::on_browser_created() in the render process. /// int(CEF_CALLBACK* on_before_popup)( struct _cef_life_span_handler_t* self, @@ -94,6 +97,7 @@ typedef struct _cef_life_span_handler_t { struct _cef_window_info_t* windowInfo, struct _cef_client_t** client, struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t** extra_info, int* no_javascript_access); /// diff --git a/include/capi/cef_render_process_handler_capi.h b/include/capi/cef_render_process_handler_capi.h index 8ac15df3d..6d01d80c5 100644 --- a/include/capi/cef_render_process_handler_capi.h +++ b/include/capi/cef_render_process_handler_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=63544b02e263d0aeb2f6553bf40c52bcf72d9f0b$ +// $hash=a3cf58db4b29d7395975ab8d63461b5ea8aad064$ // #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ @@ -83,11 +83,16 @@ typedef struct _cef_render_process_handler_t { /// // Called after a browser has been created. When browsing cross-origin a new // browser will be created before the old browser with the same identifier is - // destroyed. + // destroyed. |extra_info| is a read-only value originating from + // cef_browser_host_t::cef_browser_host_create_browser(), + // cef_browser_host_t::cef_browser_host_create_browser_sync(), + // cef_life_span_handler_t::on_before_popup() or + // cef_browser_view_t::cef_browser_view_create(). /// void(CEF_CALLBACK* on_browser_created)( struct _cef_render_process_handler_t* self, - struct _cef_browser_t* browser); + struct _cef_browser_t* browser, + struct _cef_dictionary_value_t* extra_info); /// // Called before a browser is destroyed. diff --git a/include/capi/views/cef_browser_view_capi.h b/include/capi/views/cef_browser_view_capi.h index 4d20840f2..2fe5e6414 100644 --- a/include/capi/views/cef_browser_view_capi.h +++ b/include/capi/views/cef_browser_view_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=c499099d6f628e58d2eed207537817758161af5d$ +// $hash=400746f8fac7fa3dba7ee889c10ae6ca22b93fe1$ // #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_ @@ -80,12 +80,16 @@ typedef struct _cef_browser_view_t { /// // Create a new BrowserView. The underlying cef_browser_t will not be created -// until this view is added to the views hierarchy. +// until this view is added to the views hierarchy. The optional |extra_info| +// parameter provides an opportunity to specify extra information specific to +// the created browser that will be passed to +// cef_render_process_handler_t::on_browser_created() in the render process. /// CEF_EXPORT cef_browser_view_t* cef_browser_view_create( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context, struct _cef_browser_view_delegate_t* delegate); diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index c1f28bb5a..682df0bb8 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -34,7 +34,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=e9ff73cc80e162b173ecd1a62b0cb48f9e46de99$ +// $hash=dc61bafdca990fc0b1da9ba902dccefb8c8cf38f$ // #ifndef CEF_INCLUDE_API_HASH_H_ @@ -47,13 +47,13 @@ // way that may cause binary incompatibility with other builds. The universal // hash value will change if any platform is affected whereas the platform hash // values will change only if that particular platform is affected. -#define CEF_API_HASH_UNIVERSAL "fa535acbd95d3d7a25e43b015dfea09700d7bf72" +#define CEF_API_HASH_UNIVERSAL "45812b72803c3a0e84eccfe798fb40c945c85135" #if defined(OS_WIN) -#define CEF_API_HASH_PLATFORM "a729d5a21d1f3655db514d47093abe59794f5f26" +#define CEF_API_HASH_PLATFORM "968d2733802c68469af053b20c4e7e5abd425ee3" #elif defined(OS_MACOSX) -#define CEF_API_HASH_PLATFORM "6b77f0976c19ba6b15a8a054fe35bde0ba2cf89d" +#define CEF_API_HASH_PLATFORM "244b441b45d676649052f6da646aa0e76e227eb3" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "c21503860303873c2148e3740d6c407ae6ece32b" +#define CEF_API_HASH_PLATFORM "3aa82a71e8a2e40c7cf96eee3539b4787d18b7fd" #endif #ifdef __cplusplus diff --git a/include/cef_browser.h b/include/cef_browser.h index 133a7a6fe..69f048c2a 100644 --- a/include/cef_browser.h +++ b/include/cef_browser.h @@ -286,29 +286,37 @@ class CefBrowserHost : public virtual CefBaseRefCounted { // |windowInfo|. All values will be copied internally and the actual window // will be created on the UI thread. If |request_context| is empty the // global request context will be used. This method can be called on any - // browser process thread and will not block. + // browser process thread and will not block. The optional |extra_info| + // parameter provides an opportunity to specify extra information specific + // to the created browser that will be passed to + // CefRenderProcessHandler::OnBrowserCreated() in the render process. /// /*--cef(optional_param=client,optional_param=url, - optional_param=request_context)--*/ + optional_param=request_context,optional_param=extra_info)--*/ static bool CreateBrowser(const CefWindowInfo& windowInfo, CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context); /// // Create a new browser window using the window parameters specified by // |windowInfo|. If |request_context| is empty the global request context // will be used. This method can only be called on the browser process UI - // thread. + // thread. The optional |extra_info| parameter provides an opportunity to + // specify extra information specific to the created browser that will be + // passed to CefRenderProcessHandler::OnBrowserCreated() in the render + // process. /// /*--cef(optional_param=client,optional_param=url, - optional_param=request_context)--*/ + optional_param=request_context,optional_param=extra_info)--*/ static CefRefPtr CreateBrowserSync( const CefWindowInfo& windowInfo, CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context); /// diff --git a/include/cef_life_span_handler.h b/include/cef_life_span_handler.h index 64553018a..391a3e425 100644 --- a/include/cef_life_span_handler.h +++ b/include/cef_life_span_handler.h @@ -73,7 +73,10 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted { // |windowInfo| will be ignored if the parent browser is wrapped in a // CefBrowserView. Popup browser creation will be canceled if the parent // browser is destroyed before the popup browser creation completes (indicated - // by a call to OnAfterCreated for the popup browser). + // by a call to OnAfterCreated for the popup browser). The |extra_info| + // parameter provides an opportunity to specify extra information specific + // to the created popup browser that will be passed to + // CefRenderProcessHandler::OnBrowserCreated() in the render process. /// /*--cef(optional_param=target_url,optional_param=target_frame_name)--*/ virtual bool OnBeforePopup(CefRefPtr browser, @@ -86,6 +89,7 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) { return false; } diff --git a/include/cef_render_process_handler.h b/include/cef_render_process_handler.h index ad08c2380..de2d9a447 100644 --- a/include/cef_render_process_handler.h +++ b/include/cef_render_process_handler.h @@ -75,10 +75,13 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted { /// // Called after a browser has been created. When browsing cross-origin a new // browser will be created before the old browser with the same identifier is - // destroyed. + // destroyed. |extra_info| is a read-only value originating from + // CefBrowserHost::CreateBrowser(), CefBrowserHost::CreateBrowserSync(), + // CefLifeSpanHandler::OnBeforePopup() or CefBrowserView::CreateBrowserView(). /// /*--cef()--*/ - virtual void OnBrowserCreated(CefRefPtr browser) {} + virtual void OnBrowserCreated(CefRefPtr browser, + CefRefPtr extra_info) {} /// // Called before a browser is destroyed. diff --git a/include/views/cef_browser_view.h b/include/views/cef_browser_view.h index 5d6cb5681..a310eb0a2 100644 --- a/include/views/cef_browser_view.h +++ b/include/views/cef_browser_view.h @@ -51,14 +51,19 @@ class CefBrowserView : public CefView { public: /// // Create a new BrowserView. The underlying CefBrowser will not be created - // until this view is added to the views hierarchy. + // until this view is added to the views hierarchy. The optional |extra_info| + // parameter provides an opportunity to specify extra information specific + // to the created browser that will be passed to + // CefRenderProcessHandler::OnBrowserCreated() in the render process. /// /*--cef(optional_param=client,optional_param=url, - optional_param=request_context,optional_param=delegate)--*/ + optional_param=request_context,optional_param=delegate, + optional_param=extra_info)--*/ static CefRefPtr CreateBrowserView( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate); diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index ef13dcab2..ea1277f00 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -127,24 +127,27 @@ class CreateBrowserHelper { CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) : window_info_(windowInfo), client_(client), url_(url), settings_(settings), + extra_info_(extra_info), request_context_(request_context) {} CefWindowInfo window_info_; CefRefPtr client_; CefString url_; CefBrowserSettings settings_; + CefRefPtr extra_info_; CefRefPtr request_context_; }; void CreateBrowserWithHelper(CreateBrowserHelper* helper) { - CefBrowserHost::CreateBrowserSync(helper->window_info_, helper->client_, - helper->url_, helper->settings_, - helper->request_context_); + CefBrowserHost::CreateBrowserSync( + helper->window_info_, helper->client_, helper->url_, helper->settings_, + helper->extra_info_, helper->request_context_); delete helper; } @@ -207,6 +210,7 @@ bool CefBrowserHost::CreateBrowser( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { // Verify that the context is in a valid state. if (!CONTEXT_STATE_VALID()) { @@ -236,7 +240,7 @@ bool CefBrowserHost::CreateBrowser( // Create the browser on the UI thread. CreateBrowserHelper* helper = new CreateBrowserHelper( - windowInfo, client, url, settings, request_context); + windowInfo, client, url, settings, extra_info, request_context); CEF_POST_TASK(CEF_UIT, base::BindOnce(CreateBrowserWithHelper, helper)); return true; @@ -248,6 +252,7 @@ CefRefPtr CefBrowserHost::CreateBrowserSync( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { // Verify that the context is in a valid state. if (!CONTEXT_STATE_VALID()) { @@ -284,6 +289,7 @@ CefRefPtr CefBrowserHost::CreateBrowserSync( create_params.url = GURL(new_url); } create_params.settings = settings; + create_params.extra_info = extra_info; create_params.request_context = request_context; CefRefPtr browser = @@ -305,7 +311,8 @@ CefRefPtr CefBrowserHostImpl::Create( scoped_refptr info = CefBrowserInfoManager::GetInstance()->CreateBrowserInfo( - is_devtools_popup, platform_delegate->IsWindowless()); + is_devtools_popup, platform_delegate->IsWindowless(), + create_params.extra_info); // Get or create the request context and browser context. CefRefPtr request_context_impl = @@ -2549,14 +2556,15 @@ void CefBrowserHostImpl::WebContentsCreated( CefBrowserSettings settings; CefRefPtr client; std::unique_ptr platform_delegate; + CefRefPtr extra_info; CefBrowserInfoManager::GetInstance()->WebContentsCreated( target_url, opener_render_process_id, opener_render_frame_id, settings, - client, platform_delegate); + client, platform_delegate, extra_info); scoped_refptr info = CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo( - new_contents, platform_delegate->IsWindowless()); + new_contents, platform_delegate->IsWindowless(), extra_info); DCHECK(info.get()); DCHECK(info->is_popup()); diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index dd5ef0993..2ac8daa02 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -135,6 +135,8 @@ class CefBrowserHostImpl : public CefBrowserHost, // request context will be used. CefRefPtr request_context; + CefRefPtr extra_info; + // Used when explicitly creating the browser as an extension host via // ProcessManager::CreateBackgroundHost. const extensions::Extension* extension = nullptr; diff --git a/libcef/browser/browser_info.cc b/libcef/browser/browser_info.cc index b9c465401..1326228af 100644 --- a/libcef/browser/browser_info.cc +++ b/libcef/browser/browser_info.cc @@ -6,6 +6,7 @@ #include "libcef/browser/browser_host_impl.h" #include "libcef/browser/thread_util.h" +#include "libcef/common/values_impl.h" #include "ipc/ipc_message.h" @@ -118,13 +119,16 @@ bool CefBrowserInfo::FrameTreeNodeIDManager::is_frame_tree_node_id_match( // CefBrowserInfo -CefBrowserInfo::CefBrowserInfo(int browser_id, bool is_popup) +CefBrowserInfo::CefBrowserInfo(int browser_id, + bool is_popup, + CefRefPtr extra_info) : browser_id_(browser_id), is_popup_(is_popup), is_windowless_(false), render_id_manager_(&lock_), guest_render_id_manager_(&lock_), - frame_tree_node_id_manager_(&lock_) { + frame_tree_node_id_manager_(&lock_), + extra_info_(extra_info) { DCHECK_GT(browser_id, 0); } diff --git a/libcef/browser/browser_info.h b/libcef/browser/browser_info.h index dcc081890..ae27aaa03 100644 --- a/libcef/browser/browser_info.h +++ b/libcef/browser/browser_info.h @@ -9,9 +9,11 @@ #include #include "include/internal/cef_ptr.h" +#include "libcef/common/values_impl.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" +#include "base/values.h" class CefBrowserHostImpl; @@ -83,12 +85,16 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { FrameTreeNodeIdSet frame_tree_node_id_set_; }; - CefBrowserInfo(int browser_id, bool is_popup); + CefBrowserInfo(int browser_id, + bool is_popup, + CefRefPtr extra_info); int browser_id() const { return browser_id_; } bool is_popup() const { return is_popup_; } bool is_windowless() const { return is_windowless_; } + CefRefPtr extra_info() const { return extra_info_; } + void set_windowless(bool windowless); // Returns the render ID manager for this browser. @@ -129,6 +135,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { // been destroyed. CefRefPtr browser_; + CefRefPtr extra_info_; + DISALLOW_COPY_AND_ASSIGN(CefBrowserInfo); }; diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 1a7474fe3..e27b989f9 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -12,6 +12,7 @@ #include "libcef/browser/thread_util.h" #include "libcef/common/cef_messages.h" #include "libcef/common/extensions/extensions_util.h" +#include "libcef/common/values_impl.h" #include "base/logging.h" #include "content/common/view_messages.h" @@ -60,11 +61,12 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() { scoped_refptr CefBrowserInfoManager::CreateBrowserInfo( bool is_popup, - bool is_windowless) { + bool is_windowless, + CefRefPtr extra_info) { base::AutoLock lock_scope(browser_info_lock_); scoped_refptr browser_info = - new CefBrowserInfo(++next_browser_id_, is_popup); + new CefBrowserInfo(++next_browser_id_, is_popup, extra_info); browser_info_list_.push_back(browser_info); if (is_windowless) @@ -75,7 +77,8 @@ scoped_refptr CefBrowserInfoManager::CreateBrowserInfo( scoped_refptr CefBrowserInfoManager::CreatePopupBrowserInfo( content::WebContents* new_contents, - bool is_windowless) { + bool is_windowless, + CefRefPtr extra_info) { base::AutoLock lock_scope(browser_info_lock_); content::RenderFrameHost* frame_host = new_contents->GetMainFrame(); @@ -83,7 +86,7 @@ scoped_refptr CefBrowserInfoManager::CreatePopupBrowserInfo( const int render_frame_routing_id = frame_host->GetRoutingID(); scoped_refptr browser_info = - new CefBrowserInfo(++next_browser_id_, true); + new CefBrowserInfo(++next_browser_id_, true, extra_info); browser_info->render_id_manager()->add_render_frame_id( render_process_id, render_frame_routing_id); browser_info_list_.push_back(browser_info); @@ -191,7 +194,8 @@ bool CefBrowserInfoManager::CanCreateWindow( pending_popup->target_frame_name, static_cast(disposition), user_gesture, cef_features, *window_info, pending_popup->client, - pending_popup->settings, no_javascript_access); + pending_popup->settings, pending_popup->extra_info, + no_javascript_access); } } @@ -203,6 +207,7 @@ bool CefBrowserInfoManager::CanCreateWindow( create_params.settings = pending_popup->settings; create_params.client = pending_popup->client; + create_params.extra_info = pending_popup->extra_info; pending_popup->platform_delegate = CefBrowserPlatformDelegate::Create(create_params); @@ -252,7 +257,8 @@ void CefBrowserInfoManager::WebContentsCreated( int opener_render_frame_id, CefBrowserSettings& settings, CefRefPtr& client, - std::unique_ptr& platform_delegate) { + std::unique_ptr& platform_delegate, + CefRefPtr& extra_info) { CEF_REQUIRE_UIT(); std::unique_ptr pending_popup = @@ -265,6 +271,7 @@ void CefBrowserInfoManager::WebContentsCreated( settings = pending_popup->settings; client = pending_popup->client; platform_delegate = std::move(pending_popup->platform_delegate); + extra_info = pending_popup->extra_info; } void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id, @@ -513,6 +520,14 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse( params.is_popup = browser_info->is_popup(); params.is_guest_view = is_guest_view; + auto extra_info = browser_info->extra_info(); + if (extra_info) { + auto extra_info_impl = + static_cast(extra_info.get()); + auto extra_info_value = extra_info_impl->CopyValue(); + extra_info_value->Swap(¶ms.extra_info); + } + CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params); host->Send(reply_msg); } diff --git a/libcef/browser/browser_info_manager.h b/libcef/browser/browser_info_manager.h index da5d473be..fbd5e5ede 100644 --- a/libcef/browser/browser_info_manager.h +++ b/libcef/browser/browser_info_manager.h @@ -49,8 +49,10 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // Called from CefBrowserHostImpl::Create when a new browser is being created // directly. In this case |is_popup| will be true only for DevTools browsers. - scoped_refptr CreateBrowserInfo(bool is_popup, - bool is_windowless); + scoped_refptr CreateBrowserInfo( + bool is_popup, + bool is_windowless, + CefRefPtr extra_info); // Called from CefBrowserHostImpl::WebContentsCreated when a new browser is // being created for a traditional popup (e.g. window.open() or targeted @@ -58,7 +60,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // response will be sent when this method is called. scoped_refptr CreatePopupBrowserInfo( content::WebContents* new_contents, - bool is_windowless); + bool is_windowless, + CefRefPtr extra_info); // Called from CefContentBrowserClient::CanCreateWindow. See comments on // PendingPopup for more information. @@ -89,7 +92,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { int opener_render_frame_id, CefBrowserSettings& settings, CefRefPtr& client, - std::unique_ptr& platform_delegate); + std::unique_ptr& platform_delegate, + CefRefPtr& extra_info); // Called from CefBrowserMessageFilter::OnGetNewBrowserInfo for delivering // browser info to the renderer process. If the browser info already exists @@ -168,6 +172,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // Values specified by OnBeforePopup. CefBrowserSettings settings; CefRefPtr client; + CefRefPtr extra_info; // Platform delegate specific to the new popup. std::unique_ptr platform_delegate; diff --git a/libcef/browser/views/browser_view_impl.cc b/libcef/browser/views/browser_view_impl.cc index 54f07d181..2ca65a208 100644 --- a/libcef/browser/views/browser_view_impl.cc +++ b/libcef/browser/views/browser_view_impl.cc @@ -18,10 +18,11 @@ CefRefPtr CefBrowserView::CreateBrowserView( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate) { - return CefBrowserViewImpl::Create(client, url, settings, request_context, - delegate); + return CefBrowserViewImpl::Create(client, url, settings, extra_info, + request_context, delegate); } // static @@ -40,11 +41,12 @@ CefRefPtr CefBrowserViewImpl::Create( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate) { CEF_REQUIRE_UIT_RETURN(nullptr); CefRefPtr browser_view = new CefBrowserViewImpl(delegate); - browser_view->SetPendingBrowserCreateParams(client, url, settings, + browser_view->SetPendingBrowserCreateParams(client, url, settings, extra_info, request_context); browser_view->Initialize(); browser_view->SetDefaults(settings); @@ -171,12 +173,14 @@ void CefBrowserViewImpl::SetPendingBrowserCreateParams( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { DCHECK(!pending_browser_create_params_); pending_browser_create_params_.reset(new CefBrowserHostImpl::CreateParams()); pending_browser_create_params_->client = client; pending_browser_create_params_->url = GURL(url.ToString()); pending_browser_create_params_->settings = settings; + pending_browser_create_params_->extra_info = extra_info; pending_browser_create_params_->request_context = request_context; } diff --git a/libcef/browser/views/browser_view_impl.h b/libcef/browser/views/browser_view_impl.h index 131151937..639a9ac10 100644 --- a/libcef/browser/views/browser_view_impl.h +++ b/libcef/browser/views/browser_view_impl.h @@ -31,6 +31,7 @@ class CefBrowserViewImpl : public CefViewImpl client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate); @@ -76,6 +77,7 @@ class CefBrowserViewImpl : public CefViewImpl client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context); void SetDefaults(const CefBrowserSettings& settings); diff --git a/libcef/common/cef_messages.h b/libcef/common/cef_messages.h index f0516114c..84b90df04 100644 --- a/libcef/common/cef_messages.h +++ b/libcef/common/cef_messages.h @@ -188,6 +188,7 @@ IPC_STRUCT_BEGIN(CefProcessHostMsg_GetNewBrowserInfo_Params) IPC_STRUCT_MEMBER(bool, is_popup) IPC_STRUCT_MEMBER(bool, is_windowless) IPC_STRUCT_MEMBER(bool, is_guest_view) + IPC_STRUCT_MEMBER(base::DictionaryValue, extra_info) IPC_STRUCT_END() // Retrieve information about a newly created browser. diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 6e80d7fef..87b404890 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -679,8 +679,12 @@ void CefContentRendererClient::BrowserCreated( if (application.get()) { CefRefPtr handler = application->GetRenderProcessHandler(); - if (handler.get()) - handler->OnBrowserCreated(browser.get()); + if (handler.get()) { + CefRefPtr dictValuePtr( + new CefDictionaryValueImpl(¶ms.extra_info, false, true)); + handler->OnBrowserCreated(browser.get(), dictValuePtr.get()); + dictValuePtr->Detach(NULL); + } } } diff --git a/libcef_dll/cpptoc/browser_host_cpptoc.cc b/libcef_dll/cpptoc/browser_host_cpptoc.cc index 88b64987e..f0ad7c73c 100644 --- a/libcef_dll/cpptoc/browser_host_cpptoc.cc +++ b/libcef_dll/cpptoc/browser_host_cpptoc.cc @@ -9,11 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=48d8640bfbc9fede99ac411c163b2717ad84d373$ +// $hash=efa046db24821251ee93d40d36516d11b915325c$ // #include "libcef_dll/cpptoc/browser_host_cpptoc.h" #include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" #include "libcef_dll/cpptoc/drag_data_cpptoc.h" #include "libcef_dll/cpptoc/extension_cpptoc.h" #include "libcef_dll/cpptoc/navigation_entry_cpptoc.h" @@ -33,6 +34,7 @@ CEF_EXPORT int cef_browser_host_create_browser( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context) { shutdown_checker::AssertNotShutdown(); @@ -46,7 +48,7 @@ CEF_EXPORT int cef_browser_host_create_browser( DCHECK(settings); if (!settings) return 0; - // Unverified params: client, url, request_context + // Unverified params: client, url, extra_info, request_context // Translate param: windowInfo; type: struct_byref_const CefWindowInfo windowInfoObj; @@ -60,6 +62,7 @@ CEF_EXPORT int cef_browser_host_create_browser( // Execute bool _retval = CefBrowserHost::CreateBrowser( windowInfoObj, CefClientCToCpp::Wrap(client), CefString(url), settingsObj, + CefDictionaryValueCppToC::Unwrap(extra_info), CefRequestContextCppToC::Unwrap(request_context)); // Return type: bool @@ -71,6 +74,7 @@ CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context) { shutdown_checker::AssertNotShutdown(); @@ -84,7 +88,7 @@ CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( DCHECK(settings); if (!settings) return NULL; - // Unverified params: client, url, request_context + // Unverified params: client, url, extra_info, request_context // Translate param: windowInfo; type: struct_byref_const CefWindowInfo windowInfoObj; @@ -98,6 +102,7 @@ CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( // Execute CefRefPtr _retval = CefBrowserHost::CreateBrowserSync( windowInfoObj, CefClientCToCpp::Wrap(client), CefString(url), settingsObj, + CefDictionaryValueCppToC::Unwrap(extra_info), CefRequestContextCppToC::Unwrap(request_context)); // Return type: refptr_same diff --git a/libcef_dll/cpptoc/life_span_handler_cpptoc.cc b/libcef_dll/cpptoc/life_span_handler_cpptoc.cc index c3cbc9148..6fd43581a 100644 --- a/libcef_dll/cpptoc/life_span_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/life_span_handler_cpptoc.cc @@ -9,12 +9,13 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=90eb7cfa5e3f294b4b732e705ebe53072f22e8e2$ +// $hash=c6b5f1dca6503df7cb9de7b5351969ad008df340$ // #include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" #include "libcef_dll/cpptoc/client_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" #include "libcef_dll/ctocpp/frame_ctocpp.h" #include "libcef_dll/shutdown_checker.h" @@ -34,6 +35,7 @@ int CEF_CALLBACK life_span_handler_on_before_popup( cef_window_info_t* windowInfo, cef_client_t** client, struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t** extra_info, int* no_javascript_access) { shutdown_checker::AssertNotShutdown(); @@ -66,6 +68,10 @@ int CEF_CALLBACK life_span_handler_on_before_popup( DCHECK(settings); if (!settings) return 0; + // Verify param: extra_info; type: refptr_diff_byref + DCHECK(extra_info); + if (!extra_info) + return 0; // Verify param: no_javascript_access; type: bool_byaddr DCHECK(no_javascript_access); if (!no_javascript_access) @@ -89,6 +95,11 @@ int CEF_CALLBACK life_span_handler_on_before_popup( CefBrowserSettings settingsObj; if (settings) settingsObj.AttachTo(*settings); + // Translate param: extra_info; type: refptr_diff_byref + CefRefPtr extra_infoPtr; + if (extra_info && *extra_info) + extra_infoPtr = CefDictionaryValueCToCpp::Wrap(*extra_info); + CefDictionaryValue* extra_infoOrig = extra_infoPtr.get(); // Translate param: no_javascript_access; type: bool_byaddr bool no_javascript_accessBool = (no_javascript_access && *no_javascript_access) ? true : false; @@ -98,7 +109,7 @@ int CEF_CALLBACK life_span_handler_on_before_popup( CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), CefString(target_url), CefString(target_frame_name), target_disposition, user_gesture ? true : false, popupFeaturesObj, windowInfoObj, clientPtr, - settingsObj, &no_javascript_accessBool); + settingsObj, extra_infoPtr, &no_javascript_accessBool); // Restore param: windowInfo; type: struct_byref if (windowInfo) @@ -116,6 +127,16 @@ int CEF_CALLBACK life_span_handler_on_before_popup( // Restore param: settings; type: struct_byref if (settings) settingsObj.DetachTo(*settings); + // Restore param: extra_info; type: refptr_diff_byref + if (extra_info) { + if (extra_infoPtr.get()) { + if (extra_infoPtr.get() != extra_infoOrig) { + *extra_info = CefDictionaryValueCToCpp::Unwrap(extra_infoPtr); + } + } else { + *extra_info = NULL; + } + } // Restore param: no_javascript_access; type: bool_byaddr if (no_javascript_access) *no_javascript_access = no_javascript_accessBool ? true : false; diff --git a/libcef_dll/cpptoc/render_process_handler_cpptoc.cc b/libcef_dll/cpptoc/render_process_handler_cpptoc.cc index ae465833c..354e4d82d 100644 --- a/libcef_dll/cpptoc/render_process_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/render_process_handler_cpptoc.cc @@ -9,12 +9,13 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=75233e51355652a53c7dcdae740eba004e76605e$ +// $hash=7b918e87169c8fee39d93a9093ac700eceb6a061$ // #include "libcef_dll/cpptoc/render_process_handler_cpptoc.h" #include "libcef_dll/cpptoc/load_handler_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" #include "libcef_dll/ctocpp/domnode_ctocpp.h" #include "libcef_dll/ctocpp/frame_ctocpp.h" #include "libcef_dll/ctocpp/list_value_ctocpp.h" @@ -59,7 +60,8 @@ void CEF_CALLBACK render_process_handler_on_web_kit_initialized( void CEF_CALLBACK render_process_handler_on_browser_created( struct _cef_render_process_handler_t* self, - cef_browser_t* browser) { + cef_browser_t* browser, + struct _cef_dictionary_value_t* extra_info) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -69,10 +71,15 @@ void CEF_CALLBACK render_process_handler_on_browser_created( DCHECK(browser); if (!browser) return; + // Verify param: extra_info; type: refptr_diff + DCHECK(extra_info); + if (!extra_info) + return; // Execute CefRenderProcessHandlerCppToC::Get(self)->OnBrowserCreated( - CefBrowserCToCpp::Wrap(browser)); + CefBrowserCToCpp::Wrap(browser), + CefDictionaryValueCToCpp::Wrap(extra_info)); } void CEF_CALLBACK render_process_handler_on_browser_destroyed( diff --git a/libcef_dll/cpptoc/views/browser_view_cpptoc.cc b/libcef_dll/cpptoc/views/browser_view_cpptoc.cc index 949606d5c..a287d2002 100644 --- a/libcef_dll/cpptoc/views/browser_view_cpptoc.cc +++ b/libcef_dll/cpptoc/views/browser_view_cpptoc.cc @@ -9,11 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=c7258f6b27af82d278f8cff4105cfddfebb33658$ +// $hash=4b17017a80d32d5b9b4968206b6ce22254625d5a$ // #include "libcef_dll/cpptoc/views/browser_view_cpptoc.h" #include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" #include "libcef_dll/cpptoc/request_context_cpptoc.h" #include "libcef_dll/cpptoc/views/button_cpptoc.h" #include "libcef_dll/cpptoc/views/panel_cpptoc.h" @@ -32,6 +33,7 @@ CEF_EXPORT cef_browser_view_t* cef_browser_view_create( cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + cef_dictionary_value_t* extra_info, cef_request_context_t* request_context, cef_browser_view_delegate_t* delegate) { shutdown_checker::AssertNotShutdown(); @@ -42,7 +44,7 @@ CEF_EXPORT cef_browser_view_t* cef_browser_view_create( DCHECK(settings); if (!settings) return NULL; - // Unverified params: client, url, request_context, delegate + // Unverified params: client, url, extra_info, request_context, delegate // Translate param: settings; type: struct_byref_const CefBrowserSettings settingsObj; @@ -52,6 +54,7 @@ CEF_EXPORT cef_browser_view_t* cef_browser_view_create( // Execute CefRefPtr _retval = CefBrowserView::CreateBrowserView( CefClientCToCpp::Wrap(client), CefString(url), settingsObj, + CefDictionaryValueCppToC::Unwrap(extra_info), CefRequestContextCppToC::Unwrap(request_context), CefBrowserViewDelegateCToCpp::Wrap(delegate)); diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.cc b/libcef_dll/ctocpp/browser_host_ctocpp.cc index c60397791..61d90d0ae 100644 --- a/libcef_dll/ctocpp/browser_host_ctocpp.cc +++ b/libcef_dll/ctocpp/browser_host_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=1357aad2c8a79a3917ca38d93f3ed84712c2d9cd$ +// $hash=0516b8b72819ab4b5a9d6f4c68d774ebde06c94c$ // #include "libcef_dll/ctocpp/browser_host_ctocpp.h" @@ -19,6 +19,7 @@ #include "libcef_dll/cpptoc/pdf_print_callback_cpptoc.h" #include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" #include "libcef_dll/ctocpp/drag_data_ctocpp.h" #include "libcef_dll/ctocpp/extension_ctocpp.h" #include "libcef_dll/ctocpp/navigation_entry_ctocpp.h" @@ -34,16 +35,18 @@ bool CefBrowserHost::CreateBrowser( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { shutdown_checker::AssertNotShutdown(); // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Unverified params: client, url, request_context + // Unverified params: client, url, extra_info, request_context // Execute int _retval = cef_browser_host_create_browser( &windowInfo, CefClientCppToC::Wrap(client), url.GetStruct(), &settings, + CefDictionaryValueCToCpp::Unwrap(extra_info), CefRequestContextCToCpp::Unwrap(request_context)); // Return type: bool @@ -56,16 +59,18 @@ CefRefPtr CefBrowserHost::CreateBrowserSync( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { shutdown_checker::AssertNotShutdown(); // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Unverified params: client, url, request_context + // Unverified params: client, url, extra_info, request_context // Execute cef_browser_t* _retval = cef_browser_host_create_browser_sync( &windowInfo, CefClientCppToC::Wrap(client), url.GetStruct(), &settings, + CefDictionaryValueCToCpp::Unwrap(extra_info), CefRequestContextCToCpp::Unwrap(request_context)); // Return type: refptr_same @@ -964,8 +969,8 @@ void CefBrowserHostCToCpp::DragSourceSystemDragEnded() { } NO_SANITIZE("cfi-icall") -CefRefPtr< - CefNavigationEntry> CefBrowserHostCToCpp::GetVisibleNavigationEntry() { +CefRefPtr +CefBrowserHostCToCpp::GetVisibleNavigationEntry() { shutdown_checker::AssertNotShutdown(); cef_browser_host_t* _struct = GetStruct(); diff --git a/libcef_dll/ctocpp/life_span_handler_ctocpp.cc b/libcef_dll/ctocpp/life_span_handler_ctocpp.cc index 17250b64d..464cbb97e 100644 --- a/libcef_dll/ctocpp/life_span_handler_ctocpp.cc +++ b/libcef_dll/ctocpp/life_span_handler_ctocpp.cc @@ -9,11 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=c203333e32d83a2cfdbbf2aa777f377e1b14ed62$ +// $hash=c90fb460b250ed3b0a8a7f9c1142e51918cedcd5$ // #include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" #include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" #include "libcef_dll/cpptoc/frame_cpptoc.h" #include "libcef_dll/ctocpp/client_ctocpp.h" #include "libcef_dll/shutdown_checker.h" @@ -32,6 +33,7 @@ bool CefLifeSpanHandlerCToCpp::OnBeforePopup( CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) { shutdown_checker::AssertNotShutdown(); @@ -60,6 +62,11 @@ bool CefLifeSpanHandlerCToCpp::OnBeforePopup( if (client.get()) clientStruct = CefClientCToCpp::Unwrap(client); cef_client_t* clientOrig = clientStruct; + // Translate param: extra_info; type: refptr_diff_byref + cef_dictionary_value_t* extra_infoStruct = NULL; + if (extra_info.get()) + extra_infoStruct = CefDictionaryValueCppToC::Wrap(extra_info); + cef_dictionary_value_t* extra_infoOrig = extra_infoStruct; // Translate param: no_javascript_access; type: bool_byaddr int no_javascript_accessInt = no_javascript_access ? *no_javascript_access : 0; @@ -69,7 +76,7 @@ bool CefLifeSpanHandlerCToCpp::OnBeforePopup( _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame), target_url.GetStruct(), target_frame_name.GetStruct(), target_disposition, user_gesture, &popupFeatures, &windowInfo, &clientStruct, &settings, - &no_javascript_accessInt); + &extra_infoStruct, &no_javascript_accessInt); // Restore param:client; type: refptr_same_byref if (clientStruct) { @@ -79,6 +86,14 @@ bool CefLifeSpanHandlerCToCpp::OnBeforePopup( } else { client = NULL; } + // Restore param:extra_info; type: refptr_diff_byref + if (extra_infoStruct) { + if (extra_infoStruct != extra_infoOrig) { + extra_info = CefDictionaryValueCppToC::Unwrap(extra_infoStruct); + } + } else { + extra_info = NULL; + } // Restore param:no_javascript_access; type: bool_byaddr if (no_javascript_access) *no_javascript_access = no_javascript_accessInt ? true : false; diff --git a/libcef_dll/ctocpp/life_span_handler_ctocpp.h b/libcef_dll/ctocpp/life_span_handler_ctocpp.h index 1234294e3..4e48ebaf7 100644 --- a/libcef_dll/ctocpp/life_span_handler_ctocpp.h +++ b/libcef_dll/ctocpp/life_span_handler_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=6684419c997eeb24a3b7e646e51f8164aa98694f$ +// $hash=d9281e31309c3eb8a361dbd33ce16fa6664c27ee$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_LIFE_SPAN_HANDLER_CTOCPP_H_ @@ -47,6 +47,7 @@ class CefLifeSpanHandlerCToCpp CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override; void OnAfterCreated(CefRefPtr browser) override; bool DoClose(CefRefPtr browser) override; diff --git a/libcef_dll/ctocpp/render_process_handler_ctocpp.cc b/libcef_dll/ctocpp/render_process_handler_ctocpp.cc index 16dcdca05..9a1fe2f81 100644 --- a/libcef_dll/ctocpp/render_process_handler_ctocpp.cc +++ b/libcef_dll/ctocpp/render_process_handler_ctocpp.cc @@ -9,11 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=fd9981ab9019e2386f8546d1aad794f2e5862eef$ +// $hash=366d6e567451af19ce5a4cc5f6f06791f504af26$ // #include "libcef_dll/ctocpp/render_process_handler_ctocpp.h" #include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" #include "libcef_dll/cpptoc/domnode_cpptoc.h" #include "libcef_dll/cpptoc/frame_cpptoc.h" #include "libcef_dll/cpptoc/list_value_cpptoc.h" @@ -58,7 +59,8 @@ void CefRenderProcessHandlerCToCpp::OnWebKitInitialized() { NO_SANITIZE("cfi-icall") void CefRenderProcessHandlerCToCpp::OnBrowserCreated( - CefRefPtr browser) { + CefRefPtr browser, + CefRefPtr extra_info) { cef_render_process_handler_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, on_browser_created)) return; @@ -69,9 +71,14 @@ void CefRenderProcessHandlerCToCpp::OnBrowserCreated( DCHECK(browser.get()); if (!browser.get()) return; + // Verify param: extra_info; type: refptr_diff + DCHECK(extra_info.get()); + if (!extra_info.get()) + return; // Execute - _struct->on_browser_created(_struct, CefBrowserCppToC::Wrap(browser)); + _struct->on_browser_created(_struct, CefBrowserCppToC::Wrap(browser), + CefDictionaryValueCppToC::Wrap(extra_info)); } NO_SANITIZE("cfi-icall") diff --git a/libcef_dll/ctocpp/render_process_handler_ctocpp.h b/libcef_dll/ctocpp/render_process_handler_ctocpp.h index 0254274c7..2871ad5fb 100644 --- a/libcef_dll/ctocpp/render_process_handler_ctocpp.h +++ b/libcef_dll/ctocpp/render_process_handler_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=dc669eaed42b1df11eb0df08dc22af0e825a991f$ +// $hash=c8931d822a351fe827ffd29ba89b888e3e44f6ea$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_PROCESS_HANDLER_CTOCPP_H_ @@ -37,7 +37,8 @@ class CefRenderProcessHandlerCToCpp // CefRenderProcessHandler methods. void OnRenderThreadCreated(CefRefPtr extra_info) override; void OnWebKitInitialized() override; - void OnBrowserCreated(CefRefPtr browser) override; + void OnBrowserCreated(CefRefPtr browser, + CefRefPtr extra_info) override; void OnBrowserDestroyed(CefRefPtr browser) override; CefRefPtr GetLoadHandler() override; void OnContextCreated(CefRefPtr browser, diff --git a/libcef_dll/ctocpp/views/browser_view_ctocpp.cc b/libcef_dll/ctocpp/views/browser_view_ctocpp.cc index d583bbd8d..4d280f144 100644 --- a/libcef_dll/ctocpp/views/browser_view_ctocpp.cc +++ b/libcef_dll/ctocpp/views/browser_view_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=034f21943c2bddc00cb1b7da090bef19b6ca6065$ +// $hash=38a50fce9d7126ab95a471e1de31809792ce50da$ // #include "libcef_dll/ctocpp/views/browser_view_ctocpp.h" @@ -17,6 +17,7 @@ #include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h" #include "libcef_dll/cpptoc/views/view_delegate_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" #include "libcef_dll/ctocpp/request_context_ctocpp.h" #include "libcef_dll/ctocpp/views/button_ctocpp.h" #include "libcef_dll/ctocpp/views/panel_ctocpp.h" @@ -33,17 +34,19 @@ CefRefPtr CefBrowserView::CreateBrowserView( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate) { shutdown_checker::AssertNotShutdown(); // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Unverified params: client, url, request_context, delegate + // Unverified params: client, url, extra_info, request_context, delegate // Execute cef_browser_view_t* _retval = cef_browser_view_create( CefClientCppToC::Wrap(client), url.GetStruct(), &settings, + CefDictionaryValueCToCpp::Unwrap(extra_info), CefRequestContextCToCpp::Unwrap(request_context), CefBrowserViewDelegateCppToC::Wrap(delegate)); diff --git a/libcef_dll/views_stub.cc b/libcef_dll/views_stub.cc index d4f882d89..0366776e9 100644 --- a/libcef_dll/views_stub.cc +++ b/libcef_dll/views_stub.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=3639cede4bdba16cae273a2137867f9c5ac53fe8$ +// $hash=03444846894791bdea24dbd8b059570cda5b801f$ // #include "include/views/cef_browser_view.h" @@ -30,6 +30,7 @@ CefRefPtr CefBrowserView::CreateBrowserView( CefRefPtr client, const CefString& url, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, CefRefPtr delegate) { NOTIMPLEMENTED(); diff --git a/libcef_dll/wrapper/libcef_dll_dylib.cc b/libcef_dll/wrapper/libcef_dll_dylib.cc index 17634839b..e47601b18 100644 --- a/libcef_dll/wrapper/libcef_dll_dylib.cc +++ b/libcef_dll/wrapper/libcef_dll_dylib.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=7c87ef36c39355a02bb9544b8228acac7a7abee9$ +// $hash=436002ae114825124a9a52a24928a974fcf5408a$ // #include @@ -186,12 +186,14 @@ typedef int (*cef_browser_host_create_browser_ptr)( struct _cef_client_t*, const cef_string_t*, const struct _cef_browser_settings_t*, + struct _cef_dictionary_value_t*, struct _cef_request_context_t*); typedef struct _cef_browser_t* (*cef_browser_host_create_browser_sync_ptr)( const struct _cef_window_info_t*, struct _cef_client_t*, const cef_string_t*, const struct _cef_browser_settings_t*, + struct _cef_dictionary_value_t*, struct _cef_request_context_t*); typedef struct _cef_command_line_t* (*cef_command_line_create_ptr)(); typedef struct _cef_command_line_t* (*cef_command_line_get_global_ptr)(); @@ -301,6 +303,7 @@ typedef struct _cef_browser_view_t* (*cef_browser_view_create_ptr)( struct _cef_client_t*, const cef_string_t*, const struct _cef_browser_settings_t*, + struct _cef_dictionary_value_t*, struct _cef_request_context_t*, struct _cef_browser_view_delegate_t*); typedef struct _cef_browser_view_t* (*cef_browser_view_get_for_browser_ptr)( @@ -1267,9 +1270,10 @@ int cef_browser_host_create_browser( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context) { return g_libcef_pointers.cef_browser_host_create_browser( - windowInfo, client, url, settings, request_context); + windowInfo, client, url, settings, extra_info, request_context); } NO_SANITIZE("cfi-icall") @@ -1278,9 +1282,10 @@ struct _cef_browser_t* cef_browser_host_create_browser_sync( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context) { return g_libcef_pointers.cef_browser_host_create_browser_sync( - windowInfo, client, url, settings, request_context); + windowInfo, client, url, settings, extra_info, request_context); } NO_SANITIZE("cfi-icall") struct _cef_command_line_t* cef_command_line_create() { @@ -1616,10 +1621,11 @@ struct _cef_browser_view_t* cef_browser_view_create( struct _cef_client_t* client, const cef_string_t* url, const struct _cef_browser_settings_t* settings, + struct _cef_dictionary_value_t* extra_info, struct _cef_request_context_t* request_context, struct _cef_browser_view_delegate_t* delegate) { - return g_libcef_pointers.cef_browser_view_create(client, url, settings, - request_context, delegate); + return g_libcef_pointers.cef_browser_view_create( + client, url, settings, extra_info, request_context, delegate); } NO_SANITIZE("cfi-icall") diff --git a/tests/cefclient/browser/browser_window.h b/tests/cefclient/browser/browser_window.h index 40c738b41..a003ede51 100644 --- a/tests/cefclient/browser/browser_window.h +++ b/tests/cefclient/browser/browser_window.h @@ -60,6 +60,7 @@ class BrowserWindow : public ClientHandler::Delegate { virtual void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) = 0; // Retrieve the configuration that will be used when creating a popup window. diff --git a/tests/cefclient/browser/browser_window_osr_gtk.cc b/tests/cefclient/browser/browser_window_osr_gtk.cc index 1be76c1d0..d2f09b15b 100644 --- a/tests/cefclient/browser/browser_window_osr_gtk.cc +++ b/tests/cefclient/browser/browser_window_osr_gtk.cc @@ -1001,6 +1001,7 @@ void BrowserWindowOsrGtk::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); @@ -1021,7 +1022,7 @@ void BrowserWindowOsrGtk::CreateBrowser( // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, client_handler_, client_handler_->startup_url(), settings, - request_context); + extra_info, request_context); } void BrowserWindowOsrGtk::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_osr_gtk.h b/tests/cefclient/browser/browser_window_osr_gtk.h index 8c63d4201..33083e0f2 100644 --- a/tests/cefclient/browser/browser_window_osr_gtk.h +++ b/tests/cefclient/browser/browser_window_osr_gtk.h @@ -35,6 +35,7 @@ class BrowserWindowOsrGtk : public BrowserWindow, void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/browser_window_osr_mac.h b/tests/cefclient/browser/browser_window_osr_mac.h index 2562f77e6..be422134f 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.h +++ b/tests/cefclient/browser/browser_window_osr_mac.h @@ -32,6 +32,7 @@ class BrowserWindowOsrMac : public BrowserWindow, void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/browser_window_osr_mac.mm b/tests/cefclient/browser/browser_window_osr_mac.mm index c830e233c..e5c988c4a 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.mm +++ b/tests/cefclient/browser/browser_window_osr_mac.mm @@ -1374,6 +1374,7 @@ void BrowserWindowOsrMacImpl::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); @@ -1387,7 +1388,7 @@ void BrowserWindowOsrMacImpl::CreateBrowser( // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, browser_window_.client_handler_, browser_window_.client_handler_->startup_url(), - settings, request_context); + settings, extra_info, request_context); } void BrowserWindowOsrMacImpl::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_osr_win.cc b/tests/cefclient/browser/browser_window_osr_win.cc index 796d932ef..8547e1f3b 100644 --- a/tests/cefclient/browser/browser_window_osr_win.cc +++ b/tests/cefclient/browser/browser_window_osr_win.cc @@ -20,13 +20,15 @@ void BrowserWindowOsrWin::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); // Create the new browser and native window on the UI thread. RECT wnd_rect = {rect.x, rect.y, rect.x + rect.width, rect.y + rect.height}; osr_window_->CreateBrowser(parent_handle, wnd_rect, client_handler_, settings, - request_context, client_handler_->startup_url()); + extra_info, request_context, + client_handler_->startup_url()); } void BrowserWindowOsrWin::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_osr_win.h b/tests/cefclient/browser/browser_window_osr_win.h index 3fce9e2f9..9cf302779 100644 --- a/tests/cefclient/browser/browser_window_osr_win.h +++ b/tests/cefclient/browser/browser_window_osr_win.h @@ -27,6 +27,7 @@ class BrowserWindowOsrWin : public BrowserWindow, void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/browser_window_std_gtk.cc b/tests/cefclient/browser/browser_window_std_gtk.cc index 30ca8f14f..4810f527f 100644 --- a/tests/cefclient/browser/browser_window_std_gtk.cc +++ b/tests/cefclient/browser/browser_window_std_gtk.cc @@ -97,6 +97,7 @@ void BrowserWindowStdGtk::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); @@ -105,7 +106,7 @@ void BrowserWindowStdGtk::CreateBrowser( CefBrowserHost::CreateBrowser(window_info, client_handler_, client_handler_->startup_url(), settings, - request_context); + extra_info, request_context); } void BrowserWindowStdGtk::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_std_gtk.h b/tests/cefclient/browser/browser_window_std_gtk.h index 47a944ed4..300f37fd1 100644 --- a/tests/cefclient/browser/browser_window_std_gtk.h +++ b/tests/cefclient/browser/browser_window_std_gtk.h @@ -26,6 +26,7 @@ class BrowserWindowStdGtk : public BrowserWindow { void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/browser_window_std_mac.h b/tests/cefclient/browser/browser_window_std_mac.h index 832e13f73..853b61678 100644 --- a/tests/cefclient/browser/browser_window_std_mac.h +++ b/tests/cefclient/browser/browser_window_std_mac.h @@ -23,6 +23,7 @@ class BrowserWindowStdMac : public BrowserWindow { void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/browser_window_std_mac.mm b/tests/cefclient/browser/browser_window_std_mac.mm index f83512457..c02bb3258 100644 --- a/tests/cefclient/browser/browser_window_std_mac.mm +++ b/tests/cefclient/browser/browser_window_std_mac.mm @@ -22,6 +22,7 @@ void BrowserWindowStdMac::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); @@ -31,7 +32,7 @@ void BrowserWindowStdMac::CreateBrowser( CefBrowserHost::CreateBrowser(window_info, client_handler_, client_handler_->startup_url(), settings, - request_context); + extra_info, request_context); } void BrowserWindowStdMac::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_std_win.cc b/tests/cefclient/browser/browser_window_std_win.cc index fa7ee028c..f1e53d696 100644 --- a/tests/cefclient/browser/browser_window_std_win.cc +++ b/tests/cefclient/browser/browser_window_std_win.cc @@ -19,6 +19,7 @@ void BrowserWindowStdWin::CreateBrowser( ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) { REQUIRE_MAIN_THREAD(); @@ -33,7 +34,7 @@ void BrowserWindowStdWin::CreateBrowser( CefBrowserHost::CreateBrowser(window_info, client_handler_, client_handler_->startup_url(), settings, - request_context); + extra_info, request_context); } void BrowserWindowStdWin::GetPopupConfig(CefWindowHandle temp_handle, diff --git a/tests/cefclient/browser/browser_window_std_win.h b/tests/cefclient/browser/browser_window_std_win.h index c778b25ad..8c8bef2bc 100644 --- a/tests/cefclient/browser/browser_window_std_win.h +++ b/tests/cefclient/browser/browser_window_std_win.h @@ -23,6 +23,7 @@ class BrowserWindowStdWin : public BrowserWindow { void CreateBrowser(ClientWindowHandle parent_handle, const CefRect& rect, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context) OVERRIDE; void GetPopupConfig(CefWindowHandle temp_handle, CefWindowInfo& windowInfo, diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index 8c2aca27c..f01f6a0f6 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -545,6 +545,7 @@ bool ClientHandler::OnBeforePopup( CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) { CEF_REQUIRE_UI_THREAD(); diff --git a/tests/cefclient/browser/client_handler.h b/tests/cefclient/browser/client_handler.h index 293698dac..34b52ffce 100644 --- a/tests/cefclient/browser/client_handler.h +++ b/tests/cefclient/browser/client_handler.h @@ -190,6 +190,7 @@ class ClientHandler : public CefClient, CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) OVERRIDE; void OnAfterCreated(CefRefPtr browser) OVERRIDE; bool DoClose(CefRefPtr browser) OVERRIDE; diff --git a/tests/cefclient/browser/osr_window_win.cc b/tests/cefclient/browser/osr_window_win.cc index 9f366708e..7a5e78cb6 100644 --- a/tests/cefclient/browser/osr_window_win.cc +++ b/tests/cefclient/browser/osr_window_win.cc @@ -50,6 +50,35 @@ bool IsMouseEventFromTouch(UINT message) { MOUSEEVENTF_FROMTOUCH; } +class CreateBrowserHelper { + public: + CreateBrowserHelper(HWND hwnd, + const RECT& rect, + CefRefPtr handler, + const std::string& url, + const CefBrowserSettings& settings, + CefRefPtr extra_info, + CefRefPtr request_context, + OsrWindowWin* osr_window_win) + : hwnd_(hwnd), + rect_(rect), + handler_(handler), + url_(url), + settings_(settings), + extra_info_(extra_info), + request_context_(request_context), + osr_window_win_(osr_window_win) {} + + HWND hwnd_; + RECT rect_; + CefRefPtr handler_; + std::string url_; + CefBrowserSettings settings_; + CefRefPtr extra_info_; + CefRefPtr request_context_; + OsrWindowWin* osr_window_win_; +}; + } // namespace OsrWindowWin::OsrWindowWin(Delegate* delegate, @@ -79,17 +108,26 @@ OsrWindowWin::~OsrWindowWin() { DCHECK(!hwnd_ && !render_handler_.get()); } +void CreateBrowserWithHelper(CreateBrowserHelper* helper) { + helper->osr_window_win_->CreateBrowser( + helper->hwnd_, helper->rect_, helper->handler_, helper->settings_, + helper->extra_info_, helper->request_context_, helper->url_); + delete helper; +} + void OsrWindowWin::CreateBrowser(HWND parent_hwnd, const RECT& rect, CefRefPtr handler, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, const std::string& startup_url) { if (!CefCurrentlyOn(TID_UI)) { // Execute this method on the UI thread. - CefPostTask(TID_UI, base::Bind(&OsrWindowWin::CreateBrowser, this, - parent_hwnd, rect, handler, settings, - request_context, startup_url)); + CreateBrowserHelper* helper = + new CreateBrowserHelper(parent_hwnd, rect, handler, startup_url, + settings, extra_info, request_context, this); + CefPostTask(TID_UI, base::Bind(CreateBrowserWithHelper, helper)); return; } @@ -110,7 +148,7 @@ void OsrWindowWin::CreateBrowser(HWND parent_hwnd, // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, handler, startup_url, settings, - request_context); + extra_info, request_context); } void OsrWindowWin::ShowPopup(HWND parent_hwnd, diff --git a/tests/cefclient/browser/osr_window_win.h b/tests/cefclient/browser/osr_window_win.h index 642dc69d8..0955ebc49 100644 --- a/tests/cefclient/browser/osr_window_win.h +++ b/tests/cefclient/browser/osr_window_win.h @@ -52,6 +52,7 @@ class OsrWindowWin const RECT& rect, CefRefPtr handler, const CefBrowserSettings& settings, + CefRefPtr extra_info, CefRefPtr request_context, const std::string& startup_url); diff --git a/tests/cefclient/browser/root_window_gtk.cc b/tests/cefclient/browser/root_window_gtk.cc index 45a1bf2c8..26e29ac72 100644 --- a/tests/cefclient/browser/root_window_gtk.cc +++ b/tests/cefclient/browser/root_window_gtk.cc @@ -380,7 +380,7 @@ void RootWindowGtk::CreateRootWindow(const CefBrowserSettings& settings, if (!is_popup_) { // Create the browser window. - browser_window_->CreateBrowser(parent, browser_bounds_, settings, + browser_window_->CreateBrowser(parent, browser_bounds_, settings, NULL, delegate_->GetRequestContext(this)); } else { // With popups we already have a browser window. Parent the browser window diff --git a/tests/cefclient/browser/root_window_mac.mm b/tests/cefclient/browser/root_window_mac.mm index 5bb23d2e2..6595407f4 100644 --- a/tests/cefclient/browser/root_window_mac.mm +++ b/tests/cefclient/browser/root_window_mac.mm @@ -487,7 +487,7 @@ void RootWindowMacImpl::CreateRootWindow(const CefBrowserSettings& settings, // Create the browser window. browser_window_->CreateBrowser( CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(contentView), - CefRect(0, 0, width, height), settings, + CefRect(0, 0, width, height), settings, NULL, root_window_.delegate_->GetRequestContext(&root_window_)); } else { // With popups we already have a browser window. Parent the browser window diff --git a/tests/cefclient/browser/root_window_win.cc b/tests/cefclient/browser/root_window_win.cc index d48e101e0..492efeedc 100644 --- a/tests/cefclient/browser/root_window_win.cc +++ b/tests/cefclient/browser/root_window_win.cc @@ -949,7 +949,7 @@ void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) { // Create the browser window. CefRect cef_rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); - browser_window_->CreateBrowser(hwnd_, cef_rect, browser_settings_, + browser_window_->CreateBrowser(hwnd_, cef_rect, browser_settings_, NULL, delegate_->GetRequestContext(this)); } else { // With popups we already have a browser window. Parent the browser window diff --git a/tests/cefclient/browser/views_window.cc b/tests/cefclient/browser/views_window.cc index 619541169..26f1f0fdf 100644 --- a/tests/cefclient/browser/views_window.cc +++ b/tests/cefclient/browser/views_window.cc @@ -116,7 +116,7 @@ CefRefPtr ViewsWindow::Create( // Create a new BrowserView. CefRefPtr browser_view = CefBrowserView::CreateBrowserView( - client, url, settings, request_context, views_window); + client, url, settings, NULL, request_context, views_window); // Associate the BrowserView with the ViewsWindow. views_window->SetBrowserView(browser_view); diff --git a/tests/cefsimple/simple_app.cc b/tests/cefsimple/simple_app.cc index 5d824ee5d..289da9455 100644 --- a/tests/cefsimple/simple_app.cc +++ b/tests/cefsimple/simple_app.cc @@ -91,7 +91,7 @@ void SimpleApp::OnContextInitialized() { if (use_views) { // Create the BrowserView. CefRefPtr browser_view = CefBrowserView::CreateBrowserView( - handler, url, browser_settings, NULL, NULL); + handler, url, browser_settings, NULL, NULL, NULL); // Create the Window. It will show itself after creation. CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view)); @@ -107,6 +107,6 @@ void SimpleApp::OnContextInitialized() { // Create the first browser window. CefBrowserHost::CreateBrowser(window_info, handler, url, browser_settings, - NULL); + NULL, NULL); } } diff --git a/tests/ceftests/navigation_unittest.cc b/tests/ceftests/navigation_unittest.cc index ad50e73e8..3b027e54d 100644 --- a/tests/ceftests/navigation_unittest.cc +++ b/tests/ceftests/navigation_unittest.cc @@ -1216,7 +1216,8 @@ class OrderNavRendererTest : public ClientAppRenderer::Delegate, } void OnBrowserCreated(CefRefPtr app, - CefRefPtr browser) override { + CefRefPtr browser, + CefRefPtr extra_info) override { if (!run_test_) return; @@ -1706,7 +1707,8 @@ class LoadNavRendererTest : public ClientAppRenderer::Delegate, } void OnBrowserCreated(CefRefPtr app, - CefRefPtr browser) override { + CefRefPtr browser, + CefRefPtr extra_info) override { if (!run_test_) return; @@ -2251,6 +2253,7 @@ class PopupSimultaneousTestHandler : public TestHandler { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override { const std::string& url = target_url; EXPECT_LT(before_popup_ct_, kSimultPopupCount); @@ -2392,6 +2395,7 @@ class PopupJSWindowOpenTestHandler : public TestHandler { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override { before_popup_ct_++; return false; @@ -2529,6 +2533,7 @@ class PopupJSWindowEmptyTestHandler : public TestHandler { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override { got_before_popup_.yes(); return false; @@ -3415,12 +3420,206 @@ TEST(NavigationTest, CancelAfterCommit) { ReleaseAndWaitForDestructor(handler); } +namespace { + +const char kExtraInfoUrl[] = "http://tests-extrainfonav.com/extra.html"; +const char kExtraInfoPopupUrl[] = + "http://tests-extrainfonav.com/extra_popup.html"; +const char kExtraInfoNavMsg[] = "NavigationTest.ExtraInfoNav"; + +bool g_extra_info_nav_test = false; + +void SetBrowserExtraInfo(CefRefPtr extra_info) { + // Arbitrary data for testing. + extra_info->SetBool("bool", true); + CefRefPtr dict = CefDictionaryValue::Create(); + dict->SetInt("key1", 5); + dict->SetString("key2", "test string"); + extra_info->SetDictionary("dictionary", dict); + extra_info->SetDouble("double", 5.43322); + extra_info->SetString("string", "some string"); +} + +// Browser side. +class ExtraInfoNavBrowserTest : public ClientAppBrowser::Delegate { + public: + ExtraInfoNavBrowserTest() {} + + void OnBeforeChildProcessLaunch( + CefRefPtr app, + CefRefPtr command_line) override { + if (!g_extra_info_nav_test) + return; + + // Indicate to the render process that the test should be run. + command_line->AppendSwitchWithValue("test", kExtraInfoNavMsg); + } + + protected: + IMPLEMENT_REFCOUNTING(ExtraInfoNavBrowserTest); +}; + +// Renderer side +class ExtraInfoNavRendererTest : public ClientAppRenderer::Delegate { + public: + ExtraInfoNavRendererTest() : run_test_(false) {} + + void OnRenderThreadCreated(CefRefPtr app, + CefRefPtr extra_info) override { + // Check that the test should be run. + CefRefPtr command_line = + CefCommandLine::GetGlobalCommandLine(); + const std::string& test = command_line->GetSwitchValue("test"); + if (test != kExtraInfoNavMsg) + return; + + run_test_ = true; + } + + void OnBrowserCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr extra_info) override { + if (!run_test_) + return; + + CefRefPtr expected = CefDictionaryValue::Create(); + SetBrowserExtraInfo(expected); + TestDictionaryEqual(expected, extra_info); + + SendTestResults(browser); + } + + protected: + // Send the test results. + void SendTestResults(CefRefPtr browser) { + // Check if the test has failed. + bool result = !TestFailed(); + + CefRefPtr return_msg = + CefProcessMessage::Create(kExtraInfoNavMsg); + CefRefPtr args = return_msg->GetArgumentList(); + EXPECT_TRUE(args.get()); + EXPECT_TRUE(args->SetBool(0, result)); + EXPECT_TRUE(args->SetBool(1, browser->IsPopup())); + EXPECT_TRUE(browser->SendProcessMessage(PID_BROWSER, return_msg)); + } + + bool run_test_; + + IMPLEMENT_REFCOUNTING(ExtraInfoNavRendererTest); +}; + +class ExtraInfoNavTestHandler : public TestHandler { + public: + ExtraInfoNavTestHandler() : popup_opened_(false) {} + + void RunTest() override { + AddResource(kExtraInfoUrl, + "ExtraInfo", + "text/html"); + AddResource(kExtraInfoPopupUrl, "ExtraInfoPopup", "text/html"); + + CefRefPtr extra = CefDictionaryValue::Create(); + SetBrowserExtraInfo(extra); + + // Create the browser. + CreateBrowser(kExtraInfoUrl, NULL, extra); + + // Time out the test after a reasonable period of time. + SetTestTimeout(); + } + + void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) override { + if (popup_opened_) { + DestroyTest(); + } else { + browser->GetMainFrame()->ExecuteJavaScript( + "window.open('" + std::string(kExtraInfoPopupUrl) + "');", + CefString(), 0); + } + } + + bool OnBeforePopup(CefRefPtr browser, + CefRefPtr frame, + const CefString& target_url, + const CefString& target_frame_name, + cef_window_open_disposition_t target_disposition, + bool user_gesture, + const CefPopupFeatures& popupFeatures, + CefWindowInfo& windowInfo, + CefRefPtr& client, + CefBrowserSettings& settings, + CefRefPtr& extra_info, + bool* no_javascript_access) override { + const std::string& url = target_url; + EXPECT_FALSE(popup_opened_); + EXPECT_STREQ(kExtraInfoPopupUrl, url.c_str()); + + CefRefPtr extra = CefDictionaryValue::Create(); + SetBrowserExtraInfo(extra); + + extra_info = extra; + + popup_opened_ = true; + return false; + } + + bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) override { + if (message->GetName().ToString() == kExtraInfoNavMsg) { + // Test that the renderer side succeeded. + CefRefPtr args = message->GetArgumentList(); + EXPECT_TRUE(args.get()); + EXPECT_TRUE(args->GetBool(0)); + if (popup_opened_) { + EXPECT_TRUE(args->GetBool(1)); + got_process_message_popup_.yes(); + } else { + EXPECT_FALSE(args->GetBool(1)); + got_process_message_main_.yes(); + } + return true; + } + + // Message not handled. + return false; + } + + protected: + bool popup_opened_; + TrackCallback got_process_message_main_; + TrackCallback got_process_message_popup_; + + void DestroyTest() override { + // Verify test expectations. + EXPECT_TRUE(got_process_message_main_); + EXPECT_TRUE(got_process_message_popup_); + + TestHandler::DestroyTest(); + } + + IMPLEMENT_REFCOUNTING(ExtraInfoNavTestHandler); +}; +} // namespace + +TEST(NavigationTest, ExtraInfo) { + g_extra_info_nav_test = true; + CefRefPtr handler = new ExtraInfoNavTestHandler(); + handler->ExecuteTest(); + g_extra_info_nav_test = false; + ReleaseAndWaitForDestructor(handler); +} + // Entry point for creating navigation browser test objects. // Called from client_app_delegates.cc. void CreateNavigationBrowserTests(ClientAppBrowser::DelegateSet& delegates) { delegates.insert(new HistoryNavBrowserTest); delegates.insert(new OrderNavBrowserTest); delegates.insert(new LoadNavBrowserTest); + delegates.insert(new ExtraInfoNavBrowserTest); } // Entry point for creating navigation renderer test objects. @@ -3429,4 +3628,5 @@ void CreateNavigationRendererTests(ClientAppRenderer::DelegateSet& delegates) { delegates.insert(new HistoryNavRendererTest); delegates.insert(new OrderNavRendererTest); delegates.insert(new LoadNavRendererTest); + delegates.insert(new ExtraInfoNavRendererTest); } diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index f9cbbea68..b9c8398ff 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -826,10 +826,8 @@ class OSRTestHandler : public RoutingTestHandler, EXPECT_EQ(0, dirtyRects[0].x); EXPECT_EQ(0, dirtyRects[0].y); if (ExpectComputedPopupSize()) { - EXPECT_EQ(expanded_select_rect.width, - dirtyRects[0].width); - EXPECT_EQ(expanded_select_rect.height, - dirtyRects[0].height); + EXPECT_EQ(expanded_select_rect.width, dirtyRects[0].width); + EXPECT_EQ(expanded_select_rect.height, dirtyRects[0].height); } else { EXPECT_GT(dirtyRects[0].width, kExpandedSelectRect.width); EXPECT_GT(dirtyRects[0].height, kExpandedSelectRect.height); @@ -1333,7 +1331,7 @@ class OSRTestHandler : public RoutingTestHandler, #else #error "Unsupported platform" #endif - CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL); + CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL, NULL); } CefRect GetScaledRect(const CefRect& rect) const { diff --git a/tests/ceftests/osr_accessibility_unittest.cc b/tests/ceftests/osr_accessibility_unittest.cc index a943735ff..0354b5a7d 100644 --- a/tests/ceftests/osr_accessibility_unittest.cc +++ b/tests/ceftests/osr_accessibility_unittest.cc @@ -224,7 +224,7 @@ class AccessibilityTestHandler : public TestHandler, #else #error "Unsupported platform" #endif - CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL); + CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL, NULL); } void HideEditBox(CefRefPtr browser) { diff --git a/tests/ceftests/osr_display_unittest.cc b/tests/ceftests/osr_display_unittest.cc index a95b5b9a9..8fc5269ba 100644 --- a/tests/ceftests/osr_display_unittest.cc +++ b/tests/ceftests/osr_display_unittest.cc @@ -112,7 +112,7 @@ class DisplayTestHandler : public RoutingTestHandler, public CefRenderHandler { windowInfo.SetAsWindowless(kNullWindowHandle); #endif - CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL); + CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, NULL, NULL); } std::string GetPageContents(const std::string& name, diff --git a/tests/ceftests/request_context_unittest.cc b/tests/ceftests/request_context_unittest.cc index 37c8a9f7c..029d62c5f 100644 --- a/tests/ceftests/request_context_unittest.cc +++ b/tests/ceftests/request_context_unittest.cc @@ -287,6 +287,7 @@ class PopupTestHandler : public TestHandler { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override { got_on_before_popup_.yes(); @@ -499,6 +500,7 @@ class PopupNavTestHandler : public TestHandler { CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, + CefRefPtr& extra_info, bool* no_javascript_access) override { EXPECT_FALSE(got_on_before_popup_); got_on_before_popup_.yes(); diff --git a/tests/ceftests/test_handler.cc b/tests/ceftests/test_handler.cc index 8e14fb771..1a4f83dd3 100644 --- a/tests/ceftests/test_handler.cc +++ b/tests/ceftests/test_handler.cc @@ -357,14 +357,15 @@ void TestHandler::OnTestTimeout(int timeout_ms, bool treat_as_error) { } void TestHandler::CreateBrowser(const CefString& url, - CefRefPtr request_context) { + CefRefPtr request_context, + CefRefPtr extra_info) { #if defined(USE_AURA) const bool use_views = CefCommandLine::GetGlobalCommandLine()->HasSwitch( client::switches::kUseViews); if (use_views && !CefCurrentlyOn(TID_UI)) { // Views classes must be accessed on the UI thread. CefPostTask(TID_UI, base::Bind(&TestHandler::CreateBrowser, this, url, - request_context)); + request_context, extra_info)); return; } #endif // defined(USE_AURA) @@ -377,7 +378,8 @@ void TestHandler::CreateBrowser(const CefString& url, if (use_views) { // Create the BrowserView. CefRefPtr browser_view = CefBrowserView::CreateBrowserView( - this, url, settings, request_context, new TestBrowserViewDelegate()); + this, url, settings, extra_info, request_context, + new TestBrowserViewDelegate()); // Create the Window. It will show itself after creation. TestWindowDelegate::CreateBrowserWindow(browser_view, std::string()); @@ -388,7 +390,7 @@ void TestHandler::CreateBrowser(const CefString& url, windowInfo.SetAsPopup(NULL, "CefUnitTest"); windowInfo.style |= WS_VISIBLE; #endif - CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, + CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, extra_info, request_context); } } diff --git a/tests/ceftests/test_handler.h b/tests/ceftests/test_handler.h index d23639c28..6c7681dfb 100644 --- a/tests/ceftests/test_handler.h +++ b/tests/ceftests/test_handler.h @@ -246,7 +246,8 @@ class TestHandler : public CefClient, virtual void PopulateBrowserSettings(CefBrowserSettings* settings) {} void CreateBrowser(const CefString& url, - CefRefPtr request_context = NULL); + CefRefPtr request_context = NULL, + CefRefPtr extra_info = NULL); static void CloseBrowser(CefRefPtr browser, bool force_close); void AddResource(const std::string& url, diff --git a/tests/ceftests/v8_unittest.cc b/tests/ceftests/v8_unittest.cc index 97bff8cdb..e3c9c969c 100644 --- a/tests/ceftests/v8_unittest.cc +++ b/tests/ceftests/v8_unittest.cc @@ -2498,7 +2498,8 @@ class V8RendererTest : public ClientAppRenderer::Delegate, } void OnBrowserCreated(CefRefPtr app, - CefRefPtr browser) override { + CefRefPtr browser, + CefRefPtr extra_info) override { test_mode_ = g_current_test_mode; if (test_mode_ == V8TEST_NONE) { // Retrieve the test mode from the command line. diff --git a/tests/shared/renderer/client_app_renderer.cc b/tests/shared/renderer/client_app_renderer.cc index 73b205573..96ac30620 100644 --- a/tests/shared/renderer/client_app_renderer.cc +++ b/tests/shared/renderer/client_app_renderer.cc @@ -25,10 +25,12 @@ void ClientAppRenderer::OnWebKitInitialized() { (*it)->OnWebKitInitialized(this); } -void ClientAppRenderer::OnBrowserCreated(CefRefPtr browser) { +void ClientAppRenderer::OnBrowserCreated( + CefRefPtr browser, + CefRefPtr extra_info) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) - (*it)->OnBrowserCreated(this, browser); + (*it)->OnBrowserCreated(this, browser, extra_info); } void ClientAppRenderer::OnBrowserDestroyed(CefRefPtr browser) { diff --git a/tests/shared/renderer/client_app_renderer.h b/tests/shared/renderer/client_app_renderer.h index f8d989342..1e4b3bb98 100644 --- a/tests/shared/renderer/client_app_renderer.h +++ b/tests/shared/renderer/client_app_renderer.h @@ -26,7 +26,8 @@ class ClientAppRenderer : public ClientApp, public CefRenderProcessHandler { virtual void OnWebKitInitialized(CefRefPtr app) {} virtual void OnBrowserCreated(CefRefPtr app, - CefRefPtr browser) {} + CefRefPtr browser, + CefRefPtr extra_info) {} virtual void OnBrowserDestroyed(CefRefPtr app, CefRefPtr browser) {} @@ -88,7 +89,8 @@ class ClientAppRenderer : public ClientApp, public CefRenderProcessHandler { // CefRenderProcessHandler methods. void OnRenderThreadCreated(CefRefPtr extra_info) OVERRIDE; void OnWebKitInitialized() OVERRIDE; - void OnBrowserCreated(CefRefPtr browser) OVERRIDE; + void OnBrowserCreated(CefRefPtr browser, + CefRefPtr extra_info) OVERRIDE; void OnBrowserDestroyed(CefRefPtr browser) OVERRIDE; CefRefPtr GetLoadHandler() OVERRIDE; void OnContextCreated(CefRefPtr browser, diff --git a/tools/cef_parser.py b/tools/cef_parser.py index 9266322a1..409687cec 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -92,6 +92,7 @@ def get_comment(body, name): result = [] pos = body.find(name) + in_block_comment = False while pos > 0: data = get_prev_line(body, pos) line = string.strip(data['line']) @@ -104,7 +105,18 @@ def get_comment(body, name): result.append(None) else: break - elif line[0:2] == '/*' or line[-2:] == '*/': + # single line /*--cef()--*/ + elif line[0:2] == '/*' and line[-2:] == '*/': + continue + # start of multi line /*--cef()--*/ + elif in_block_comment and line[0:2] == '/*': + in_block_comment = False + continue + # end of multi line /*--cef()--*/ + elif not in_block_comment and line[-2:] == '*/': + in_block_comment = True + continue + elif in_block_comment: continue elif line[0:2] == '//': # keep the comment line including any leading spaces