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