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 CONTENT_COMMON_PLUGIN_LIST_H_ | 5 #ifndef CONTENT_COMMON_PLUGIN_LIST_H_ |
6 #define CONTENT_COMMON_PLUGIN_LIST_H_ | 6 #define CONTENT_COMMON_PLUGIN_LIST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 16 matching lines...) Expand all Loading... |
27 // The PluginList is responsible for loading our NPAPI based plugins. It does | 27 // The PluginList is responsible for loading our NPAPI based plugins. It does |
28 // so in whatever manner is appropriate for the platform. On Windows, it loads | 28 // so in whatever manner is appropriate for the platform. On Windows, it loads |
29 // plugins from a known directory by looking for DLLs which start with "NP", | 29 // plugins from a known directory by looking for DLLs which start with "NP", |
30 // and checking to see if they are valid NPAPI libraries. On the Mac, it walks | 30 // and checking to see if they are valid NPAPI libraries. On the Mac, it walks |
31 // the machine-wide and user plugin directories and loads anything that has | 31 // the machine-wide and user plugin directories and loads anything that has |
32 // the correct types. On Linux, it walks the plugin directories as well | 32 // the correct types. On Linux, it walks the plugin directories as well |
33 // (e.g. /usr/lib/browser-plugins/). | 33 // (e.g. /usr/lib/browser-plugins/). |
34 // This object is thread safe. | 34 // This object is thread safe. |
35 class CONTENT_EXPORT PluginList { | 35 class CONTENT_EXPORT PluginList { |
36 public: | 36 public: |
37 | |
38 // Gets the one instance of the PluginList. | 37 // Gets the one instance of the PluginList. |
39 static PluginList* Singleton(); | 38 static PluginList* Singleton(); |
40 | 39 |
41 // Returns true if we're in debug-plugin-loading mode. This is controlled | 40 // Returns true if we're in debug-plugin-loading mode. This is controlled |
42 // by a command line switch. | 41 // by a command line switch. |
43 static bool DebugPluginLoading(); | 42 static bool DebugPluginLoading(); |
44 | 43 |
45 // Returns true if the plugin supports |mime_type|. |mime_type| should be all | 44 // Returns true if the plugin supports |mime_type|. |mime_type| should be all |
46 // lower case. | 45 // lower case. |
47 static bool SupportsType(const WebPluginInfo& plugin, | 46 static bool SupportsType(const WebPluginInfo& plugin, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 void set_will_load_plugins_callback(const base::Closure& callback); | 151 void set_will_load_plugins_callback(const base::Closure& callback); |
153 | 152 |
154 virtual ~PluginList(); | 153 virtual ~PluginList(); |
155 | 154 |
156 // Creates a WebPluginInfo structure given a plugin's path. On success | 155 // Creates a WebPluginInfo structure given a plugin's path. On success |
157 // returns true, with the information being put into "info". | 156 // returns true, with the information being put into "info". |
158 // Returns false if the library couldn't be found, or if it's not a plugin. | 157 // Returns false if the library couldn't be found, or if it's not a plugin. |
159 static bool ReadWebPluginInfo(const base::FilePath& filename, | 158 static bool ReadWebPluginInfo(const base::FilePath& filename, |
160 WebPluginInfo* info); | 159 WebPluginInfo* info); |
161 | 160 |
162 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
163 // Parse the result of an NP_GetMIMEDescription() call. | |
164 // This API is only used on Unixes, and is exposed here for testing. | |
165 static void ParseMIMEDescription(const std::string& description, | |
166 std::vector<WebPluginMimeType>* mime_types); | |
167 | |
168 // Extract a version number from a description string. | |
169 // This API is only used on Unixes, and is exposed here for testing. | |
170 static void ExtractVersionString(const std::string& version, | |
171 WebPluginInfo* info); | |
172 #endif | |
173 | |
174 private: | 161 private: |
175 enum LoadingState { | 162 enum LoadingState { |
176 LOADING_STATE_NEEDS_REFRESH, | 163 LOADING_STATE_NEEDS_REFRESH, |
177 LOADING_STATE_REFRESHING, | 164 LOADING_STATE_REFRESHING, |
178 LOADING_STATE_UP_TO_DATE, | 165 LOADING_STATE_UP_TO_DATE, |
179 }; | 166 }; |
180 | 167 |
181 friend class PluginListTest; | 168 friend class PluginListTest; |
182 friend struct base::DefaultLazyInstanceTraits<PluginList>; | 169 friend struct base::DefaultLazyInstanceTraits<PluginList>; |
183 | 170 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Flag indicating whether third_party plugins will be searched for | 237 // Flag indicating whether third_party plugins will be searched for |
251 // in common places. | 238 // in common places. |
252 bool plugins_discovery_disabled_; | 239 bool plugins_discovery_disabled_; |
253 | 240 |
254 DISALLOW_COPY_AND_ASSIGN(PluginList); | 241 DISALLOW_COPY_AND_ASSIGN(PluginList); |
255 }; | 242 }; |
256 | 243 |
257 } // namespace content | 244 } // namespace content |
258 | 245 |
259 #endif // CONTENT_COMMON_PLUGIN_LIST_H_ | 246 #endif // CONTENT_COMMON_PLUGIN_LIST_H_ |
OLD | NEW |