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_IMPL_H_ |
9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <set> | 12 #include <set> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.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" |
(...skipping 30 matching lines...) Expand all Loading... |
50 struct PluginServiceFilterParams; | 50 struct PluginServiceFilterParams; |
51 } | 51 } |
52 | 52 |
53 namespace webkit { | 53 namespace webkit { |
54 namespace npapi { | 54 namespace npapi { |
55 class PluginGroup; | 55 class PluginGroup; |
56 class PluginList; | 56 class PluginList; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 class CONTENT_EXPORT PluginService | 60 class CONTENT_EXPORT PluginServiceImpl |
61 : NON_EXPORTED_BASE(public content::PluginService), | 61 : NON_EXPORTED_BASE(public content::PluginService), |
62 public base::WaitableEventWatcher::Delegate, | 62 public base::WaitableEventWatcher::Delegate, |
63 public content::NotificationObserver { | 63 public content::NotificationObserver { |
64 public: | 64 public: |
65 // Returns the PluginService singleton. | 65 // Returns the PluginServiceImpl singleton. |
66 static PluginService* GetInstance(); | 66 static PluginServiceImpl* GetInstance(); |
67 | 67 |
68 // content::PluginService implementation: | 68 // content::PluginService implementation: |
69 virtual void Init() OVERRIDE; | 69 virtual void Init() OVERRIDE; |
70 virtual void StartWatchingPlugins() OVERRIDE; | 70 virtual void StartWatchingPlugins() OVERRIDE; |
71 virtual PluginProcessHost* FindNpapiPluginProcess( | 71 virtual PluginProcessHost* FindNpapiPluginProcess( |
72 const FilePath& plugin_path) OVERRIDE; | 72 const FilePath& plugin_path) OVERRIDE; |
73 virtual bool GetPluginInfoArray( | 73 virtual bool GetPluginInfoArray( |
74 const GURL& url, | 74 const GURL& url, |
75 const std::string& mime_type, | 75 const std::string& mime_type, |
76 bool allow_wildcard, | 76 bool allow_wildcard, |
(...skipping 19 matching lines...) Expand all Loading... |
96 virtual void SetFilter(content::PluginServiceFilter* filter) OVERRIDE; | 96 virtual void SetFilter(content::PluginServiceFilter* filter) OVERRIDE; |
97 virtual content::PluginServiceFilter* GetFilter() OVERRIDE; | 97 virtual content::PluginServiceFilter* GetFilter() OVERRIDE; |
98 virtual void RefreshPlugins() OVERRIDE; | 98 virtual void RefreshPlugins() OVERRIDE; |
99 virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE; | 99 virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE; |
100 virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE; | 100 virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE; |
101 virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE; | 101 virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE; |
102 virtual void RegisterInternalPlugin( | 102 virtual void RegisterInternalPlugin( |
103 const webkit::WebPluginInfo& info) OVERRIDE; | 103 const webkit::WebPluginInfo& info) OVERRIDE; |
104 virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE; | 104 virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE; |
105 virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE; | 105 virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE; |
| 106 virtual void SetPluginListForTesting( |
| 107 webkit::npapi::PluginList* plugin_list) OVERRIDE; |
106 | 108 |
107 // Gets the browser's UI locale. | 109 // Gets the browser's UI locale. |
108 const std::string& GetUILocale(); | 110 const std::string& GetUILocale(); |
109 | 111 |
110 // Like FindNpapiPluginProcess but for Pepper. | 112 // Like FindNpapiPluginProcess but for Pepper. |
111 PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path); | 113 PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path); |
112 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path); | 114 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path); |
113 | 115 |
114 // Returns the plugin process host corresponding to the plugin process that | 116 // Returns the plugin process host corresponding to the plugin process that |
115 // has been started by this service. This will start a process to host the | 117 // has been started by this service. This will start a process to host the |
(...skipping 17 matching lines...) Expand all Loading... |
133 const std::string& mime_type, | 135 const std::string& mime_type, |
134 PluginProcessHost::Client* client); | 136 PluginProcessHost::Client* client); |
135 void OpenChannelToPpapiPlugin(const FilePath& path, | 137 void OpenChannelToPpapiPlugin(const FilePath& path, |
136 PpapiPluginProcessHost::PluginClient* client); | 138 PpapiPluginProcessHost::PluginClient* client); |
137 void OpenChannelToPpapiBroker(const FilePath& path, | 139 void OpenChannelToPpapiBroker(const FilePath& path, |
138 PpapiPluginProcessHost::BrokerClient* client); | 140 PpapiPluginProcessHost::BrokerClient* client); |
139 | 141 |
140 // Cancels opening a channel to a NPAPI plugin. | 142 // Cancels opening a channel to a NPAPI plugin. |
141 void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client); | 143 void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client); |
142 | 144 |
143 void SetPluginListForTesting(webkit::npapi::PluginList* plugin_list); | 145 private: |
| 146 friend struct DefaultSingletonTraits<PluginServiceImpl>; |
144 | 147 |
145 private: | 148 // Creates the PluginServiceImpl object, but doesn't actually build the plugin |
146 friend struct DefaultSingletonTraits<PluginService>; | |
147 | |
148 // Creates the PluginService object, but doesn't actually build the plugin | |
149 // list yet. It's generated lazily. | 149 // list yet. It's generated lazily. |
150 PluginService(); | 150 PluginServiceImpl(); |
151 virtual ~PluginService(); | 151 virtual ~PluginServiceImpl(); |
152 | 152 |
153 // base::WaitableEventWatcher::Delegate implementation. | 153 // base::WaitableEventWatcher::Delegate implementation. |
154 virtual void OnWaitableEventSignaled( | 154 virtual void OnWaitableEventSignaled( |
155 base::WaitableEvent* waitable_event) OVERRIDE; | 155 base::WaitableEvent* waitable_event) OVERRIDE; |
156 | 156 |
157 // content::NotificationObserver implementation | 157 // content::NotificationObserver implementation |
158 virtual void Observe(int type, | 158 virtual void Observe(int type, |
159 const content::NotificationSource& source, | 159 const content::NotificationSource& source, |
160 const content::NotificationDetails& details) OVERRIDE; | 160 const content::NotificationDetails& details) OVERRIDE; |
161 | 161 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 // Weak pointer; outlives us. | 225 // Weak pointer; outlives us. |
226 content::PluginServiceFilter* filter_; | 226 content::PluginServiceFilter* filter_; |
227 | 227 |
228 std::set<PluginProcessHost::Client*> pending_plugin_clients_; | 228 std::set<PluginProcessHost::Client*> pending_plugin_clients_; |
229 | 229 |
230 #if defined(OS_POSIX) | 230 #if defined(OS_POSIX) |
231 scoped_refptr<PluginLoaderPosix> plugin_loader_; | 231 scoped_refptr<PluginLoaderPosix> plugin_loader_; |
232 #endif | 232 #endif |
233 | 233 |
234 DISALLOW_COPY_AND_ASSIGN(PluginService); | 234 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); |
235 }; | 235 }; |
236 | 236 |
237 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 237 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
238 | |
239 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | |
OLD | NEW |