Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: content/browser/plugin_service.h

Issue 7387010: Add PluginServiceFilter interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add resource_context Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/plugin_service.h
diff --git a/content/browser/plugin_service.h b/content/browser/plugin_service.h
index 975d815753da6cfba3181a35ee6d46e578a1faae..2b6280fa204d5ecd28d2f4b4347503723f3098d3 100644
--- a/content/browser/plugin_service.h
+++ b/content/browser/plugin_service.h
@@ -12,11 +12,8 @@
#include <string>
#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/hash_tables.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/singleton.h"
-#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event_watcher.h"
#include "build/build_config.h"
#include "content/browser/plugin_process_host.h"
@@ -46,11 +43,14 @@ class PluginService
: public base::WaitableEventWatcher::Delegate,
public NotificationObserver {
public:
- struct OverriddenPlugin {
- int render_process_id;
- int render_view_id;
- GURL url;
- webkit::npapi::WebPluginInfo plugin;
+ // Callback class to let the client filter the list of all installed plug-ins.
+ // This class is called on the FILE thread.
+ class Filter {
jam 2011/08/01 03:25:44 please put this in a separate file. per the style
Bernhard Bauer 2011/08/01 16:06:12 Done (BTW, is there a rule for when we put content
jam 2011/08/01 17:25:04 everything in content should be in the content nam
Bernhard Bauer 2011/08/01 18:07:39 OK, done.
+ public:
+ virtual ~Filter() {}
+ // Whether to use |plugin|. The client can return false to disallow the
+ // plugin, or return true and optionally change the passed in plugin.
+ virtual bool ShouldUsePlugin(webkit::npapi::WebPluginInfo* plugin) = 0;
};
// Returns the PluginService singleton.
@@ -84,6 +84,7 @@ class PluginService
void OpenChannelToNpapiPlugin(int render_process_id,
int render_view_id,
const GURL& url,
+ const GURL& policy_url,
const std::string& mime_type,
PluginProcessHost::Client* client);
void OpenChannelToPpapiPlugin(const FilePath& path,
@@ -92,26 +93,19 @@ class PluginService
PpapiBrokerProcessHost::Client* client);
// Gets the plugin in the list of plugins that matches the given url and mime
- // type. Must be called on the FILE thread.
- bool GetPluginInfo(int render_process_id,
- int render_view_id,
- const GURL& url,
+ // type. Must be called on the FILE thread. Takes ownership of |filter|.
+ bool GetPluginInfo(const GURL& url,
const std::string& mime_type,
+ bool allow_wildcard,
+ Filter* filter,
+ bool* use_stale,
webkit::npapi::WebPluginInfo* info,
std::string* actual_mime_type);
- // Safe to be called from any thread.
- void OverridePluginForTab(const OverriddenPlugin& plugin);
-
- // Restricts the given plugin to the the scheme and host of the given url.
- // Call with an empty url to reset this.
- // Can be called on any thread.
- void RestrictPluginToUrl(const FilePath& plugin_path, const GURL& url);
-
- // Returns true if the given plugin is allowed to be used by a page with
- // the given URL.
- // Can be called on any thread.
- bool PluginAllowedForURL(const FilePath& plugin_path, const GURL& url);
+ // Returns a list of installed plug-ins, filtering them with |filter|.
+ // Must be called on the FILE thread. Takes ownership of |filter|.
+ void GetPlugins(Filter* filter,
+ std::vector<webkit::npapi::WebPluginInfo>* plugins);
// Tells all the renderer processes to throw away their cache of the plugin
// list, and optionally also reload all the pages with plugins.
@@ -139,10 +133,9 @@ class PluginService
// Helper so we can do the plugin lookup on the FILE thread.
void GetAllowedPluginForOpenChannelToPlugin(
- int render_process_id,
- int render_view_id,
const GURL& url,
const std::string& mime_type,
+ Filter* filter,
PluginProcessHost::Client* client);
// Helper so we can finish opening the channel after looking up the
@@ -162,11 +155,6 @@ class PluginService
// The browser's UI locale.
const std::string ui_locale_;
- // Map of plugin paths to the origin they are restricted to.
- base::Lock restricted_plugin_lock_; // Guards access to restricted_plugin_.
- typedef base::hash_map<FilePath, GURL> RestrictedPluginMap;
- RestrictedPluginMap restricted_plugin_;
-
NotificationRegistrar registrar_;
#if defined(OS_WIN)
@@ -186,9 +174,6 @@ class PluginService
std::vector<PepperPluginInfo> ppapi_plugins_;
- std::vector<OverriddenPlugin> overridden_plugins_;
- base::Lock overridden_plugins_lock_;
-
DISALLOW_COPY_AND_ASSIGN(PluginService);
};

Powered by Google App Engine
This is Rietveld 408576698