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

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

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 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 | « content/browser/plugin_process_host_mac.cc ('k') | content/browser/ppapi_plugin_process_host.h » ('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 #include "content/browser/plugin_service_impl.h" 5 #include "content/browser/plugin_service_impl.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 CHECK(false) << "Plugin loading should happen out-of-process."; 75 CHECK(false) << "Plugin loading should happen out-of-process.";
76 #endif 76 #endif
77 } 77 }
78 78
79 } // namespace 79 } // namespace
80 80
81 #if defined(OS_MACOSX) 81 #if defined(OS_MACOSX)
82 static void NotifyPluginsOfActivation() { 82 static void NotifyPluginsOfActivation() {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
84 84
85 for (BrowserChildProcessHost::Iterator iter( 85 for (PluginProcessHostIterator iter; !iter.Done(); ++iter)
86 content::PROCESS_TYPE_PLUGIN); 86 iter->OnAppActivation();
87 !iter.Done(); ++iter) {
88 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter);
89 plugin->OnAppActivation();
90 }
91 } 87 }
92 #endif 88 #endif
93 #if defined(OS_POSIX) && !defined(OS_OPENBSD) 89 #if defined(OS_POSIX) && !defined(OS_OPENBSD)
94 // Delegate class for monitoring directories. 90 // Delegate class for monitoring directories.
95 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { 91 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate {
96 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE { 92 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE {
97 VLOG(1) << "Watched path changed: " << path.value(); 93 VLOG(1) << "Watched path changed: " << path.value();
98 // Make the plugin list update itself 94 // Make the plugin list update itself
99 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 95 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
100 BrowserThread::PostTask( 96 BrowserThread::PostTask(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 BrowserThread::FILE, FROM_HERE, 220 BrowserThread::FILE, FROM_HERE,
225 base::Bind(&PluginServiceImpl::RegisterFilePathWatcher, watcher, 221 base::Bind(&PluginServiceImpl::RegisterFilePathWatcher, watcher,
226 plugin_dirs[i], file_watcher_delegate_)); 222 plugin_dirs[i], file_watcher_delegate_));
227 file_watchers_.push_back(watcher); 223 file_watchers_.push_back(watcher);
228 } 224 }
229 #endif 225 #endif
230 } 226 }
231 227
232 PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess( 228 PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess(
233 const FilePath& plugin_path) { 229 const FilePath& plugin_path) {
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 230 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) {
235 231 if (iter->info().path == plugin_path)
236 for (BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_PLUGIN); 232 return *iter;
237 !iter.Done(); ++iter) {
238 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter);
239 if (plugin->info().path == plugin_path)
240 return plugin;
241 } 233 }
242 234
243 return NULL; 235 return NULL;
244 } 236 }
245 237
246 PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess( 238 PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess(
247 const FilePath& plugin_path) { 239 const FilePath& plugin_path) {
248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 240 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
249 241 if (iter->plugin_path() == plugin_path)
250 for (BrowserChildProcessHost::Iterator iter( 242 return *iter;
251 content::PROCESS_TYPE_PPAPI_PLUGIN);
252 !iter.Done(); ++iter) {
253 PpapiPluginProcessHost* plugin =
254 static_cast<PpapiPluginProcessHost*>(*iter);
255 if (plugin->plugin_path() == plugin_path)
256 return plugin;
257 } 243 }
258 244
259 return NULL; 245 return NULL;
260 } 246 }
261 247
262 PpapiPluginProcessHost* PluginServiceImpl::FindPpapiBrokerProcess( 248 PpapiPluginProcessHost* PluginServiceImpl::FindPpapiBrokerProcess(
263 const FilePath& broker_path) { 249 const FilePath& broker_path) {
264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 250 for (PpapiBrokerProcessHostIterator iter; !iter.Done(); ++iter) {
265 251 if (iter->plugin_path() == broker_path)
266 for (BrowserChildProcessHost::Iterator iter( 252 return *iter;
267 content::PROCESS_TYPE_PPAPI_BROKER);
268 !iter.Done(); ++iter) {
269 PpapiPluginProcessHost* broker =
270 static_cast<PpapiPluginProcessHost*>(*iter);
271 if (broker->plugin_path() == broker_path)
272 return broker;
273 } 253 }
274 254
275 return NULL; 255 return NULL;
276 } 256 }
277 257
278 PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess( 258 PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess(
279 const FilePath& plugin_path) { 259 const FilePath& plugin_path) {
280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
281 261
282 PluginProcessHost* plugin_host = FindNpapiPluginProcess(plugin_path); 262 PluginProcessHost* plugin_host = FindNpapiPluginProcess(plugin_path);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 plugin_list_->RegisterInternalPlugin(info, add_at_beginning); 651 plugin_list_->RegisterInternalPlugin(info, add_at_beginning);
672 } 652 }
673 653
674 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) { 654 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) {
675 return plugin_list_->GetPluginGroupName(plugin_name); 655 return plugin_list_->GetPluginGroupName(plugin_name);
676 } 656 }
677 657
678 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { 658 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() {
679 return plugin_list_; 659 return plugin_list_;
680 } 660 }
OLDNEW
« no previous file with comments | « content/browser/plugin_process_host_mac.cc ('k') | content/browser/ppapi_plugin_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698