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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { | 782 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { |
783 PluginList::Singleton()->UnregisterInternalPlugin(path); | 783 PluginList::Singleton()->UnregisterInternalPlugin(path); |
784 } | 784 } |
785 | 785 |
786 void PluginServiceImpl::GetInternalPlugins( | 786 void PluginServiceImpl::GetInternalPlugins( |
787 std::vector<WebPluginInfo>* plugins) { | 787 std::vector<WebPluginInfo>* plugins) { |
788 PluginList::Singleton()->GetInternalPlugins(plugins); | 788 PluginList::Singleton()->GetInternalPlugins(plugins); |
789 } | 789 } |
790 | 790 |
791 bool PluginServiceImpl::NPAPIPluginsSupported() { | 791 bool PluginServiceImpl::NPAPIPluginsSupported() { |
| 792 if (npapi_plugins_enabled_) |
| 793 return true; |
| 794 |
792 static bool command_line_checked = false; | 795 static bool command_line_checked = false; |
793 | 796 |
794 if (!command_line_checked) { | 797 if (!command_line_checked) { |
795 #if defined(OS_WIN) || defined(OS_MACOSX) | 798 #if defined(OS_WIN) || defined(OS_MACOSX) |
796 const base::CommandLine* command_line = | 799 const base::CommandLine* command_line = |
797 base::CommandLine::ForCurrentProcess(); | 800 base::CommandLine::ForCurrentProcess(); |
798 npapi_plugins_enabled_ = command_line->HasSwitch(switches::kEnableNpapi); | 801 npapi_plugins_enabled_ = command_line->HasSwitch(switches::kEnableNpapi); |
799 NPAPIPluginStatus status = | 802 NPAPIPluginStatus status = |
800 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; | 803 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; |
801 #else | 804 #else |
802 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; | 805 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; |
803 #endif | 806 #endif |
804 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, | 807 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, |
805 NPAPI_STATUS_ENUM_COUNT); | 808 NPAPI_STATUS_ENUM_COUNT); |
806 } | 809 } |
807 | 810 |
808 return npapi_plugins_enabled_; | 811 return npapi_plugins_enabled_; |
809 } | 812 } |
810 | 813 |
811 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 814 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
812 PluginList::Singleton()->DisablePluginsDiscovery(); | 815 PluginList::Singleton()->DisablePluginsDiscovery(); |
813 } | 816 } |
814 | 817 |
815 void PluginServiceImpl::EnableNpapiPluginsForTesting() { | 818 void PluginServiceImpl::EnableNpapiPlugins() { |
816 npapi_plugins_enabled_ = true; | 819 npapi_plugins_enabled_ = true; |
| 820 RefreshPlugins(); |
| 821 BrowserThread::PostTask( |
| 822 BrowserThread::UI, FROM_HERE, |
| 823 base::Bind(&PluginService::PurgePluginListCache, |
| 824 static_cast<BrowserContext*>(NULL), false)); |
817 } | 825 } |
818 | 826 |
819 #if defined(OS_MACOSX) | 827 #if defined(OS_MACOSX) |
820 void PluginServiceImpl::AppActivated() { | 828 void PluginServiceImpl::AppActivated() { |
821 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 829 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
822 base::Bind(&NotifyPluginsOfActivation)); | 830 base::Bind(&NotifyPluginsOfActivation)); |
823 } | 831 } |
824 #elif defined(OS_WIN) | 832 #elif defined(OS_WIN) |
825 | 833 |
826 bool GetPluginPropertyFromWindow( | 834 bool GetPluginPropertyFromWindow( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 #endif | 872 #endif |
865 | 873 |
866 bool PluginServiceImpl::PpapiDevChannelSupported( | 874 bool PluginServiceImpl::PpapiDevChannelSupported( |
867 BrowserContext* browser_context, | 875 BrowserContext* browser_context, |
868 const GURL& document_url) { | 876 const GURL& document_url) { |
869 return content::GetContentClient()->browser()-> | 877 return content::GetContentClient()->browser()-> |
870 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); | 878 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); |
871 } | 879 } |
872 | 880 |
873 } // namespace content | 881 } // namespace content |
OLD | NEW |