Add plugin placeholder and policy support (issue #1708)

- Default plugin loading policy can be specified using the new
  `--plugin-policy=[allow|block|detect]` command-line flag.
- Move CefRequestHandler::OnBeforePluginLoad to
  CefRequestContextHandler and add a new policy argument that
  supports different actions (allow, block, detect, disable) on a
  per-plugin-instance basis.
- Add CefContextMenuHandler::RunContextMenu for providing a custom
  context menu implementation.
- Add CefResourceBundleHandler::GetDataResourceForScale for
  returning scaled resources (issue #1272).
- Add CefResourceBundle for retrieving resources from the resource
  bundle (*.pak) files loaded by CEF during startup or via the
  CefResourceBundleHandler.
- Linux: Fix Debug build IO access warning with CefGetMimeType.
- cef_unittests: Move the refcounting implementation from TestHandler
  to subclasses in order to support interface inheritance from
  subclasses.
This commit is contained in:
Marshall Greenblatt
2015-09-09 16:05:39 +02:00
parent 846107b291
commit dc3aae19e8
114 changed files with 4007 additions and 559 deletions

View File

@@ -15,6 +15,7 @@
#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/ctocpp/menu_model_ctocpp.h"
#include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h"
namespace {
@@ -55,6 +56,49 @@ void CEF_CALLBACK context_menu_handler_on_before_context_menu(
CefMenuModelCToCpp::Wrap(model));
}
int CEF_CALLBACK context_menu_handler_run_context_menu(
struct _cef_context_menu_handler_t* self, cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
struct _cef_menu_model_t* model,
cef_run_context_menu_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
// Verify param: params; type: refptr_diff
DCHECK(params);
if (!params)
return 0;
// Verify param: model; type: refptr_diff
DCHECK(model);
if (!model)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return 0;
// Execute
bool _retval = CefContextMenuHandlerCppToC::Get(self)->RunContextMenu(
CefBrowserCToCpp::Wrap(browser),
CefFrameCToCpp::Wrap(frame),
CefContextMenuParamsCToCpp::Wrap(params),
CefMenuModelCToCpp::Wrap(model),
CefRunContextMenuCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
int CEF_CALLBACK context_menu_handler_on_context_menu_command(
struct _cef_context_menu_handler_t* self, cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
@@ -120,6 +164,7 @@ void CEF_CALLBACK context_menu_handler_on_context_menu_dismissed(
CefContextMenuHandlerCppToC::CefContextMenuHandlerCppToC() {
GetStruct()->on_before_context_menu =
context_menu_handler_on_before_context_menu;
GetStruct()->run_context_menu = context_menu_handler_run_context_menu;
GetStruct()->on_context_menu_command =
context_menu_handler_on_context_menu_command;
GetStruct()->on_context_menu_dismissed =

View File

@@ -308,6 +308,36 @@ cef_context_menu_edit_state_flags_t CEF_CALLBACK context_menu_params_get_edit_st
return _retval;
}
int CEF_CALLBACK context_menu_params_is_custom_menu(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefContextMenuParamsCppToC::Get(self)->IsCustomMenu();
// Return type: bool
return _retval;
}
int CEF_CALLBACK context_menu_params_is_pepper_menu(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefContextMenuParamsCppToC::Get(self)->IsPepperMenu();
// Return type: bool
return _retval;
}
} // namespace
@@ -336,6 +366,8 @@ CefContextMenuParamsCppToC::CefContextMenuParamsCppToC() {
GetStruct()->is_spell_check_enabled =
context_menu_params_is_spell_check_enabled;
GetStruct()->get_edit_state_flags = context_menu_params_get_edit_state_flags;
GetStruct()->is_custom_menu = context_menu_params_is_custom_menu;
GetStruct()->is_pepper_menu = context_menu_params_is_pepper_menu;
}
template<> CefRefPtr<CefContextMenuParams> CefCppToC<CefContextMenuParamsCppToC,

View File

@@ -12,6 +12,7 @@
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
namespace {
@@ -34,6 +35,46 @@ cef_cookie_manager_t* CEF_CALLBACK request_context_handler_get_cookie_manager(
return CefCookieManagerCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK request_context_handler_on_before_plugin_load(
struct _cef_request_context_handler_t* self, const cef_string_t* mime_type,
const cef_string_t* plugin_url, const cef_string_t* top_origin_url,
struct _cef_web_plugin_info_t* plugin_info,
cef_plugin_policy_t* plugin_policy) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: mime_type; type: string_byref_const
DCHECK(mime_type);
if (!mime_type)
return 0;
// Verify param: top_origin_url; type: string_byref_const
DCHECK(top_origin_url);
if (!top_origin_url)
return 0;
// Verify param: plugin_info; type: refptr_diff
DCHECK(plugin_info);
if (!plugin_info)
return 0;
// Verify param: plugin_policy; type: simple_byaddr
DCHECK(plugin_policy);
if (!plugin_policy)
return 0;
// Unverified params: plugin_url
// Execute
bool _retval = CefRequestContextHandlerCppToC::Get(self)->OnBeforePluginLoad(
CefString(mime_type),
CefString(plugin_url),
CefString(top_origin_url),
CefWebPluginInfoCToCpp::Wrap(plugin_info),
plugin_policy);
// Return type: bool
return _retval;
}
} // namespace
@@ -41,6 +82,8 @@ cef_cookie_manager_t* CEF_CALLBACK request_context_handler_get_cookie_manager(
CefRequestContextHandlerCppToC::CefRequestContextHandlerCppToC() {
GetStruct()->get_cookie_manager = request_context_handler_get_cookie_manager;
GetStruct()->on_before_plugin_load =
request_context_handler_on_before_plugin_load;
}
template<> CefRefPtr<CefRequestContextHandler> CefCppToC<CefRequestContextHandlerCppToC,

View File

@@ -19,7 +19,6 @@
#include "libcef_dll/ctocpp/request_callback_ctocpp.h"
#include "libcef_dll/ctocpp/response_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
namespace {
@@ -389,36 +388,6 @@ int CEF_CALLBACK request_handler_on_certificate_error(
return _retval;
}
int CEF_CALLBACK request_handler_on_before_plugin_load(
struct _cef_request_handler_t* self, cef_browser_t* browser,
const cef_string_t* url, const cef_string_t* policy_url,
struct _cef_web_plugin_info_t* info) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: info; type: refptr_diff
DCHECK(info);
if (!info)
return 0;
// Unverified params: url, policy_url
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforePluginLoad(
CefBrowserCToCpp::Wrap(browser),
CefString(url),
CefString(policy_url),
CefWebPluginInfoCToCpp::Wrap(info));
// Return type: bool
return _retval;
}
void CEF_CALLBACK request_handler_on_plugin_crashed(
struct _cef_request_handler_t* self, cef_browser_t* browser,
const cef_string_t* plugin_path) {
@@ -495,7 +464,6 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC() {
GetStruct()->on_quota_request = request_handler_on_quota_request;
GetStruct()->on_protocol_execution = request_handler_on_protocol_execution;
GetStruct()->on_certificate_error = request_handler_on_certificate_error;
GetStruct()->on_before_plugin_load = request_handler_on_before_plugin_load;
GetStruct()->on_plugin_crashed = request_handler_on_plugin_crashed;
GetStruct()->on_render_view_ready = request_handler_on_render_view_ready;
GetStruct()->on_render_process_terminated =

View File

@@ -0,0 +1,153 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/resource_bundle_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_resource_bundle_t* cef_resource_bundle_get_global() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefResourceBundle> _retval = CefResourceBundle::GetGlobal();
// Return type: refptr_same
return CefResourceBundleCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK resource_bundle_get_localized_string(
struct _cef_resource_bundle_t* self, int string_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefResourceBundleCppToC::Get(self)->GetLocalizedString(
string_id);
// Return type: string
return _retval.DetachToUserFree();
}
int CEF_CALLBACK resource_bundle_get_data_resource(
struct _cef_resource_bundle_t* self, int resource_id, void** data,
size_t* data_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: data; type: simple_byref
DCHECK(data);
if (!data)
return 0;
// Verify param: data_size; type: simple_byref
DCHECK(data_size);
if (!data_size)
return 0;
// Translate param: data; type: simple_byref
void* dataVal = data?*data:NULL;
// Translate param: data_size; type: simple_byref
size_t data_sizeVal = data_size?*data_size:0;
// Execute
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResource(
resource_id,
dataVal,
data_sizeVal);
// Restore param: data; type: simple_byref
if (data)
*data = dataVal;
// Restore param: data_size; type: simple_byref
if (data_size)
*data_size = data_sizeVal;
// Return type: bool
return _retval;
}
int CEF_CALLBACK resource_bundle_get_data_resource_for_scale(
struct _cef_resource_bundle_t* self, int resource_id,
cef_scale_factor_t scale_factor, void** data, size_t* data_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: data; type: simple_byref
DCHECK(data);
if (!data)
return 0;
// Verify param: data_size; type: simple_byref
DCHECK(data_size);
if (!data_size)
return 0;
// Translate param: data; type: simple_byref
void* dataVal = data?*data:NULL;
// Translate param: data_size; type: simple_byref
size_t data_sizeVal = data_size?*data_size:0;
// Execute
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResourceForScale(
resource_id,
scale_factor,
dataVal,
data_sizeVal);
// Restore param: data; type: simple_byref
if (data)
*data = dataVal;
// Restore param: data_size; type: simple_byref
if (data_size)
*data_size = data_sizeVal;
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefResourceBundleCppToC::CefResourceBundleCppToC() {
GetStruct()->get_localized_string = resource_bundle_get_localized_string;
GetStruct()->get_data_resource = resource_bundle_get_data_resource;
GetStruct()->get_data_resource_for_scale =
resource_bundle_get_data_resource_for_scale;
}
template<> CefRefPtr<CefResourceBundle> CefCppToC<CefResourceBundleCppToC,
CefResourceBundle, cef_resource_bundle_t>::UnwrapDerived(
CefWrapperType type, cef_resource_bundle_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefResourceBundleCppToC,
CefResourceBundle, cef_resource_bundle_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefResourceBundleCppToC, CefResourceBundle,
cef_resource_bundle_t>::kWrapperType = WT_RESOURCE_BUNDLE;

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_resource_bundle.h"
#include "include/capi/cef_resource_bundle_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefResourceBundleCppToC
: public CefCppToC<CefResourceBundleCppToC, CefResourceBundle,
cef_resource_bundle_t> {
public:
CefResourceBundleCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_RESOURCE_BUNDLE_CPPTOC_H_

View File

@@ -18,7 +18,7 @@ namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK resource_bundle_handler_get_localized_string(
struct _cef_resource_bundle_handler_t* self, int message_id,
struct _cef_resource_bundle_handler_t* self, int string_id,
cef_string_t* string) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@@ -35,7 +35,7 @@ int CEF_CALLBACK resource_bundle_handler_get_localized_string(
// Execute
bool _retval = CefResourceBundleHandlerCppToC::Get(self)->GetLocalizedString(
message_id,
string_id,
stringStr);
// Return type: bool
@@ -81,6 +81,47 @@ int CEF_CALLBACK resource_bundle_handler_get_data_resource(
return _retval;
}
int CEF_CALLBACK resource_bundle_handler_get_data_resource_for_scale(
struct _cef_resource_bundle_handler_t* self, int resource_id,
cef_scale_factor_t scale_factor, void** data, size_t* data_size) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: data; type: simple_byref
DCHECK(data);
if (!data)
return 0;
// Verify param: data_size; type: simple_byref
DCHECK(data_size);
if (!data_size)
return 0;
// Translate param: data; type: simple_byref
void* dataVal = data?*data:NULL;
// Translate param: data_size; type: simple_byref
size_t data_sizeVal = data_size?*data_size:0;
// Execute
bool _retval = CefResourceBundleHandlerCppToC::Get(
self)->GetDataResourceForScale(
resource_id,
scale_factor,
dataVal,
data_sizeVal);
// Restore param: data; type: simple_byref
if (data)
*data = dataVal;
// Restore param: data_size; type: simple_byref
if (data_size)
*data_size = data_sizeVal;
// Return type: bool
return _retval;
}
} // namespace
@@ -90,6 +131,8 @@ CefResourceBundleHandlerCppToC::CefResourceBundleHandlerCppToC() {
GetStruct()->get_localized_string =
resource_bundle_handler_get_localized_string;
GetStruct()->get_data_resource = resource_bundle_handler_get_data_resource;
GetStruct()->get_data_resource_for_scale =
resource_bundle_handler_get_data_resource_for_scale;
}
template<> CefRefPtr<CefResourceBundleHandler> CefCppToC<CefResourceBundleHandlerCppToC,

View File

@@ -0,0 +1,72 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK run_context_menu_callback_cont(
struct _cef_run_context_menu_callback_t* self, int command_id,
cef_event_flags_t event_flags) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefRunContextMenuCallbackCppToC::Get(self)->Continue(
command_id,
event_flags);
}
void CEF_CALLBACK run_context_menu_callback_cancel(
struct _cef_run_context_menu_callback_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefRunContextMenuCallbackCppToC::Get(self)->Cancel();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefRunContextMenuCallbackCppToC::CefRunContextMenuCallbackCppToC() {
GetStruct()->cont = run_context_menu_callback_cont;
GetStruct()->cancel = run_context_menu_callback_cancel;
}
template<> CefRefPtr<CefRunContextMenuCallback> CefCppToC<CefRunContextMenuCallbackCppToC,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::UnwrapDerived(
CefWrapperType type, cef_run_context_menu_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefRunContextMenuCallbackCppToC,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::DebugObjCt =
0;
#endif
template<> CefWrapperType CefCppToC<CefRunContextMenuCallbackCppToC,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::kWrapperType =
WT_RUN_CONTEXT_MENU_CALLBACK;

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_RUN_CONTEXT_MENU_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_RUN_CONTEXT_MENU_CALLBACK_CPPTOC_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_context_menu_handler.h"
#include "include/capi/cef_context_menu_handler_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefRunContextMenuCallbackCppToC
: public CefCppToC<CefRunContextMenuCallbackCppToC,
CefRunContextMenuCallback, cef_run_context_menu_callback_t> {
public:
CefRunContextMenuCallbackCppToC();
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_RUN_CONTEXT_MENU_CALLBACK_CPPTOC_H_

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.

View File

@@ -14,6 +14,7 @@
#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/menu_model_cpptoc.h"
#include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h"
#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h"
@@ -53,6 +54,49 @@ void CefContextMenuHandlerCToCpp::OnBeforeContextMenu(
CefMenuModelCppToC::Wrap(model));
}
bool CefContextMenuHandlerCToCpp::RunContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model,
CefRefPtr<CefRunContextMenuCallback> callback) {
cef_context_menu_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, run_context_menu))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
return false;
// Verify param: params; type: refptr_diff
DCHECK(params.get());
if (!params.get())
return false;
// Verify param: model; type: refptr_diff
DCHECK(model.get());
if (!model.get())
return false;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return false;
// Execute
int _retval = _struct->run_context_menu(_struct,
CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame),
CefContextMenuParamsCppToC::Wrap(params),
CefMenuModelCppToC::Wrap(model),
CefRunContextMenuCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval?true:false;
}
bool CefContextMenuHandlerCToCpp::OnContextMenuCommand(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params, int command_id,

View File

@@ -34,6 +34,9 @@ class CefContextMenuHandlerCToCpp
void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) override;
bool RunContextMenu(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params, CefRefPtr<CefMenuModel> model,
CefRefPtr<CefRunContextMenuCallback> callback) override;
bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params,
int command_id, EventFlags event_flags) override;

View File

@@ -303,6 +303,34 @@ CefContextMenuParams::EditStateFlags CefContextMenuParamsCToCpp::GetEditStateFla
return _retval;
}
bool CefContextMenuParamsCToCpp::IsCustomMenu() {
cef_context_menu_params_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_custom_menu))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_custom_menu(_struct);
// Return type: bool
return _retval?true:false;
}
bool CefContextMenuParamsCToCpp::IsPepperMenu() {
cef_context_menu_params_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_pepper_menu))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_pepper_menu(_struct);
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@@ -50,6 +50,8 @@ class CefContextMenuParamsCToCpp
bool IsEditable() OVERRIDE;
bool IsSpellCheckEnabled() OVERRIDE;
EditStateFlags GetEditStateFlags() OVERRIDE;
bool IsCustomMenu() OVERRIDE;
bool IsPepperMenu() OVERRIDE;
};
#endif // USING_CEF_SHARED

View File

@@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
@@ -30,6 +31,46 @@ CefRefPtr<CefCookieManager> CefRequestContextHandlerCToCpp::GetCookieManager() {
return CefCookieManagerCppToC::Unwrap(_retval);
}
bool CefRequestContextHandlerCToCpp::OnBeforePluginLoad(
const CefString& mime_type, const CefString& plugin_url,
const CefString& top_origin_url, CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) {
cef_request_context_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_before_plugin_load))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: mime_type; type: string_byref_const
DCHECK(!mime_type.empty());
if (mime_type.empty())
return false;
// Verify param: top_origin_url; type: string_byref_const
DCHECK(!top_origin_url.empty());
if (top_origin_url.empty())
return false;
// Verify param: plugin_info; type: refptr_diff
DCHECK(plugin_info.get());
if (!plugin_info.get())
return false;
// Verify param: plugin_policy; type: simple_byaddr
DCHECK(plugin_policy);
if (!plugin_policy)
return false;
// Unverified params: plugin_url
// Execute
int _retval = _struct->on_before_plugin_load(_struct,
mime_type.GetStruct(),
plugin_url.GetStruct(),
top_origin_url.GetStruct(),
CefWebPluginInfoCppToC::Wrap(plugin_info),
plugin_policy);
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@@ -32,6 +32,10 @@ class CefRequestContextHandlerCToCpp
// CefRequestContextHandler methods.
CefRefPtr<CefCookieManager> GetCookieManager() override;
bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url, const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) override;
};
#endif // BUILDING_CEF_SHARED

