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

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

Issue 6486034: Share PPAPI out-of-process plugins between renderer processes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/plugin_data_remover.cc ('k') | chrome/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 CHROME_BROWSER_PLUGIN_SERVICE_H_ 8 #ifndef CHROME_BROWSER_PLUGIN_SERVICE_H_
9 #define CHROME_BROWSER_PLUGIN_SERVICE_H_ 9 #define CHROME_BROWSER_PLUGIN_SERVICE_H_
10 #pragma once 10 #pragma once
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/hash_tables.h" 16 #include "base/hash_tables.h"
17 #include "base/scoped_vector.h" 17 #include "base/scoped_vector.h"
18 #include "base/singleton.h" 18 #include "base/singleton.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/synchronization/waitable_event_watcher.h" 20 #include "base/synchronization/waitable_event_watcher.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/plugin_process_host.h" 22 #include "chrome/browser/plugin_process_host.h"
23 #include "chrome/browser/ppapi_plugin_process_host.h"
23 #include "chrome/common/notification_observer.h" 24 #include "chrome/common/notification_observer.h"
24 #include "chrome/common/notification_registrar.h" 25 #include "chrome/common/notification_registrar.h"
25 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
26 #include "ipc/ipc_channel_handle.h" 27 #include "ipc/ipc_channel_handle.h"
27 #include "webkit/plugins/npapi/webplugininfo.h" 28 #include "webkit/plugins/npapi/webplugininfo.h"
28 29
29 #if defined(OS_WIN) 30 #if defined(OS_WIN)
30 #include "base/scoped_ptr.h" 31 #include "base/scoped_ptr.h"
31 #include "base/win/registry.h" 32 #include "base/win/registry.h"
32 #endif 33 #endif
33 34
34 #if defined(OS_LINUX) 35 #if defined(OS_LINUX)
35 #include "chrome/browser/file_path_watcher/file_path_watcher.h" 36 #include "chrome/browser/file_path_watcher/file_path_watcher.h"
36 #endif 37 #endif
37 38
38 #if defined(OS_CHROMEOS) 39 #if defined(OS_CHROMEOS)
39 namespace chromeos { 40 namespace chromeos {
40 class PluginSelectionPolicy; 41 class PluginSelectionPolicy;
41 } 42 }
42 #endif 43 #endif
43 44
44 namespace IPC { 45 namespace IPC {
45 class Message; 46 class Message;
46 } 47 }
47 48
48 class MessageLoop; 49 class MessageLoop;
50 struct PepperPluginInfo;
51 class PluginDirWatcherDelegate;
49 class Profile; 52 class Profile;
50 class PluginDirWatcherDelegate;
51 class ResourceDispatcherHost; 53 class ResourceDispatcherHost;
52 54
53 namespace net { 55 namespace net {
54 class URLRequestContext; 56 class URLRequestContext;
55 } // namespace net 57 } // namespace net
56 58
57 // This must be created on the main thread but it's only called on the IO/file 59 // This must be created on the main thread but it's only called on the IO/file
58 // thread. 60 // thread.
59 class PluginService 61 class PluginService
60 : public base::WaitableEventWatcher::Delegate, 62 : public base::WaitableEventWatcher::Delegate,
(...skipping 21 matching lines...) Expand all
82 // persistent data. 84 // persistent data.
83 void SetChromePluginDataDir(const FilePath& data_dir); 85 void SetChromePluginDataDir(const FilePath& data_dir);
84 const FilePath& GetChromePluginDataDir(); 86 const FilePath& GetChromePluginDataDir();
85 87
86 // Gets the browser's UI locale. 88 // Gets the browser's UI locale.
87 const std::string& GetUILocale(); 89 const std::string& GetUILocale();
88 90
89 // Returns the plugin process host corresponding to the plugin process that 91 // Returns the plugin process host corresponding to the plugin process that
90 // has been started by this service. Returns NULL if no process has been 92 // has been started by this service. Returns NULL if no process has been
91 // started. 93 // started.
92 PluginProcessHost* FindPluginProcess(const FilePath& plugin_path); 94 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
95 PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path);
93 96
94 // Returns the plugin process host corresponding to the plugin process that 97 // Returns the plugin process host corresponding to the plugin process that
95 // has been started by this service. This will start a process to host the 98 // has been started by this service. This will start a process to host the
96 // 'plugin_path' if needed. If the process fails to start, the return value 99 // 'plugin_path' if needed. If the process fails to start, the return value
97 // is NULL. Must be called on the IO thread. 100 // is NULL. Must be called on the IO thread.
98 PluginProcessHost* FindOrStartPluginProcess(const FilePath& plugin_path); 101 PluginProcessHost* FindOrStartNpapiPluginProcess(
102 const FilePath& plugin_path);
103 PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
104 const FilePath& plugin_path);
99 105
100 // Opens a channel to a plugin process for the given mime type, starting 106 // Opens a channel to a plugin process for the given mime type, starting
101 // a new plugin process if necessary. This must be called on the IO thread 107 // a new plugin process if necessary. This must be called on the IO thread
102 // or else a deadlock can occur. 108 // or else a deadlock can occur.
103 void OpenChannelToPlugin(int render_process_id, 109 void OpenChannelToNpapiPlugin(int render_process_id,
104 int render_view_id, 110 int render_view_id,
105 const GURL& url, 111 const GURL& url,
106 const std::string& mime_type, 112 const std::string& mime_type,
107 PluginProcessHost::Client* client); 113 PluginProcessHost::Client* client);
114 void OpenChannelToPpapiPlugin(const FilePath& path,
115 PpapiPluginProcessHost::Client* client);
108 116
109 // Gets the first allowed plugin in the list of plugins that matches 117 // Gets the first allowed plugin in the list of plugins that matches
110 // the given url and mime type. Must be called on the FILE thread. 118 // the given url and mime type. Must be called on the FILE thread.
111 bool GetFirstAllowedPluginInfo(int render_process_id, 119 bool GetFirstAllowedPluginInfo(int render_process_id,
112 int render_view_id, 120 int render_view_id,
113 const GURL& url, 121 const GURL& url,
114 const std::string& mime_type, 122 const std::string& mime_type,
115 webkit::npapi::WebPluginInfo* info, 123 webkit::npapi::WebPluginInfo* info,
116 std::string* actual_mime_type); 124 std::string* actual_mime_type);
117 125
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 PluginProcessHost::Client* client); 171 PluginProcessHost::Client* client);
164 172
165 #if defined(OS_LINUX) 173 #if defined(OS_LINUX)
166 // Registers a new FilePathWatcher for a given path. 174 // Registers a new FilePathWatcher for a given path.
167 static void RegisterFilePathWatcher( 175 static void RegisterFilePathWatcher(
168 FilePathWatcher* watcher, 176 FilePathWatcher* watcher,
169 const FilePath& path, 177 const FilePath& path,
170 FilePathWatcher::Delegate* delegate); 178 FilePathWatcher::Delegate* delegate);
171 #endif 179 #endif
172 180
173 // mapping between plugin path and PluginProcessHost
174 typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap;
175 PluginMap plugin_hosts_;
176
177 // The main thread's message loop. 181 // The main thread's message loop.
178 MessageLoop* main_message_loop_; 182 MessageLoop* main_message_loop_;
179 183
180 // The IO thread's resource dispatcher host. 184 // The IO thread's resource dispatcher host.
181 ResourceDispatcherHost* resource_dispatcher_host_; 185 ResourceDispatcherHost* resource_dispatcher_host_;
182 186
183 // The data directory that Chrome plugins should use to store persistent data. 187 // The data directory that Chrome plugins should use to store persistent data.
184 FilePath chrome_plugin_data_dir_; 188 FilePath chrome_plugin_data_dir_;
185 189
186 // The browser's UI locale. 190 // The browser's UI locale.
(...skipping 18 matching lines...) Expand all
205 scoped_ptr<base::WaitableEvent> hklm_event_; 209 scoped_ptr<base::WaitableEvent> hklm_event_;
206 base::WaitableEventWatcher hkcu_watcher_; 210 base::WaitableEventWatcher hkcu_watcher_;
207 base::WaitableEventWatcher hklm_watcher_; 211 base::WaitableEventWatcher hklm_watcher_;
208 #endif 212 #endif
209 213
210 #if defined(OS_LINUX) 214 #if defined(OS_LINUX)
211 ScopedVector<FilePathWatcher> file_watchers_; 215 ScopedVector<FilePathWatcher> file_watchers_;
212 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; 216 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
213 #endif 217 #endif
214 218
219 std::vector<PepperPluginInfo> ppapi_plugins_;
220
215 // Set to true if chrome plugins are enabled. Defaults to true. 221 // Set to true if chrome plugins are enabled. Defaults to true.
216 static bool enable_chrome_plugins_; 222 static bool enable_chrome_plugins_;
217 223
218 std::vector<OverriddenPlugin> overridden_plugins_; 224 std::vector<OverriddenPlugin> overridden_plugins_;
219 base::Lock overridden_plugins_lock_; 225 base::Lock overridden_plugins_lock_;
220 226
221 DISALLOW_COPY_AND_ASSIGN(PluginService); 227 DISALLOW_COPY_AND_ASSIGN(PluginService);
222 }; 228 };
223 229
224 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); 230 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService);
225 231
226 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ 232 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugin_data_remover.cc ('k') | chrome/browser/plugin_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698