mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add |extra_info| parameter for browser creation (fixes issue #1088)
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.
This commit is contained in:
committed by
Marshall Greenblatt
parent
ad4ce5f441
commit
473c29a70d
@ -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<CefBrowser> _retval = CefBrowserHost::CreateBrowserSync(
|
||||
windowInfoObj, CefClientCToCpp::Wrap(client), CefString(url), settingsObj,
|
||||
CefDictionaryValueCppToC::Unwrap(extra_info),
|
||||
CefRequestContextCppToC::Unwrap(request_context));
|
||||
|
||||
// Return type: refptr_same
|
||||
|
@ -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<CefDictionaryValue> 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;
|
||||
|
@ -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(
|
||||
|
@ -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<CefBrowserView> _retval = CefBrowserView::CreateBrowserView(
|
||||
CefClientCToCpp::Wrap(client), CefString(url), settingsObj,
|
||||
CefDictionaryValueCppToC::Unwrap(extra_info),
|
||||
CefRequestContextCppToC::Unwrap(request_context),
|
||||
CefBrowserViewDelegateCToCpp::Wrap(delegate));
|
||||
|
||||
|
Reference in New Issue
Block a user