View File

@@ -17,7 +17,6 @@
#include "libcef_dll/cpptoc/request_callback_cpptoc.h"
#include "libcef_dll/cpptoc/response_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
@@ -375,36 +374,6 @@ bool CefRequestHandlerCToCpp::OnCertificateError(CefRefPtr<CefBrowser> browser,
return _retval?true:false;
}
bool CefRequestHandlerCToCpp::OnBeforePluginLoad(CefRefPtr<CefBrowser> browser,
const CefString& url, const CefString& policy_url,
CefRefPtr<CefWebPluginInfo> info) {
cef_request_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_before_plugin_load))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: info; type: refptr_diff
DCHECK(info.get());
if (!info.get())
return false;
// Unverified params: url, policy_url
// Execute
int _retval = _struct->on_before_plugin_load(_struct,
CefBrowserCppToC::Wrap(browser),
url.GetStruct(),
policy_url.GetStruct(),
CefWebPluginInfoCppToC::Wrap(info));
// Return type: bool
return _retval?true:false;
}
void CefRequestHandlerCToCpp::OnPluginCrashed(CefRefPtr<CefBrowser> browser,
const CefString& plugin_path) {
cef_request_handler_t* _struct = GetStruct();

View File

@@ -61,8 +61,6 @@ class CefRequestHandlerCToCpp
cef_errorcode_t cert_error, const CefString& request_url,
CefRefPtr<CefSSLInfo> ssl_info,
CefRefPtr<CefRequestCallback> callback) override;
bool OnBeforePluginLoad(CefRefPtr<CefBrowser> browser, const CefString& url,
const CefString& policy_url, CefRefPtr<CefWebPluginInfo> info) override;
void OnPluginCrashed(CefRefPtr<CefBrowser> browser,
const CefString& plugin_path) override;
void OnRenderViewReady(CefRefPtr<CefBrowser> browser) override;

