Add is_main_frame argument to CefRequestContextHandler::OnBeforePluginLoad (issue #2015)

This commit is contained in:
Marshall Greenblatt
2017-01-18 18:37:56 -05:00
parent b7b145fa4f
commit 41a02dbe08
20 changed files with 750 additions and 169 deletions

View File

@@ -70,23 +70,25 @@ typedef struct _cef_request_context_handler_t {
// Called on multiple browser process threads before a plugin instance is
// loaded. |mime_type| is the mime type of the plugin that will be loaded.
// |plugin_url| is the content URL that the plugin will load and may be NULL.
// |top_origin_url| is the URL for the top-level frame that contains the
// plugin when loading a specific plugin instance or NULL when building the
// initial list of enabled plugins for 'navigator.plugins' JavaScript state.
// |plugin_info| includes additional information about the plugin that will be
// loaded. |plugin_policy| is the recommended policy. Modify |plugin_policy|
// and return true (1) to change the policy. Return false (0) to use the
// recommended policy. The default plugin policy can be set at runtime using
// the `--plugin-policy=[allow|detect|block]` command-line flag. Decisions to
// mark a plugin as disabled by setting |plugin_policy| to
// PLUGIN_POLICY_DISABLED may be cached when |top_origin_url| is NULL. To
// purge the plugin list cache and potentially trigger new calls to this
// function call cef_request_tContext::PurgePluginListCache.
// |is_main_frame| will be true (1) if the plugin is being loaded in the main
// (top-level) frame, |top_origin_url| is the URL for the top-level frame that
// contains the plugin when loading a specific plugin instance or NULL when
// building the initial list of enabled plugins for 'navigator.plugins'
// JavaScript state. |plugin_info| includes additional information about the
// plugin that will be loaded. |plugin_policy| is the recommended policy.
// Modify |plugin_policy| and return true (1) to change the policy. Return
// false (0) to use the recommended policy. The default plugin policy can be
// set at runtime using the `--plugin-policy=[allow|detect|block]` command-
// line flag. Decisions to mark a plugin as disabled by setting
// |plugin_policy| to PLUGIN_POLICY_DISABLED may be cached when
// |top_origin_url| is NULL. To purge the plugin list cache and potentially
// trigger new calls to this function call
// cef_request_tContext::PurgePluginListCache.
///
int (CEF_CALLBACK *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,
int is_main_frame, const cef_string_t* top_origin_url,
struct _cef_web_plugin_info_t* plugin_info,
cef_plugin_policy_t* plugin_policy);
} cef_request_context_handler_t;

View File

@@ -64,22 +64,24 @@ class CefRequestContextHandler : public virtual CefBase {
// Called on multiple browser process threads before a plugin instance is
// loaded. |mime_type| is the mime type of the plugin that will be loaded.
// |plugin_url| is the content URL that the plugin will load and may be empty.
// |top_origin_url| is the URL for the top-level frame that contains the
// plugin when loading a specific plugin instance or empty when building the
// initial list of enabled plugins for 'navigator.plugins' JavaScript state.
// |plugin_info| includes additional information about the plugin that will be
// loaded. |plugin_policy| is the recommended policy. Modify |plugin_policy|
// and return true to change the policy. Return false to use the recommended
// policy. The default plugin policy can be set at runtime using the
// `--plugin-policy=[allow|detect|block]` command-line flag. Decisions to mark
// a plugin as disabled by setting |plugin_policy| to PLUGIN_POLICY_DISABLED
// may be cached when |top_origin_url| is empty. To purge the plugin list
// cache and potentially trigger new calls to this method call
// CefRequestContext::PurgePluginListCache.
// |is_main_frame| will be true if the plugin is being loaded in the main
// (top-level) frame, |top_origin_url| is the URL for the top-level frame that
// contains the plugin when loading a specific plugin instance or empty when
// building the initial list of enabled plugins for 'navigator.plugins'
// JavaScript state. |plugin_info| includes additional information about the
// plugin that will be loaded. |plugin_policy| is the recommended policy.
// Modify |plugin_policy| and return true to change the policy. Return false
// to use the recommended policy. The default plugin policy can be set at
// runtime using the `--plugin-policy=[allow|detect|block]` command-line flag.
// Decisions to mark a plugin as disabled by setting |plugin_policy| to
// PLUGIN_POLICY_DISABLED may be cached when |top_origin_url| is empty. To
// purge the plugin list cache and potentially trigger new calls to this
// method call CefRequestContext::PurgePluginListCache.
///
/*--cef(optional_param=plugin_url,optional_param=top_origin_url)--*/
virtual bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
bool is_main_frame,
const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) {