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

Unified Diff: chrome/browser/plugins/chrome_plugin_service_filter.h

Issue 12086077: Only permit plug-in loads in the browser if the plug-in isn't blocked or the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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: chrome/browser/plugins/chrome_plugin_service_filter.h
===================================================================
--- chrome/browser/plugins/chrome_plugin_service_filter.h (revision 180039)
+++ chrome/browser/plugins/chrome_plugin_service_filter.h (working copy)
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_
#include <map>
+#include <set>
#include <vector>
#include "base/file_path.h"
@@ -50,8 +51,14 @@
// Lifts a restriction on a plug-in.
void UnrestrictPlugin(const FilePath& plugin_path);
+ // Authorizes a given plug-in for a given process.
+ void AuthorizePlugin(int render_process_id, const FilePath& plugin_path);
+
+ // Authorizes all plug-ins for a given process.
+ void AuthorizeAllPlugins(int render_process_id);
+
// PluginServiceFilter implementation:
- virtual bool ShouldUsePlugin(
+ virtual bool IsPluginEnabled(
int render_process_id,
int render_view_id,
const void* context,
@@ -59,16 +66,32 @@
const GURL& policy_url,
webkit::WebPluginInfo* plugin) OVERRIDE;
+ // CanLoadPlugin always grants permission to the browser
+ // (render_process_id == 0)
+ virtual bool CanLoadPlugin(
+ int render_process_id,
+ const FilePath& path) OVERRIDE;
+
private:
friend struct DefaultSingletonTraits<ChromePluginServiceFilter>;
struct OverriddenPlugin {
- int render_process_id;
+ OverriddenPlugin();
+ ~OverriddenPlugin();
+
int render_view_id;
GURL url; // If empty, the override applies to all urls in render_view.
webkit::WebPluginInfo plugin;
};
+ struct ProcessDetails {
+ ProcessDetails();
+ ~ProcessDetails();
+
+ std::vector<OverriddenPlugin> overridden_plugins;
+ std::set<FilePath> authorized_plugins;
+ };
+
ChromePluginServiceFilter();
virtual ~ChromePluginServiceFilter();
@@ -77,6 +100,9 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ ProcessDetails* GetOrRegisterProcess(int render_process_id);
+ const ProcessDetails* GetProcess(int render_process_id) const;
+
content::NotificationRegistrar registrar_;
base::Lock lock_; // Guards access to member variables.
@@ -87,7 +113,7 @@
typedef std::map<const void*, scoped_refptr<PluginPrefs> > ResourceContextMap;
ResourceContextMap resource_context_map_;
- std::vector<OverriddenPlugin> overridden_plugins_;
+ std::map<int, ProcessDetails> plugin_details_;
};
#endif // CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698