Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: content/browser/plugin_service.h

Issue 8493019: Refactor PluginService to take PluginList as a dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: did_init Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/plugin_loader_posix.cc ('k') | content/browser/plugin_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 // The plugin list instance.
253 webkit::npapi::PluginList* plugin_list_;
254
248 // The browser's UI locale. 255 // The browser's UI locale.
249 const std::string ui_locale_; 256 const std::string ui_locale_;
250 257
251 content::NotificationRegistrar registrar_; 258 content::NotificationRegistrar registrar_;
252 259
253 #if defined(OS_WIN) 260 #if defined(OS_WIN)
254 // Registry keys for getting notifications when new plugins are installed. 261 // Registry keys for getting notifications when new plugins are installed.
255 base::win::RegKey hkcu_key_; 262 base::win::RegKey hkcu_key_;
256 base::win::RegKey hklm_key_; 263 base::win::RegKey hklm_key_;
257 scoped_ptr<base::WaitableEvent> hkcu_event_; 264 scoped_ptr<base::WaitableEvent> hkcu_event_;
(...skipping 17 matching lines...) Expand all
275 #if defined(OS_POSIX) 282 #if defined(OS_POSIX)
276 scoped_refptr<PluginLoaderPosix> plugin_loader_; 283 scoped_refptr<PluginLoaderPosix> plugin_loader_;
277 #endif 284 #endif
278 285
279 DISALLOW_COPY_AND_ASSIGN(PluginService); 286 DISALLOW_COPY_AND_ASSIGN(PluginService);
280 }; 287 };
281 288
282 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); 289 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService);
283 290
284 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ 291 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_
OLDNEW
« no previous file with comments | « content/browser/plugin_loader_posix.cc ('k') | content/browser/plugin_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698