Call OnBeforePluginLoad when building the plugin list (issue #1708)

This commit is contained in:
Marshall Greenblatt
2015-09-25 14:59:30 +03:00
parent a33720558e
commit 4149192d81
23 changed files with 421 additions and 161 deletions

View File

@@ -140,6 +140,16 @@ typedef struct _cef_request_context_t {
///
int (CEF_CALLBACK *clear_scheme_handler_factories)(
struct _cef_request_context_t* self);
///
// Tells all renderer processes associated with this context to throw away
// their plugin list cache. If |reload_pages| is true (1) they will also
// reload all pages with plugins.
// cef_request_tContextHandler::OnBeforePluginLoad may be called to rebuild
// the plugin list cache.
///
void (CEF_CALLBACK *purge_plugin_list_cache)(
struct _cef_request_context_t* self, int reload_pages);
} cef_request_context_t;

View File

@@ -67,15 +67,21 @@ typedef struct _cef_request_context_handler_t {
struct _cef_request_context_handler_t* self);
///
// Called on the browser process IO thread before a plugin instance is loaded.
// |mime_type| is the mime type of the plugin that will be loaded.
// 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. |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.
// 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,

View File

@@ -157,6 +157,15 @@ class CefRequestContext : public virtual CefBase {
///
/*--cef()--*/
virtual bool ClearSchemeHandlerFactories() =0;
///
// Tells all renderer processes associated with this context to throw away
// their plugin list cache. If |reload_pages| is true they will also reload
// all pages with plugins. CefRequestContextHandler::OnBeforePluginLoad may
// be called to rebuild the plugin list cache.
///
/*--cef()--*/
virtual void PurgePluginListCache(bool reload_pages) =0;
};
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_

View File

@@ -61,17 +61,23 @@ class CefRequestContextHandler : public virtual CefBase {
virtual CefRefPtr<CefCookieManager> GetCookieManager() { return NULL; }
///
// Called on the browser process IO thread before a plugin instance is loaded.
// |mime_type| is the mime type of the plugin that will be loaded.
// 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. |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.
// 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)--*/
/*--cef(optional_param=plugin_url,optional_param=top_origin_url)--*/
virtual bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
const CefString& top_origin_url,