OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
6 #define CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 6 #define CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Returns whether the plugin is found in restricted_plugins_. | 70 // Returns whether the plugin is found in restricted_plugins_. |
71 bool IsPluginRestricted(const base::FilePath& plugin_path); | 71 bool IsPluginRestricted(const base::FilePath& plugin_path); |
72 | 72 |
73 // PluginServiceFilter implementation: | 73 // PluginServiceFilter implementation: |
74 virtual bool IsPluginAvailable( | 74 virtual bool IsPluginAvailable( |
75 int render_process_id, | 75 int render_process_id, |
76 int render_frame_id, | 76 int render_frame_id, |
77 const void* context, | 77 const void* context, |
78 const GURL& url, | 78 const GURL& url, |
79 const GURL& policy_url, | 79 const GURL& policy_url, |
80 content::WebPluginInfo* plugin) OVERRIDE; | 80 content::WebPluginInfo* plugin) override; |
81 | 81 |
82 // CanLoadPlugin always grants permission to the browser | 82 // CanLoadPlugin always grants permission to the browser |
83 // (render_process_id == 0) | 83 // (render_process_id == 0) |
84 virtual bool CanLoadPlugin( | 84 virtual bool CanLoadPlugin( |
85 int render_process_id, | 85 int render_process_id, |
86 const base::FilePath& path) OVERRIDE; | 86 const base::FilePath& path) override; |
87 | 87 |
88 private: | 88 private: |
89 friend struct DefaultSingletonTraits<ChromePluginServiceFilter>; | 89 friend struct DefaultSingletonTraits<ChromePluginServiceFilter>; |
90 | 90 |
91 struct OverriddenPlugin { | 91 struct OverriddenPlugin { |
92 OverriddenPlugin(); | 92 OverriddenPlugin(); |
93 ~OverriddenPlugin(); | 93 ~OverriddenPlugin(); |
94 | 94 |
95 int render_frame_id; | 95 int render_frame_id; |
96 GURL url; // If empty, the override applies to all urls in render_frame. | 96 GURL url; // If empty, the override applies to all urls in render_frame. |
97 content::WebPluginInfo plugin; | 97 content::WebPluginInfo plugin; |
98 }; | 98 }; |
99 | 99 |
100 struct ProcessDetails { | 100 struct ProcessDetails { |
101 ProcessDetails(); | 101 ProcessDetails(); |
102 ~ProcessDetails(); | 102 ~ProcessDetails(); |
103 | 103 |
104 std::vector<OverriddenPlugin> overridden_plugins; | 104 std::vector<OverriddenPlugin> overridden_plugins; |
105 std::set<base::FilePath> authorized_plugins; | 105 std::set<base::FilePath> authorized_plugins; |
106 }; | 106 }; |
107 | 107 |
108 ChromePluginServiceFilter(); | 108 ChromePluginServiceFilter(); |
109 virtual ~ChromePluginServiceFilter(); | 109 virtual ~ChromePluginServiceFilter(); |
110 | 110 |
111 // content::NotificationObserver implementation: | 111 // content::NotificationObserver implementation: |
112 virtual void Observe(int type, | 112 virtual void Observe(int type, |
113 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
114 const content::NotificationDetails& details) OVERRIDE; | 114 const content::NotificationDetails& details) override; |
115 | 115 |
116 ProcessDetails* GetOrRegisterProcess(int render_process_id); | 116 ProcessDetails* GetOrRegisterProcess(int render_process_id); |
117 const ProcessDetails* GetProcess(int render_process_id) const; | 117 const ProcessDetails* GetProcess(int render_process_id) const; |
118 | 118 |
119 content::NotificationRegistrar registrar_; | 119 content::NotificationRegistrar registrar_; |
120 | 120 |
121 base::Lock lock_; // Guards access to member variables. | 121 base::Lock lock_; // Guards access to member variables. |
122 // Map of plugin paths to the origin they are restricted to. | 122 // Map of plugin paths to the origin they are restricted to. |
123 typedef std::pair<const void*, GURL> RestrictedPluginPair; | 123 typedef std::pair<const void*, GURL> RestrictedPluginPair; |
124 typedef base::hash_map<base::FilePath, | 124 typedef base::hash_map<base::FilePath, |
125 RestrictedPluginPair> RestrictedPluginMap; | 125 RestrictedPluginPair> RestrictedPluginMap; |
126 RestrictedPluginMap restricted_plugins_; | 126 RestrictedPluginMap restricted_plugins_; |
127 typedef std::map<const void*, scoped_refptr<PluginPrefs> > ResourceContextMap; | 127 typedef std::map<const void*, scoped_refptr<PluginPrefs> > ResourceContextMap; |
128 ResourceContextMap resource_context_map_; | 128 ResourceContextMap resource_context_map_; |
129 | 129 |
130 std::map<int, ProcessDetails> plugin_details_; | 130 std::map<int, ProcessDetails> plugin_details_; |
131 }; | 131 }; |
132 | 132 |
133 #endif // CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ | 133 #endif // CHROME_BROWSER_PLUGINS_CHROME_PLUGIN_SERVICE_FILTER_H_ |
OLD | NEW |