OLD | NEW |
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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { | 788 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { |
789 PluginList::Singleton()->UnregisterInternalPlugin(path); | 789 PluginList::Singleton()->UnregisterInternalPlugin(path); |
790 } | 790 } |
791 | 791 |
792 void PluginServiceImpl::GetInternalPlugins( | 792 void PluginServiceImpl::GetInternalPlugins( |
793 std::vector<WebPluginInfo>* plugins) { | 793 std::vector<WebPluginInfo>* plugins) { |
794 PluginList::Singleton()->GetInternalPlugins(plugins); | 794 PluginList::Singleton()->GetInternalPlugins(plugins); |
795 } | 795 } |
796 | 796 |
797 bool PluginServiceImpl::NPAPIPluginsSupported() { | 797 bool PluginServiceImpl::NPAPIPluginsSupported() { |
798 if (npapi_plugins_enabled_) | |
799 return true; | |
800 | |
801 static bool command_line_checked = false; | 798 static bool command_line_checked = false; |
802 | 799 |
803 if (!command_line_checked) { | 800 if (!command_line_checked) { |
804 #if defined(OS_WIN) || defined(OS_MACOSX) | 801 #if defined(OS_WIN) || defined(OS_MACOSX) |
805 const base::CommandLine* command_line = | 802 const base::CommandLine* command_line = |
806 base::CommandLine::ForCurrentProcess(); | 803 base::CommandLine::ForCurrentProcess(); |
807 npapi_plugins_enabled_ = command_line->HasSwitch(switches::kEnableNpapi); | 804 npapi_plugins_enabled_ = |
| 805 command_line->HasSwitch(switches::kEnableNpapiForTesting); |
808 NPAPIPluginStatus status = | 806 NPAPIPluginStatus status = |
809 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; | 807 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; |
810 #else | 808 #else |
811 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; | 809 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; |
812 #endif | 810 #endif |
813 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, | 811 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, |
814 NPAPI_STATUS_ENUM_COUNT); | 812 NPAPI_STATUS_ENUM_COUNT); |
815 } | 813 } |
816 | 814 |
817 return npapi_plugins_enabled_; | 815 return npapi_plugins_enabled_; |
818 } | 816 } |
819 | 817 |
820 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 818 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
821 PluginList::Singleton()->DisablePluginsDiscovery(); | 819 PluginList::Singleton()->DisablePluginsDiscovery(); |
822 } | 820 } |
823 | 821 |
824 void PluginServiceImpl::EnableNpapiPlugins() { | |
825 #if defined(OS_WIN) | |
826 DisableWin32kRendererLockdown(); | |
827 #endif | |
828 npapi_plugins_enabled_ = true; | |
829 RefreshPlugins(); | |
830 BrowserThread::PostTask( | |
831 BrowserThread::UI, FROM_HERE, | |
832 base::Bind(&PluginService::PurgePluginListCache, | |
833 static_cast<BrowserContext*>(NULL), false)); | |
834 } | |
835 | |
836 #if defined(OS_MACOSX) | 822 #if defined(OS_MACOSX) |
837 void PluginServiceImpl::AppActivated() { | 823 void PluginServiceImpl::AppActivated() { |
838 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 824 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
839 base::Bind(&NotifyPluginsOfActivation)); | 825 base::Bind(&NotifyPluginsOfActivation)); |
840 } | 826 } |
841 #elif defined(OS_WIN) | 827 #elif defined(OS_WIN) |
842 | 828 |
843 bool GetPluginPropertyFromWindow( | 829 bool GetPluginPropertyFromWindow( |
844 HWND window, const wchar_t* plugin_atom_property, | 830 HWND window, const wchar_t* plugin_atom_property, |
845 base::string16* plugin_property) { | 831 base::string16* plugin_property) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 #endif | 867 #endif |
882 | 868 |
883 bool PluginServiceImpl::PpapiDevChannelSupported( | 869 bool PluginServiceImpl::PpapiDevChannelSupported( |
884 BrowserContext* browser_context, | 870 BrowserContext* browser_context, |
885 const GURL& document_url) { | 871 const GURL& document_url) { |
886 return content::GetContentClient()->browser()-> | 872 return content::GetContentClient()->browser()-> |
887 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); | 873 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); |
888 } | 874 } |
889 | 875 |
890 } // namespace content | 876 } // namespace content |
OLD | NEW |