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 #include "content/browser/plugin_service.h" | 5 #include "content/browser/plugin_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/browser/utility_process_host.h" | 25 #include "content/browser/utility_process_host.h" |
26 #include "content/common/pepper_plugin_registry.h" | 26 #include "content/common/pepper_plugin_registry.h" |
27 #include "content/common/plugin_messages.h" | 27 #include "content/common/plugin_messages.h" |
28 #include "content/common/utility_messages.h" | 28 #include "content/common/utility_messages.h" |
29 #include "content/common/view_messages.h" | 29 #include "content/common/view_messages.h" |
30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/process_type.h" |
35 #include "webkit/plugins/npapi/plugin_constants_win.h" | 36 #include "webkit/plugins/npapi/plugin_constants_win.h" |
36 #include "webkit/plugins/npapi/plugin_group.h" | 37 #include "webkit/plugins/npapi/plugin_group.h" |
37 #include "webkit/plugins/npapi/plugin_list.h" | 38 #include "webkit/plugins/npapi/plugin_list.h" |
38 #include "webkit/plugins/webplugininfo.h" | 39 #include "webkit/plugins/webplugininfo.h" |
39 | 40 |
40 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) | 41 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) |
41 using ::base::files::FilePathWatcher; | 42 using ::base::files::FilePathWatcher; |
42 #endif | 43 #endif |
43 | 44 |
44 using content::BrowserThread; | 45 using content::BrowserThread; |
(...skipping 28 matching lines...) Expand all Loading... |
73 CHECK(false) << "Plugin loading should happen out-of-process."; | 74 CHECK(false) << "Plugin loading should happen out-of-process."; |
74 #endif | 75 #endif |
75 } | 76 } |
76 | 77 |
77 } // namespace | 78 } // namespace |
78 | 79 |
79 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
80 static void NotifyPluginsOfActivation() { | 81 static void NotifyPluginsOfActivation() { |
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
82 | 83 |
83 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); | 84 for (BrowserChildProcessHost::Iterator iter( |
| 85 content::PROCESS_TYPE_PLUGIN); |
84 !iter.Done(); ++iter) { | 86 !iter.Done(); ++iter) { |
85 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); | 87 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); |
86 plugin->OnAppActivation(); | 88 plugin->OnAppActivation(); |
87 } | 89 } |
88 } | 90 } |
89 #elif defined(OS_POSIX) && !defined(OS_OPENBSD) | 91 #elif defined(OS_POSIX) && !defined(OS_OPENBSD) |
90 // Delegate class for monitoring directories. | 92 // Delegate class for monitoring directories. |
91 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { | 93 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { |
92 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE { | 94 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE { |
93 VLOG(1) << "Watched path changed: " << path.value(); | 95 VLOG(1) << "Watched path changed: " << path.value(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 216 } |
215 | 217 |
216 const std::string& PluginService::GetUILocale() { | 218 const std::string& PluginService::GetUILocale() { |
217 return ui_locale_; | 219 return ui_locale_; |
218 } | 220 } |
219 | 221 |
220 PluginProcessHost* PluginService::FindNpapiPluginProcess( | 222 PluginProcessHost* PluginService::FindNpapiPluginProcess( |
221 const FilePath& plugin_path) { | 223 const FilePath& plugin_path) { |
222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
223 | 225 |
224 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); | 226 for (BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_PLUGIN); |
225 !iter.Done(); ++iter) { | 227 !iter.Done(); ++iter) { |
226 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); | 228 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); |
227 if (plugin->info().path == plugin_path) | 229 if (plugin->info().path == plugin_path) |
228 return plugin; | 230 return plugin; |
229 } | 231 } |
230 | 232 |
231 return NULL; | 233 return NULL; |
232 } | 234 } |
233 | 235 |
234 PpapiPluginProcessHost* PluginService::FindPpapiPluginProcess( | 236 PpapiPluginProcessHost* PluginService::FindPpapiPluginProcess( |
235 const FilePath& plugin_path) { | 237 const FilePath& plugin_path) { |
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
237 | 239 |
238 for (BrowserChildProcessHost::Iterator iter( | 240 for (BrowserChildProcessHost::Iterator iter( |
239 ChildProcessInfo::PPAPI_PLUGIN_PROCESS); | 241 content::PROCESS_TYPE_PPAPI_PLUGIN); |
240 !iter.Done(); ++iter) { | 242 !iter.Done(); ++iter) { |
241 PpapiPluginProcessHost* plugin = | 243 PpapiPluginProcessHost* plugin = |
242 static_cast<PpapiPluginProcessHost*>(*iter); | 244 static_cast<PpapiPluginProcessHost*>(*iter); |
243 if (plugin->plugin_path() == plugin_path) | 245 if (plugin->plugin_path() == plugin_path) |
244 return plugin; | 246 return plugin; |
245 } | 247 } |
246 | 248 |
247 return NULL; | 249 return NULL; |
248 } | 250 } |
249 | 251 |
250 PpapiPluginProcessHost* PluginService::FindPpapiBrokerProcess( | 252 PpapiPluginProcessHost* PluginService::FindPpapiBrokerProcess( |
251 const FilePath& broker_path) { | 253 const FilePath& broker_path) { |
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
253 | 255 |
254 for (BrowserChildProcessHost::Iterator iter( | 256 for (BrowserChildProcessHost::Iterator iter( |
255 ChildProcessInfo::PPAPI_BROKER_PROCESS); | 257 content::PROCESS_TYPE_PPAPI_BROKER); |
256 !iter.Done(); ++iter) { | 258 !iter.Done(); ++iter) { |
257 PpapiPluginProcessHost* broker = | 259 PpapiPluginProcessHost* broker = |
258 static_cast<PpapiPluginProcessHost*>(*iter); | 260 static_cast<PpapiPluginProcessHost*>(*iter); |
259 if (broker->plugin_path() == broker_path) | 261 if (broker->plugin_path() == broker_path) |
260 return broker; | 262 return broker; |
261 } | 263 } |
262 | 264 |
263 return NULL; | 265 return NULL; |
264 } | 266 } |
265 | 267 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 plugin_list_ = plugin_list; | 652 plugin_list_ = plugin_list; |
651 } | 653 } |
652 | 654 |
653 void PluginService::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { | 655 void PluginService::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { |
654 plugin_list()->RegisterInternalPlugin(info); | 656 plugin_list()->RegisterInternalPlugin(info); |
655 } | 657 } |
656 | 658 |
657 string16 PluginService::GetPluginGroupName(const std::string& plugin_name) { | 659 string16 PluginService::GetPluginGroupName(const std::string& plugin_name) { |
658 return plugin_list()->GetPluginGroupName(plugin_name); | 660 return plugin_list()->GetPluginGroupName(plugin_name); |
659 } | 661 } |
OLD | NEW |