| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This class responds to requests from renderers for the list of plugins, and | 5 // This class responds to requests from renderers for the list of plugins, and |
| 6 // also a proxy object for plugin instances. | 6 // also a proxy object for plugin instances. |
| 7 | 7 |
| 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> | 76 typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> |
| 77 GetPluginsCallback; | 77 GetPluginsCallback; |
| 78 typedef base::Callback<void(const std::vector<webkit::npapi::PluginGroup>&)> | 78 typedef base::Callback<void(const std::vector<webkit::npapi::PluginGroup>&)> |
| 79 GetPluginGroupsCallback; | 79 GetPluginGroupsCallback; |
| 80 | 80 |
| 81 // Returns the PluginService singleton. | 81 // Returns the PluginService singleton. |
| 82 static PluginService* GetInstance(); | 82 static PluginService* GetInstance(); |
| 83 | 83 |
| 84 // Must be called on the instance to finish initialization. |
| 85 void Init(webkit::npapi::PluginList* plugin_list); |
| 86 |
| 84 // Starts watching for changes in the list of installed plug-ins. | 87 // Starts watching for changes in the list of installed plug-ins. |
| 85 void StartWatchingPlugins(); | 88 void StartWatchingPlugins(); |
| 86 | 89 |
| 87 // Gets the browser's UI locale. | 90 // Gets the browser's UI locale. |
| 88 const std::string& GetUILocale(); | 91 const std::string& GetUILocale(); |
| 89 | 92 |
| 90 // Returns the plugin process host corresponding to the plugin process that | 93 // Returns the plugin process host corresponding to the plugin process that |
| 91 // has been started by this service. Returns NULL if no process has been | 94 // has been started by this service. Returns NULL if no process has been |
| 92 // started. | 95 // started. |
| 93 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); | 96 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // in all renderers. | 169 // in all renderers. |
| 167 // NOTE: can only be called on the UI thread. | 170 // NOTE: can only be called on the UI thread. |
| 168 static void PurgePluginListCache(content::BrowserContext* browser_context, | 171 static void PurgePluginListCache(content::BrowserContext* browser_context, |
| 169 bool reload_pages); | 172 bool reload_pages); |
| 170 | 173 |
| 171 void set_filter(content::PluginServiceFilter* filter) { | 174 void set_filter(content::PluginServiceFilter* filter) { |
| 172 filter_ = filter; | 175 filter_ = filter; |
| 173 } | 176 } |
| 174 content::PluginServiceFilter* filter() { return filter_; } | 177 content::PluginServiceFilter* filter() { return filter_; } |
| 175 | 178 |
| 176 | |
| 177 // The following functions are wrappers around webkit::npapi::PluginList. | 179 // The following functions are wrappers around webkit::npapi::PluginList. |
| 178 // These must be used instead of those in order to ensure that we have a | 180 // These must be used instead of those in order to ensure that we have a |
| 179 // single global list in the component build and so that we don't | 181 // single global list in the component build and so that we don't |
| 180 // accidentally load plugins in the wrong process or thread. Refer to | 182 // accidentally load plugins in the wrong process or thread. Refer to |
| 181 // PluginList for further documentation of these functions. | 183 // PluginList for further documentation of these functions. |
| 182 void RefreshPlugins(); | 184 void RefreshPlugins(); |
| 183 void AddExtraPluginPath(const FilePath& path); | 185 void AddExtraPluginPath(const FilePath& path); |
| 184 void RemoveExtraPluginPath(const FilePath& path); | 186 void RemoveExtraPluginPath(const FilePath& path); |
| 185 void UnregisterInternalPlugin(const FilePath& path); | 187 void UnregisterInternalPlugin(const FilePath& path); |
| 186 void RegisterInternalPlugin(const webkit::WebPluginInfo& info); | 188 void RegisterInternalPlugin(const webkit::WebPluginInfo& info); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 PluginProcessHost::Client* client); | 240 PluginProcessHost::Client* client); |
| 239 | 241 |
| 240 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 242 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 241 // Registers a new FilePathWatcher for a given path. | 243 // Registers a new FilePathWatcher for a given path. |
| 242 static void RegisterFilePathWatcher( | 244 static void RegisterFilePathWatcher( |
| 243 base::files::FilePathWatcher* watcher, | 245 base::files::FilePathWatcher* watcher, |
| 244 const FilePath& path, | 246 const FilePath& path, |
| 245 base::files::FilePathWatcher::Delegate* delegate); | 247 base::files::FilePathWatcher::Delegate* delegate); |
| 246 #endif | 248 #endif |
| 247 | 249 |
| 250 // The plugin list instance. |
| 251 webkit::npapi::PluginList* plugin_list_; |
| 252 |
| 248 // The browser's UI locale. | 253 // The browser's UI locale. |
| 249 const std::string ui_locale_; | 254 const std::string ui_locale_; |
| 250 | 255 |
| 251 content::NotificationRegistrar registrar_; | 256 content::NotificationRegistrar registrar_; |
| 252 | 257 |
| 253 #if defined(OS_WIN) | 258 #if defined(OS_WIN) |
| 254 // Registry keys for getting notifications when new plugins are installed. | 259 // Registry keys for getting notifications when new plugins are installed. |
| 255 base::win::RegKey hkcu_key_; | 260 base::win::RegKey hkcu_key_; |
| 256 base::win::RegKey hklm_key_; | 261 base::win::RegKey hklm_key_; |
| 257 scoped_ptr<base::WaitableEvent> hkcu_event_; | 262 scoped_ptr<base::WaitableEvent> hkcu_event_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 275 #if defined(OS_POSIX) | 280 #if defined(OS_POSIX) |
| 276 scoped_refptr<PluginLoaderPosix> plugin_loader_; | 281 scoped_refptr<PluginLoaderPosix> plugin_loader_; |
| 277 #endif | 282 #endif |
| 278 | 283 |
| 279 DISALLOW_COPY_AND_ASSIGN(PluginService); | 284 DISALLOW_COPY_AND_ASSIGN(PluginService); |
| 280 }; | 285 }; |
| 281 | 286 |
| 282 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 287 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
| 283 | 288 |
| 284 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 289 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |