| 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 // 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_IMPL_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // base::Bind() has limited arity, and the filter-related methods tend to | 57 // base::Bind() has limited arity, and the filter-related methods tend to |
| 58 // surpass that limit. | 58 // surpass that limit. |
| 59 struct PluginServiceFilterParams { | 59 struct PluginServiceFilterParams { |
| 60 int render_process_id; | 60 int render_process_id; |
| 61 int render_view_id; | 61 int render_view_id; |
| 62 GURL page_url; | 62 GURL page_url; |
| 63 ResourceContext* resource_context; | 63 ResourceContext* resource_context; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class CONTENT_EXPORT PluginServiceImpl | 66 class CONTENT_EXPORT PluginServiceImpl |
| 67 : NON_EXPORTED_BASE(public PluginService), | 67 : NON_EXPORTED_BASE(public PluginService) { |
| 68 public base::WaitableEventWatcher::Delegate { | |
| 69 public: | 68 public: |
| 70 // Returns the PluginServiceImpl singleton. | 69 // Returns the PluginServiceImpl singleton. |
| 71 static PluginServiceImpl* GetInstance(); | 70 static PluginServiceImpl* GetInstance(); |
| 72 | 71 |
| 73 // PluginService implementation: | 72 // PluginService implementation: |
| 74 virtual void Init() OVERRIDE; | 73 virtual void Init() OVERRIDE; |
| 75 virtual void StartWatchingPlugins() OVERRIDE; | 74 virtual void StartWatchingPlugins() OVERRIDE; |
| 76 virtual bool GetPluginInfoArray( | 75 virtual bool GetPluginInfoArray( |
| 77 const GURL& url, | 76 const GURL& url, |
| 78 const std::string& mime_type, | 77 const std::string& mime_type, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void RegisterPluginCrash(const FilePath& plugin_path); | 149 void RegisterPluginCrash(const FilePath& plugin_path); |
| 151 | 150 |
| 152 private: | 151 private: |
| 153 friend struct DefaultSingletonTraits<PluginServiceImpl>; | 152 friend struct DefaultSingletonTraits<PluginServiceImpl>; |
| 154 | 153 |
| 155 // Creates the PluginServiceImpl object, but doesn't actually build the plugin | 154 // Creates the PluginServiceImpl object, but doesn't actually build the plugin |
| 156 // list yet. It's generated lazily. | 155 // list yet. It's generated lazily. |
| 157 PluginServiceImpl(); | 156 PluginServiceImpl(); |
| 158 virtual ~PluginServiceImpl(); | 157 virtual ~PluginServiceImpl(); |
| 159 | 158 |
| 160 // base::WaitableEventWatcher::Delegate implementation. | 159 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| 161 virtual void OnWaitableEventSignaled( | |
| 162 base::WaitableEvent* waitable_event) OVERRIDE; | |
| 163 | 160 |
| 164 // Returns the plugin process host corresponding to the plugin process that | 161 // Returns the plugin process host corresponding to the plugin process that |
| 165 // has been started by this service. Returns NULL if no process has been | 162 // has been started by this service. Returns NULL if no process has been |
| 166 // started. | 163 // started. |
| 167 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); | 164 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); |
| 168 PpapiPluginProcessHost* FindPpapiPluginProcess( | 165 PpapiPluginProcessHost* FindPpapiPluginProcess( |
| 169 const FilePath& plugin_path, | 166 const FilePath& plugin_path, |
| 170 const FilePath& profile_data_directory); | 167 const FilePath& profile_data_directory); |
| 171 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path); | 168 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path); |
| 172 | 169 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 webkit::npapi::PluginList* plugin_list_; | 206 webkit::npapi::PluginList* plugin_list_; |
| 210 | 207 |
| 211 #if defined(OS_WIN) | 208 #if defined(OS_WIN) |
| 212 // Registry keys for getting notifications when new plugins are installed. | 209 // Registry keys for getting notifications when new plugins are installed. |
| 213 base::win::RegKey hkcu_key_; | 210 base::win::RegKey hkcu_key_; |
| 214 base::win::RegKey hklm_key_; | 211 base::win::RegKey hklm_key_; |
| 215 scoped_ptr<base::WaitableEvent> hkcu_event_; | 212 scoped_ptr<base::WaitableEvent> hkcu_event_; |
| 216 scoped_ptr<base::WaitableEvent> hklm_event_; | 213 scoped_ptr<base::WaitableEvent> hklm_event_; |
| 217 base::WaitableEventWatcher hkcu_watcher_; | 214 base::WaitableEventWatcher hkcu_watcher_; |
| 218 base::WaitableEventWatcher hklm_watcher_; | 215 base::WaitableEventWatcher hklm_watcher_; |
| 216 base::Callback<void(base::WaitableEvent*)> registry_watcher_callback_; |
| 219 #endif | 217 #endif |
| 220 | 218 |
| 221 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 219 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 222 ScopedVector<base::FilePathWatcher> file_watchers_; | 220 ScopedVector<base::FilePathWatcher> file_watchers_; |
| 223 #endif | 221 #endif |
| 224 | 222 |
| 225 std::vector<PepperPluginInfo> ppapi_plugins_; | 223 std::vector<PepperPluginInfo> ppapi_plugins_; |
| 226 | 224 |
| 227 // Weak pointer; outlives us. | 225 // Weak pointer; outlives us. |
| 228 PluginServiceFilter* filter_; | 226 PluginServiceFilter* filter_; |
| 229 | 227 |
| 230 std::set<PluginProcessHost::Client*> pending_plugin_clients_; | 228 std::set<PluginProcessHost::Client*> pending_plugin_clients_; |
| 231 | 229 |
| 232 // Used to sequentialize loading plug-ins from disk. | 230 // Used to sequentialize loading plug-ins from disk. |
| 233 base::SequencedWorkerPool::SequenceToken plugin_list_token_; | 231 base::SequencedWorkerPool::SequenceToken plugin_list_token_; |
| 234 | 232 |
| 235 #if defined(OS_POSIX) | 233 #if defined(OS_POSIX) |
| 236 scoped_refptr<PluginLoaderPosix> plugin_loader_; | 234 scoped_refptr<PluginLoaderPosix> plugin_loader_; |
| 237 #endif | 235 #endif |
| 238 | 236 |
| 239 // Used to detect if a given plug-in is crashing over and over. | 237 // Used to detect if a given plug-in is crashing over and over. |
| 240 std::map<FilePath, std::vector<base::Time> > crash_times_; | 238 std::map<FilePath, std::vector<base::Time> > crash_times_; |
| 241 | 239 |
| 242 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); | 240 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); |
| 243 }; | 241 }; |
| 244 | 242 |
| 245 } // namespace content | 243 } // namespace content |
| 246 | 244 |
| 247 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 245 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| OLD | NEW |