View File

@@ -0,0 +1,104 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/resource_bundle_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefResourceBundle> CefResourceBundle::GetGlobal() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_resource_bundle_t* _retval = cef_resource_bundle_get_global();
// Return type: refptr_same
return CefResourceBundleCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
CefString CefResourceBundleCToCpp::GetLocalizedString(int string_id) {
cef_resource_bundle_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_localized_string))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_localized_string(_struct,
string_id);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
bool CefResourceBundleCToCpp::GetDataResource(int resource_id, void*& data,
size_t& data_size) {
cef_resource_bundle_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_data_resource))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_data_resource(_struct,
resource_id,
&data,
&data_size);
// Return type: bool
return _retval?true:false;
}
bool CefResourceBundleCToCpp::GetDataResourceForScale(int resource_id,
ScaleFactor scale_factor, void*& data, size_t& data_size) {
cef_resource_bundle_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_data_resource_for_scale))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_data_resource_for_scale(_struct,
resource_id,
scale_factor,
&data,
&data_size);
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.
CefResourceBundleCToCpp::CefResourceBundleCToCpp() {
}
template<> cef_resource_bundle_t* CefCToCpp<CefResourceBundleCToCpp,
CefResourceBundle, cef_resource_bundle_t>::UnwrapDerived(
CefWrapperType type, CefResourceBundle* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefResourceBundleCToCpp,
CefResourceBundle, cef_resource_bundle_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefResourceBundleCToCpp, CefResourceBundle,
cef_resource_bundle_t>::kWrapperType = WT_RESOURCE_BUNDLE;

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_resource_bundle.h"
#include "include/capi/cef_resource_bundle_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefResourceBundleCToCpp
: public CefCToCpp<CefResourceBundleCToCpp, CefResourceBundle,
cef_resource_bundle_t> {
public:
CefResourceBundleCToCpp();
// CefResourceBundle methods.
CefString GetLocalizedString(int string_id) OVERRIDE;
bool GetDataResource(int resource_id, void*& data,
size_t& data_size) OVERRIDE;
bool GetDataResourceForScale(int resource_id, ScaleFactor scale_factor,
void*& data, size_t& data_size) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_CTOCPP_H_

View File

@@ -15,7 +15,7 @@
// VIRTUAL METHODS - Body may be edited by hand.
bool CefResourceBundleHandlerCToCpp::GetLocalizedString(int message_id,
bool CefResourceBundleHandlerCToCpp::GetLocalizedString(int string_id,
CefString& string) {
cef_resource_bundle_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_localized_string))
@@ -25,7 +25,7 @@ bool CefResourceBundleHandlerCToCpp::GetLocalizedString(int message_id,
// Execute
int _retval = _struct->get_localized_string(_struct,
message_id,
string_id,
string.GetWritableStruct());
// Return type: bool
@@ -50,6 +50,25 @@ bool CefResourceBundleHandlerCToCpp::GetDataResource(int resource_id,
return _retval?true:false;
}
bool CefResourceBundleHandlerCToCpp::GetDataResourceForScale(int resource_id,
ScaleFactor scale_factor, void*& data, size_t& data_size) {
cef_resource_bundle_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_data_resource_for_scale))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_data_resource_for_scale(_struct,
resource_id,
scale_factor,
&data,
&data_size);
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@@ -31,9 +31,11 @@ class CefResourceBundleHandlerCToCpp
CefResourceBundleHandlerCToCpp();
// CefResourceBundleHandler methods.
bool GetLocalizedString(int message_id, CefString& string) override;
bool GetLocalizedString(int string_id, CefString& string) override;
bool GetDataResource(int resource_id, void*& data,
size_t& data_size) override;
bool GetDataResourceForScale(int resource_id, ScaleFactor scale_factor,
void*& data, size_t& data_size) override;
};
#endif // BUILDING_CEF_SHARED

View File

@@ -0,0 +1,64 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefRunContextMenuCallbackCToCpp::Continue(int command_id,
EventFlags event_flags) {
cef_run_context_menu_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cont(_struct,
command_id,
event_flags);
}
void CefRunContextMenuCallbackCToCpp::Cancel() {
cef_run_context_menu_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cancel))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cancel(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefRunContextMenuCallbackCToCpp::CefRunContextMenuCallbackCToCpp() {
}
template<> cef_run_context_menu_callback_t* CefCToCpp<CefRunContextMenuCallbackCToCpp,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::UnwrapDerived(
CefWrapperType type, CefRunContextMenuCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefRunContextMenuCallbackCToCpp,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::DebugObjCt =
0;
#endif
template<> CefWrapperType CefCToCpp<CefRunContextMenuCallbackCToCpp,
CefRunContextMenuCallback, cef_run_context_menu_callback_t>::kWrapperType =
WT_RUN_CONTEXT_MENU_CALLBACK;

View File

@@ -0,0 +1,39 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_RUN_CONTEXT_MENU_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_RUN_CONTEXT_MENU_CALLBACK_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_context_menu_handler.h"
#include "include/capi/cef_context_menu_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefRunContextMenuCallbackCToCpp
: public CefCToCpp<CefRunContextMenuCallbackCToCpp,
CefRunContextMenuCallback, cef_run_context_menu_callback_t> {
public:
CefRunContextMenuCallbackCToCpp();
// CefRunContextMenuCallback methods.
void Continue(int command_id, EventFlags event_flags) OVERRIDE;
void Cancel() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_RUN_CONTEXT_MENU_CALLBACK_CTOCPP_H_

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.

View File

@@ -20,6 +20,8 @@
#include "include/cef_web_plugin.h"
#include "include/capi/cef_web_plugin_capi.h"
#include "include/cef_browser.h"
#include "include/capi/cef_browser_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.

View File

@@ -58,6 +58,7 @@
#include "libcef_dll/cpptoc/print_settings_cpptoc.h"
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
#include "libcef_dll/cpptoc/request_callback_cpptoc.h"
#include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h"
#include "libcef_dll/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/cpptoc/sslinfo_cpptoc.h"
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
@@ -248,6 +249,8 @@ CEF_EXPORT void cef_shutdown() {
DCHECK(base::AtomicRefCountIsZero(
&CefResourceBundleHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResourceHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefRunContextMenuCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefRunFileDialogCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLCertPrincipalCppToC::DebugObjCt));

View File

@@ -99,6 +99,7 @@
#include "libcef_dll/ctocpp/print_settings_ctocpp.h"
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
#include "libcef_dll/ctocpp/request_callback_ctocpp.h"
#include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h"
#include "libcef_dll/ctocpp/sslcert_principal_ctocpp.h"
#include "libcef_dll/ctocpp/sslinfo_ctocpp.h"
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
@@ -240,6 +241,8 @@ CEF_GLOBAL void CefShutdown() {
DCHECK(base::AtomicRefCountIsZero(
&CefResourceBundleHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResourceHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefRunContextMenuCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefRunFileDialogCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefSSLCertPrincipalCToCpp::DebugObjCt));

View File

@@ -76,9 +76,11 @@ enum CefWrapperType {
WT_REQUEST_CONTEXT,
WT_REQUEST_CONTEXT_HANDLER,
WT_REQUEST_HANDLER,
WT_RESOURCE_BUNDLE,
WT_RESOURCE_BUNDLE_HANDLER,
WT_RESOURCE_HANDLER,
WT_RESPONSE,
WT_RUN_CONTEXT_MENU_CALLBACK,
WT_RUN_FILE_DIALOG_CALLBACK,
WT_SSLCERT_PRINCIPAL,
WT_SSLINFO,