mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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:
@ -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,
|
||||
|
Reference in New Issue
Block a user