| 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(); |
| 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); |
| 187 string16 GetPluginGroupName(const std::string& plugin_name); | 189 string16 GetPluginGroupName(const std::string& plugin_name); |
| 188 | 190 |
| 189 // TODO(dpranke): This should be private. | 191 // TODO(dpranke): This should be private. |
| 190 webkit::npapi::PluginList* plugin_list(); | 192 webkit::npapi::PluginList* plugin_list(); |
| 191 | 193 |
| 194 void SetPluginListForTesting(webkit::npapi::PluginList* plugin_list); |
| 195 |
| 192 private: | 196 private: |
| 193 friend struct DefaultSingletonTraits<PluginService>; | 197 friend struct DefaultSingletonTraits<PluginService>; |
| 194 | 198 |
| 195 // Creates the PluginService object, but doesn't actually build the plugin | 199 // Creates the PluginService object, but doesn't actually build the plugin |
| 196 // list yet. It's generated lazily. | 200 // list yet. It's generated lazily. |
| 197 PluginService(); | 201 PluginService(); |
| 198 virtual ~PluginService(); | 202 virtual ~PluginService(); |
| 199 | 203 |
| 200 // base::WaitableEventWatcher::Delegate implementation. | 204 // base::WaitableEventWatcher::Delegate implementation. |
| 201 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 205 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 PluginProcessHost::Client* client); | 242 PluginProcessHost::Client* client); |
| 239 | 243 |
| 240 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 244 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 241 // Registers a new FilePathWatcher for a given path. | 245 // Registers a new FilePathWatcher for a given path. |
| 242 static void RegisterFilePathWatcher( | 246 static void RegisterFilePathWatcher( |
| 243 base::files::FilePathWatcher* watcher, | 247 base::files::FilePathWatcher* watcher, |
| 244 const FilePath& path, | 248 const FilePath& path, |
| 245 base::files::FilePathWatcher::Delegate* delegate); | 249 base::files::FilePathWatcher::Delegate* delegate); |
| 246 #endif | 250 #endif |
| 247 | 251 |
| 252 // Whether or not the Init() method was called. |
| 253 bool did_init_; |
| 254 |
| 255 // The plugin list instance. |
| 256 webkit::npapi::PluginList* plugin_list_; |
| 257 |
| 248 // The browser's UI locale. | 258 // The browser's UI locale. |
| 249 const std::string ui_locale_; | 259 const std::string ui_locale_; |
| 250 | 260 |
| 251 content::NotificationRegistrar registrar_; | 261 content::NotificationRegistrar registrar_; |
| 252 | 262 |
| 253 #if defined(OS_WIN) | 263 #if defined(OS_WIN) |
| 254 // Registry keys for getting notifications when new plugins are installed. | 264 // Registry keys for getting notifications when new plugins are installed. |
| 255 base::win::RegKey hkcu_key_; | 265 base::win::RegKey hkcu_key_; |
| 256 base::win::RegKey hklm_key_; | 266 base::win::RegKey hklm_key_; |
| 257 scoped_ptr<base::WaitableEvent> hkcu_event_; | 267 scoped_ptr<base::WaitableEvent> hkcu_event_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 275 #if defined(OS_POSIX) | 285 #if defined(OS_POSIX) |
| 276 scoped_refptr<PluginLoaderPosix> plugin_loader_; | 286 scoped_refptr<PluginLoaderPosix> plugin_loader_; |
| 277 #endif | 287 #endif |
| 278 | 288 |
| 279 DISALLOW_COPY_AND_ASSIGN(PluginService); | 289 DISALLOW_COPY_AND_ASSIGN(PluginService); |
| 280 }; | 290 }; |
| 281 | 291 |
| 282 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 292 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
| 283 | 293 |
| 284 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 294 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |