Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TODO: Need mechanism to cleanup the static instance | 5 // TODO: Need mechanism to cleanup the static instance |
| 6 | 6 |
| 7 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ | 7 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| 8 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ | 8 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| 9 | 9 |
| 10 #include <set> | |
| 10 #include <string> | 11 #include <string> |
| 12 #include <vector> | |
| 11 | 13 |
| 12 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 13 #include "base/hash_tables.h" | |
| 14 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 15 #include "webkit/glue/webplugin.h" | 16 #include "webkit/glue/webplugin.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace NPAPI | 20 namespace NPAPI |
| 20 { | 21 { |
| 21 | 22 |
| 22 // Used by plugins_test when testing the older WMP plugin to force the new | 23 // Used by plugins_test when testing the older WMP plugin to force the new |
| 23 // plugin to not get loaded. | 24 // plugin to not get loaded. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 bool GetPluginInfoByPath(const FilePath& plugin_path, | 81 bool GetPluginInfoByPath(const FilePath& plugin_path, |
| 81 WebPluginInfo* info); | 82 WebPluginInfo* info); |
| 82 private: | 83 private: |
| 83 // Constructors are private for singletons | 84 // Constructors are private for singletons |
| 84 PluginList(); | 85 PluginList(); |
| 85 | 86 |
| 86 // Load all plugins from the default plugins directory | 87 // Load all plugins from the default plugins directory |
| 87 void LoadPlugins(bool refresh); | 88 void LoadPlugins(bool refresh); |
| 88 | 89 |
| 89 // Load all plugins from a specific directory | 90 // Load all plugins from a specific directory |
| 90 void LoadPlugins(const FilePath& path); | 91 void LoadPluginsFromDir(const FilePath& path); |
|
Avi (use Gerrit)
2009/01/13 14:51:37
Too late now, but why abbrev here when we don't ab
| |
| 91 | 92 |
| 92 // Load a specific plugin with full path. | 93 // Load a specific plugin with full path. |
| 93 void LoadPlugin(const FilePath& filename); | 94 void LoadPlugin(const FilePath& filename); |
| 94 | 95 |
| 95 // Returns true if we should load the given plugin, or false otherwise. | 96 // Returns true if we should load the given plugin, or false otherwise. |
| 96 bool ShouldLoadPlugin(const std::string& filename); | 97 bool ShouldLoadPlugin(const FilePath& path); |
| 97 | 98 |
| 98 // Load internal plugins. Right now there is only one: activex_shim. | 99 // Load internal plugins. Right now there is only one: activex_shim. |
| 99 void LoadInternalPlugins(); | 100 void LoadInternalPlugins(); |
| 100 | 101 |
| 101 // Find a plugin by mime type, and clsid. | 102 // Find a plugin by mime type, and clsid. |
| 102 // If clsid is empty, we will just find the plugin that supports mime type. | 103 // If clsid is empty, we will just find the plugin that supports mime type. |
| 103 // Otherwise, if mime_type is application/x-oleobject etc that's supported by | 104 // Otherwise, if mime_type is application/x-oleobject etc that's supported by |
| 104 // by our activex shim, we need to check if the specified ActiveX exists. | 105 // by our activex shim, we need to check if the specified ActiveX exists. |
| 105 // If not we will not return the activex shim, instead we will let the | 106 // If not we will not return the activex shim, instead we will let the |
| 106 // default plugin handle activex installation. | 107 // default plugin handle activex installation. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 122 // Returns true if the given WebPluginInfo supports a given file extension. | 123 // Returns true if the given WebPluginInfo supports a given file extension. |
| 123 // extension should be all lower case. | 124 // extension should be all lower case. |
| 124 // If mime_type is not NULL, it will be set to the mime type if found. | 125 // If mime_type is not NULL, it will be set to the mime type if found. |
| 125 // The mime type which corresponds to the extension is optionally returned | 126 // The mime type which corresponds to the extension is optionally returned |
| 126 // back. | 127 // back. |
| 127 static bool SupportsExtension(const WebPluginInfo& info, | 128 static bool SupportsExtension(const WebPluginInfo& info, |
| 128 const std::string &extension, | 129 const std::string &extension, |
| 129 std::string* actual_mime_type); | 130 std::string* actual_mime_type); |
| 130 | 131 |
| 131 // The application path where we expect to find plugins. | 132 // The application path where we expect to find plugins. |
| 132 static FilePath GetPluginAppDirectory(); | 133 static void GetAppDirectory(std::set<FilePath>* plugin_dirs); |
| 133 | 134 |
| 134 // The executable path where we expect to find plugins. | 135 // The executable path where we expect to find plugins. |
| 135 static FilePath GetPluginExeDirectory(); | 136 static void GetExeDirectory(std::set<FilePath>* plugin_dirs); |
| 136 | 137 |
| 137 // Load plugins from the Firefox install path. This is kind of | 138 // Get plugin directory locations from the Firefox install path. This is kind |
| 138 // a kludge, but it helps us locate the flash player for users that | 139 // of a kludge, but it helps us locate the flash player for users that |
| 139 // already have it for firefox. Not having to download yet-another-plugin | 140 // already have it for firefox. Not having to download yet-another-plugin |
| 140 // is a good thing. | 141 // is a good thing. |
| 141 void LoadFirefoxPlugins(); | 142 void GetFirefoxDirectory(std::set<FilePath>* plugin_dirs); |
| 142 | 143 |
| 143 // Hardcoded logic to detect and load acrobat plugins | 144 // Hardcoded logic to detect Acrobat plugins locations. |
| 144 void LoadAcrobatPlugins(); | 145 void GetAcrobatDirectory(std::set<FilePath>* plugin_dirs); |
| 145 | 146 |
| 146 // Hardcoded logic to detect and load quicktime plugins | 147 // Hardcoded logic to detect QuickTime plugin location. |
| 147 void LoadQuicktimePlugins(); | 148 void GetQuicktimeDirectory(std::set<FilePath>* plugin_dirs); |
| 148 | 149 |
| 149 // Hardcoded logic to detect and load Windows Media Player plugins | 150 // Hardcoded logic to detect Windows Media Player plugin location. |
| 150 void LoadWindowsMediaPlugins(); | 151 void GetWindowsMediaDirectory(std::set<FilePath>* plugin_dirs); |
| 151 | 152 |
| 152 // Hardcoded logic to detect and load Java plugins | 153 // Hardcoded logic to detect Java plugin location. |
| 153 void LoadJavaPlugin(); | 154 void GetJavaDirectory(std::set<FilePath>* plugin_dirs); |
| 154 | 155 |
| 155 #if defined(OS_WIN) | 156 #if defined(OS_WIN) |
| 156 // Search the registry at the given path and load plugins listed there. | 157 // Search the registry at the given path and detect plugin directories. |
| 157 void LoadPluginsInRegistryFolder(HKEY root_key, | 158 void GetPluginsInRegistryDirectory(HKEY root_key, |
| 158 const std::wstring& registry_folder); | 159 const std::wstring& registry_folder, |
| 160 std::set<FilePath>* plugin_dirs); | |
| 159 #endif | 161 #endif |
| 160 | 162 |
| 161 // true if we shouldn't load the new WMP plugin. | 163 // true if we shouldn't load the new WMP plugin. |
| 162 bool dont_load_new_wmp_; | 164 bool dont_load_new_wmp_; |
| 163 | 165 |
| 164 bool use_internal_activex_shim_; | 166 bool use_internal_activex_shim_; |
| 165 | 167 |
| 166 static scoped_refptr<PluginList> singleton_; | 168 static scoped_refptr<PluginList> singleton_; |
| 167 bool plugins_loaded_; | 169 bool plugins_loaded_; |
| 168 | 170 |
| 169 // Maps from the name of the plugin file (NOT path) to WebPluginInfo. | 171 // Contains information about the available plugins. |
| 170 typedef base::hash_map<std::string, WebPluginInfo> PluginMap; | 172 std::vector<WebPluginInfo> plugins_; |
| 171 PluginMap plugins_; | |
| 172 | 173 |
| 173 DISALLOW_EVIL_CONSTRUCTORS(PluginList); | 174 DISALLOW_EVIL_CONSTRUCTORS(PluginList); |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 } // namespace NPAPI | 177 } // namespace NPAPI |
| 177 | 178 |
| 178 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ | 179 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H__ |
| 179 | 180 |
| OLD | NEW |