| 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 |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 18 #include "base/synchronization/waitable_event_watcher.h" | 18 #include "base/synchronization/waitable_event_watcher.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "content/browser/plugin_process_host.h" | 20 #include "content/browser/plugin_process_host.h" |
| 21 #include "content/browser/ppapi_plugin_process_host.h" | 21 #include "content/browser/ppapi_plugin_process_host.h" |
| 22 #include "content/browser/ppapi_broker_process_host.h" | 22 #include "content/browser/ppapi_broker_process_host.h" |
| 23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
| 24 #include "content/common/notification_observer.h" | 24 #include "content/common/notification_observer.h" |
| 25 #include "content/common/notification_registrar.h" | 25 #include "content/common/notification_registrar.h" |
| 26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "ipc/ipc_channel_handle.h" | 27 #include "ipc/ipc_channel_handle.h" |
| 28 #include "webkit/plugins/ppapi/ppapi_plugin_list.h" |
| 28 #include "webkit/plugins/webplugininfo.h" | 29 #include "webkit/plugins/webplugininfo.h" |
| 29 | 30 |
| 30 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 31 #include "base/memory/scoped_ptr.h" | 32 #include "base/memory/scoped_ptr.h" |
| 32 #include "base/win/registry.h" | 33 #include "base/win/registry.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 36 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 36 #include "base/files/file_path_watcher.h" | 37 #include "base/files/file_path_watcher.h" |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 struct PepperPluginInfo; | |
| 40 class PluginDirWatcherDelegate; | 40 class PluginDirWatcherDelegate; |
| 41 | 41 |
| 42 namespace content { | 42 namespace content { |
| 43 class ResourceContext; | 43 class ResourceContext; |
| 44 class PluginServiceFilter; | 44 class PluginServiceFilter; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // This must be created on the main thread but it's only called on the IO/file | 47 // This must be created on the main thread but it's only called on the IO/file |
| 48 // thread. | 48 // thread. |
| 49 class CONTENT_EXPORT PluginService | 49 class CONTENT_EXPORT PluginService |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // base::WaitableEventWatcher::Delegate implementation. | 140 // base::WaitableEventWatcher::Delegate implementation. |
| 141 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 141 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| 142 | 142 |
| 143 // NotificationObserver implementation | 143 // NotificationObserver implementation |
| 144 virtual void Observe(int type, const NotificationSource& source, | 144 virtual void Observe(int type, const NotificationSource& source, |
| 145 const NotificationDetails& details); | 145 const NotificationDetails& details); |
| 146 | 146 |
| 147 void RegisterPepperPlugins(); | 147 void RegisterPepperPlugins(); |
| 148 | 148 |
| 149 PepperPluginInfo* GetRegisteredPpapiPluginInfo(const FilePath& plugin_path); | 149 const webkit::ppapi::PluginInfo* GetRegisteredPpapiPluginInfo( |
| 150 const FilePath& plugin_path); |
| 150 | 151 |
| 151 // Helper so we can do the plugin lookup on the FILE thread. | 152 // Helper so we can do the plugin lookup on the FILE thread. |
| 152 void GetAllowedPluginForOpenChannelToPlugin( | 153 void GetAllowedPluginForOpenChannelToPlugin( |
| 153 int render_process_id, | 154 int render_process_id, |
| 154 int render_view_id, | 155 int render_view_id, |
| 155 const GURL& url, | 156 const GURL& url, |
| 156 const GURL& page_url, | 157 const GURL& page_url, |
| 157 const std::string& mime_type, | 158 const std::string& mime_type, |
| 158 PluginProcessHost::Client* client, | 159 PluginProcessHost::Client* client, |
| 159 const content::ResourceContext* resource_context); | 160 const content::ResourceContext* resource_context); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 185 scoped_ptr<base::WaitableEvent> hklm_event_; | 186 scoped_ptr<base::WaitableEvent> hklm_event_; |
| 186 base::WaitableEventWatcher hkcu_watcher_; | 187 base::WaitableEventWatcher hkcu_watcher_; |
| 187 base::WaitableEventWatcher hklm_watcher_; | 188 base::WaitableEventWatcher hklm_watcher_; |
| 188 #endif | 189 #endif |
| 189 | 190 |
| 190 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 191 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 191 ScopedVector<base::files::FilePathWatcher> file_watchers_; | 192 ScopedVector<base::files::FilePathWatcher> file_watchers_; |
| 192 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; | 193 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; |
| 193 #endif | 194 #endif |
| 194 | 195 |
| 195 std::vector<PepperPluginInfo> ppapi_plugins_; | 196 webkit::ppapi::PluginList ppapi_plugins_; |
| 196 | 197 |
| 197 // Weak pointer; outlives us. | 198 // Weak pointer; outlives us. |
| 198 content::PluginServiceFilter* filter_; | 199 content::PluginServiceFilter* filter_; |
| 199 | 200 |
| 200 std::set<PluginProcessHost::Client*> pending_plugin_clients_; | 201 std::set<PluginProcessHost::Client*> pending_plugin_clients_; |
| 201 | 202 |
| 202 DISALLOW_COPY_AND_ASSIGN(PluginService); | 203 DISALLOW_COPY_AND_ASSIGN(PluginService); |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 206 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
| 206 | 207 |
| 207 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 208 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |