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

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

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 | « content/browser/plugin_service_impl.h ('k') | content/public/browser/notification_types.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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "content/browser/plugin_loader_posix.h" 19 #include "content/browser/plugin_loader_posix.h"
20 #include "content/browser/ppapi_plugin_process_host.h" 20 #include "content/browser/ppapi_plugin_process_host.h"
21 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
22 #include "content/browser/renderer_host/render_view_host_impl.h" 22 #include "content/browser/renderer_host/render_view_host_impl.h"
23 #include "content/common/pepper_plugin_registry.h" 23 #include "content/common/pepper_plugin_registry.h"
24 #include "content/common/plugin_messages.h" 24 #include "content/common/plugin_messages.h"
25 #include "content/common/utility_messages.h" 25 #include "content/common/utility_messages.h"
26 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/content_browser_client.h" 28 #include "content/public/browser/content_browser_client.h"
29 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/plugin_service_filter.h" 29 #include "content/public/browser/plugin_service_filter.h"
32 #include "content/public/browser/resource_context.h" 30 #include "content/public/browser/resource_context.h"
33 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
34 #include "content/public/common/process_type.h" 32 #include "content/public/common/process_type.h"
35 #include "webkit/plugins/npapi/plugin_constants_win.h" 33 #include "webkit/plugins/npapi/plugin_constants_win.h"
36 #include "webkit/plugins/npapi/plugin_group.h" 34 #include "webkit/plugins/npapi/plugin_group.h"
37 #include "webkit/plugins/npapi/plugin_list.h" 35 #include "webkit/plugins/npapi/plugin_list.h"
38 #include "webkit/plugins/webplugininfo.h" 36 #include "webkit/plugins/webplugininfo.h"
39 37
40 #if defined(OS_POSIX) && !defined(OS_OPENBSD) 38 #if defined(OS_POSIX) && !defined(OS_OPENBSD)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 content::GetContentClient()->AddNPAPIPlugins(plugin_list_); 162 content::GetContentClient()->AddNPAPIPlugins(plugin_list_);
165 163
166 // Load any specified on the command line as well. 164 // Load any specified on the command line as well.
167 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 165 const CommandLine* command_line = CommandLine::ForCurrentProcess();
168 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); 166 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin);
169 if (!path.empty()) 167 if (!path.empty())
170 AddExtraPluginPath(path); 168 AddExtraPluginPath(path);
171 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); 169 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir);
172 if (!path.empty()) 170 if (!path.empty())
173 plugin_list_->AddExtraPluginDir(path); 171 plugin_list_->AddExtraPluginDir(path);
174
175
176 #if defined(OS_MACOSX)
177 // We need to know when the browser comes forward so we can bring modal plugin
178 // windows forward too.
179 registrar_.Add(this, content::NOTIFICATION_APP_ACTIVATED,
180 content::NotificationService::AllSources());
181 #endif
182 } 172 }
183 173
184 void PluginServiceImpl::StartWatchingPlugins() { 174 void PluginServiceImpl::StartWatchingPlugins() {
185 // Start watching for changes in the plugin list. This means watching 175 // Start watching for changes in the plugin list. This means watching
186 // for changes in the Windows registry keys and on both Windows and POSIX 176 // for changes in the Windows registry keys and on both Windows and POSIX
187 // watch for changes in the paths that are expected to contain plugins. 177 // watch for changes in the paths that are expected to contain plugins.
188 #if defined(OS_WIN) 178 #if defined(OS_WIN)
189 if (hkcu_key_.Create(HKEY_CURRENT_USER, 179 if (hkcu_key_.Create(HKEY_CURRENT_USER,
190 webkit::npapi::kRegistryMozillaPlugins, 180 webkit::npapi::kRegistryMozillaPlugins,
191 KEY_NOTIFY) == ERROR_SUCCESS) { 181 KEY_NOTIFY) == ERROR_SUCCESS) {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 568 }
579 569
580 plugin_list_->RefreshPlugins(); 570 plugin_list_->RefreshPlugins();
581 PurgePluginListCache(NULL, false); 571 PurgePluginListCache(NULL, false);
582 #else 572 #else
583 // This event should only get signaled on a Windows machine. 573 // This event should only get signaled on a Windows machine.
584 NOTREACHED(); 574 NOTREACHED();
585 #endif // defined(OS_WIN) 575 #endif // defined(OS_WIN)
586 } 576 }
587 577
588 void PluginServiceImpl::Observe(int type,
589 const content::NotificationSource& source,
590 const content::NotificationDetails& details) {
591 #if defined(OS_MACOSX)
592 if (type == content::NOTIFICATION_APP_ACTIVATED) {
593 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
594 base::Bind(&NotifyPluginsOfActivation));
595 return;
596 }
597 #endif
598 NOTREACHED();
599 }
600
601 void PluginServiceImpl::RegisterPepperPlugins() { 578 void PluginServiceImpl::RegisterPepperPlugins() {
602 // TODO(abarth): It seems like the PepperPluginRegistry should do this work. 579 // TODO(abarth): It seems like the PepperPluginRegistry should do this work.
603 PepperPluginRegistry::ComputeList(&ppapi_plugins_); 580 PepperPluginRegistry::ComputeList(&ppapi_plugins_);
604 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { 581 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) {
605 RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true); 582 RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true);
606 } 583 }
607 } 584 }
608 585
609 // There should generally be very few plugins so a brute-force search is fine. 586 // There should generally be very few plugins so a brute-force search is fine.
610 content::PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( 587 content::PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo(
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 696
720 void PluginServiceImpl::UnregisterInternalPlugin(const FilePath& path) { 697 void PluginServiceImpl::UnregisterInternalPlugin(const FilePath& path) {
721 plugin_list_->UnregisterInternalPlugin(path); 698 plugin_list_->UnregisterInternalPlugin(path);
722 } 699 }
723 700
724 void PluginServiceImpl::SetPluginListForTesting( 701 void PluginServiceImpl::SetPluginListForTesting(
725 webkit::npapi::PluginList* plugin_list) { 702 webkit::npapi::PluginList* plugin_list) {
726 plugin_list_ = plugin_list; 703 plugin_list_ = plugin_list;
727 } 704 }
728 705
706 #if defined(OS_MACOSX)
707 void PluginServiceImpl::AppActivated() {
708 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
709 base::Bind(&NotifyPluginsOfActivation));
710 }
711 #endif
712
729 void PluginServiceImpl::RegisterInternalPlugin( 713 void PluginServiceImpl::RegisterInternalPlugin(
730 const webkit::WebPluginInfo& info, 714 const webkit::WebPluginInfo& info,
731 bool add_at_beginning) { 715 bool add_at_beginning) {
732 plugin_list_->RegisterInternalPlugin(info, add_at_beginning); 716 plugin_list_->RegisterInternalPlugin(info, add_at_beginning);
733 } 717 }
734 718
735 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) { 719 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) {
736 return plugin_list_->GetPluginGroupName(plugin_name); 720 return plugin_list_->GetPluginGroupName(plugin_name);
737 } 721 }
738 722
739 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { 723 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() {
740 return plugin_list_; 724 return plugin_list_;
741 } 725 }
OLDNEW
« no previous file with comments | « content/browser/plugin_service_impl.h ('k') | content/public/browser/notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698