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 WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 std::vector<PluginGroup>* plugin_groups); | 155 std::vector<PluginGroup>* plugin_groups); |
156 | 156 |
157 // Returns a copy of the PluginGroup corresponding to the given WebPluginInfo. | 157 // Returns a copy of the PluginGroup corresponding to the given WebPluginInfo. |
158 // The caller takes ownership of the returned PluginGroup. | 158 // The caller takes ownership of the returned PluginGroup. |
159 PluginGroup* GetPluginGroup(const webkit::WebPluginInfo& web_plugin_info); | 159 PluginGroup* GetPluginGroup(const webkit::WebPluginInfo& web_plugin_info); |
160 | 160 |
161 // Returns the name of the PluginGroup with the given identifier. | 161 // Returns the name of the PluginGroup with the given identifier. |
162 // If no such group exists, an empty string is returned. | 162 // If no such group exists, an empty string is returned. |
163 string16 GetPluginGroupName(const std::string& identifier); | 163 string16 GetPluginGroupName(const std::string& identifier); |
164 | 164 |
165 // Load a specific plugin with full path. Return true iff loading the plug-in | 165 // Load a specific plugin with full path. |
166 // was successful. | 166 void LoadPlugin(const FilePath& filename, |
167 bool LoadPlugin(const FilePath& filename, | 167 ScopedVector<PluginGroup>* plugin_groups); |
168 ScopedVector<PluginGroup>* plugin_groups, | |
169 webkit::WebPluginInfo* plugin_info); | |
170 | 168 |
171 // The following functions are used to support probing for WebPluginInfo | 169 // The following functions are used to support probing for WebPluginInfo |
172 // using a different instance of this class. | 170 // using a different instance of this class. |
173 | 171 |
174 // Computes a list of all plugins to potentially load from all sources. | 172 // Computes a list of all plugins to potentially load from all sources. |
175 void GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths); | 173 void GetPluginPathsToLoad(std::vector<FilePath>* plugin_paths); |
176 | 174 |
177 // Clears the internal list of PluginGroups and copies them from the vector. | 175 // Clears the internal list of PluginGroups and copies them from the vector. |
178 void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); | 176 void SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins); |
179 | 177 |
180 void set_will_load_plugins_callback(const base::Closure& callback); | 178 void set_will_load_plugins_callback(const base::Closure& callback); |
181 | 179 |
182 virtual ~PluginList(); | 180 virtual ~PluginList(); |
183 | 181 |
184 protected: | 182 protected: |
185 // This constructor is used in unit tests to override the platform-dependent | 183 // This constructor is used in unit tests to override the platform-dependent |
186 // real-world plugin group definitions with custom ones. | 184 // real-world plugin group definitions with custom ones. |
187 PluginList(const PluginGroupDefinition* definitions, size_t num_definitions); | 185 PluginList(const PluginGroupDefinition* definitions, size_t num_definitions); |
188 | 186 |
189 // Adds the given WebPluginInfo to its corresponding group, creating it if | 187 // Adds the given WebPluginInfo to its corresponding group, creating it if |
190 // necessary, and returns the group. | 188 // necessary, and returns the group. |
| 189 // Callers need to protect calls to this method by a lock themselves. |
191 PluginGroup* AddToPluginGroups(const webkit::WebPluginInfo& web_plugin_info, | 190 PluginGroup* AddToPluginGroups(const webkit::WebPluginInfo& web_plugin_info, |
192 ScopedVector<PluginGroup>* plugin_groups); | 191 ScopedVector<PluginGroup>* plugin_groups); |
193 | 192 |
194 private: | 193 private: |
195 friend class PluginListTest; | 194 friend class PluginListTest; |
196 friend struct base::DefaultLazyInstanceTraits<PluginList>; | 195 friend struct base::DefaultLazyInstanceTraits<PluginList>; |
197 FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition); | 196 FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition); |
198 | 197 |
199 // Constructors are private for singletons. | 198 // Constructors are private for singletons. |
200 PluginList(); | 199 PluginList(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // accessed on multiple threads. | 294 // accessed on multiple threads. |
296 base::Lock lock_; | 295 base::Lock lock_; |
297 | 296 |
298 DISALLOW_COPY_AND_ASSIGN(PluginList); | 297 DISALLOW_COPY_AND_ASSIGN(PluginList); |
299 }; | 298 }; |
300 | 299 |
301 } // namespace npapi | 300 } // namespace npapi |
302 } // namespace webkit | 301 } // namespace webkit |
303 | 302 |
304 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ | 303 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_LIST_H_ |
OLD | NEW |