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

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

Issue 10958066: Get rid of the content::NOTIFICATION_APP_ACTIVATED notification since it was fired from Chrome (con… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 months 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 | « chrome/browser/app_controller_mac.mm ('k') | content/browser/plugin_service_impl.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) 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
11 #include <map> 11 #include <map>
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "base/synchronization/waitable_event_watcher.h" 19 #include "base/synchronization/waitable_event_watcher.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/time.h" 21 #include "base/time.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "content/browser/plugin_process_host.h" 23 #include "content/browser/plugin_process_host.h"
24 #include "content/browser/ppapi_plugin_process_host.h" 24 #include "content/browser/ppapi_plugin_process_host.h"
25 #include "content/common/content_export.h" 25 #include "content/common/content_export.h"
26 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/plugin_service.h" 26 #include "content/public/browser/plugin_service.h"
29 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
30 #include "ipc/ipc_channel_handle.h" 28 #include "ipc/ipc_channel_handle.h"
31 29
32 #if defined(OS_WIN) 30 #if defined(OS_WIN)
33 #include "base/memory/scoped_ptr.h" 31 #include "base/memory/scoped_ptr.h"
34 #include "base/win/registry.h" 32 #include "base/win/registry.h"
35 #endif 33 #endif
36 34
37 #if defined(OS_POSIX) && !defined(OS_OPENBSD) 35 #if defined(OS_POSIX) && !defined(OS_OPENBSD)
(...skipping 25 matching lines...) Expand all
63 // surpass that limit. 61 // surpass that limit.
64 struct PluginServiceFilterParams { 62 struct PluginServiceFilterParams {
65 int render_process_id; 63 int render_process_id;
66 int render_view_id; 64 int render_view_id;
67 GURL page_url; 65 GURL page_url;
68 content::ResourceContext* resource_context; 66 content::ResourceContext* resource_context;
69 }; 67 };
70 68
71 class CONTENT_EXPORT PluginServiceImpl 69 class CONTENT_EXPORT PluginServiceImpl
72 : NON_EXPORTED_BASE(public content::PluginService), 70 : NON_EXPORTED_BASE(public content::PluginService),
73 public base::WaitableEventWatcher::Delegate, 71 public base::WaitableEventWatcher::Delegate {
74 public content::NotificationObserver {
75 public: 72 public:
76 // Returns the PluginServiceImpl singleton. 73 // Returns the PluginServiceImpl singleton.
77 static PluginServiceImpl* GetInstance(); 74 static PluginServiceImpl* GetInstance();
78 75
79 // content::PluginService implementation: 76 // content::PluginService implementation:
80 virtual void Init() OVERRIDE; 77 virtual void Init() OVERRIDE;
81 virtual void StartWatchingPlugins() OVERRIDE; 78 virtual void StartWatchingPlugins() OVERRIDE;
82 virtual bool GetPluginInfoArray( 79 virtual bool GetPluginInfoArray(
83 const GURL& url, 80 const GURL& url,
84 const std::string& mime_type, 81 const std::string& mime_type,
(...skipping 26 matching lines...) Expand all
111 virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE; 108 virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE;
112 virtual void AddExtraPluginDir(const FilePath& path) OVERRIDE; 109 virtual void AddExtraPluginDir(const FilePath& path) OVERRIDE;
113 virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE; 110 virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE;
114 virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE; 111 virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE;
115 virtual void RegisterInternalPlugin( 112 virtual void RegisterInternalPlugin(
116 const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE; 113 const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE;
117 virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE; 114 virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE;
118 virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE; 115 virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE;
119 virtual void SetPluginListForTesting( 116 virtual void SetPluginListForTesting(
120 webkit::npapi::PluginList* plugin_list) OVERRIDE; 117 webkit::npapi::PluginList* plugin_list) OVERRIDE;
118 #if defined(OS_MACOSX)
119 virtual void AppActivated() OVERRIDE;
120 #endif
121 121
122 // Returns the plugin process host corresponding to the plugin process that 122 // Returns the plugin process host corresponding to the plugin process that
123 // has been started by this service. This will start a process to host the 123 // has been started by this service. This will start a process to host the
124 // 'plugin_path' if needed. If the process fails to start, the return value 124 // 'plugin_path' if needed. If the process fails to start, the return value
125 // is NULL. Must be called on the IO thread. 125 // is NULL. Must be called on the IO thread.
126 PluginProcessHost* FindOrStartNpapiPluginProcess( 126 PluginProcessHost* FindOrStartNpapiPluginProcess(
127 const FilePath& plugin_path); 127 const FilePath& plugin_path);
128 PpapiPluginProcessHost* FindOrStartPpapiPluginProcess( 128 PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
129 const FilePath& plugin_path, 129 const FilePath& plugin_path,
130 const FilePath& profile_data_directory, 130 const FilePath& profile_data_directory,
(...skipping 27 matching lines...) Expand all
158 158
159 // Creates the PluginServiceImpl object, but doesn't actually build the plugin 159 // Creates the PluginServiceImpl object, but doesn't actually build the plugin
160 // list yet. It's generated lazily. 160 // list yet. It's generated lazily.
161 PluginServiceImpl(); 161 PluginServiceImpl();
162 virtual ~PluginServiceImpl(); 162 virtual ~PluginServiceImpl();
163 163
164 // base::WaitableEventWatcher::Delegate implementation. 164 // base::WaitableEventWatcher::Delegate implementation.
165 virtual void OnWaitableEventSignaled( 165 virtual void OnWaitableEventSignaled(
166 base::WaitableEvent* waitable_event) OVERRIDE; 166 base::WaitableEvent* waitable_event) OVERRIDE;
167 167
168 // content::NotificationObserver implementation
169 virtual void Observe(int type,
170 const content::NotificationSource& source,
171 const content::NotificationDetails& details) OVERRIDE;
172
173 // Returns the plugin process host corresponding to the plugin process that 168 // Returns the plugin process host corresponding to the plugin process that
174 // has been started by this service. Returns NULL if no process has been 169 // has been started by this service. Returns NULL if no process has been
175 // started. 170 // started.
176 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); 171 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
177 PpapiPluginProcessHost* FindPpapiPluginProcess( 172 PpapiPluginProcessHost* FindPpapiPluginProcess(
178 const FilePath& plugin_path, 173 const FilePath& plugin_path,
179 const FilePath& profile_data_directory); 174 const FilePath& profile_data_directory);
180 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path); 175 PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path);
181 176
182 void RegisterPepperPlugins(); 177 void RegisterPepperPlugins();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Registers a new FilePathWatcher for a given path. 210 // Registers a new FilePathWatcher for a given path.
216 static void RegisterFilePathWatcher( 211 static void RegisterFilePathWatcher(
217 base::files::FilePathWatcher* watcher, 212 base::files::FilePathWatcher* watcher,
218 const FilePath& path, 213 const FilePath& path,
219 base::files::FilePathWatcher::Delegate* delegate); 214 base::files::FilePathWatcher::Delegate* delegate);
220 #endif 215 #endif
221 216
222 // The plugin list instance. 217 // The plugin list instance.
223 webkit::npapi::PluginList* plugin_list_; 218 webkit::npapi::PluginList* plugin_list_;
224 219
225 content::NotificationRegistrar registrar_;
226
227 #if defined(OS_WIN) 220 #if defined(OS_WIN)
228 // Registry keys for getting notifications when new plugins are installed. 221 // Registry keys for getting notifications when new plugins are installed.
229 base::win::RegKey hkcu_key_; 222 base::win::RegKey hkcu_key_;
230 base::win::RegKey hklm_key_; 223 base::win::RegKey hklm_key_;
231 scoped_ptr<base::WaitableEvent> hkcu_event_; 224 scoped_ptr<base::WaitableEvent> hkcu_event_;
232 scoped_ptr<base::WaitableEvent> hklm_event_; 225 scoped_ptr<base::WaitableEvent> hklm_event_;
233 base::WaitableEventWatcher hkcu_watcher_; 226 base::WaitableEventWatcher hkcu_watcher_;
234 base::WaitableEventWatcher hklm_watcher_; 227 base::WaitableEventWatcher hklm_watcher_;
235 #endif 228 #endif
236 229
(...skipping 17 matching lines...) Expand all
254 scoped_refptr<PluginLoaderPosix> plugin_loader_; 247 scoped_refptr<PluginLoaderPosix> plugin_loader_;
255 #endif 248 #endif
256 249
257 // Used to detect if a given plug-in is crashing over and over. 250 // Used to detect if a given plug-in is crashing over and over.
258 std::map<FilePath, std::vector<base::Time> > crash_times_; 251 std::map<FilePath, std::vector<base::Time> > crash_times_;
259 252
260 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); 253 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl);
261 }; 254 };
262 255
263 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ 256 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698