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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { | 787 void PluginServiceImpl::UnregisterInternalPlugin(const base::FilePath& path) { |
788 PluginList::Singleton()->UnregisterInternalPlugin(path); | 788 PluginList::Singleton()->UnregisterInternalPlugin(path); |
789 } | 789 } |
790 | 790 |
791 void PluginServiceImpl::GetInternalPlugins( | 791 void PluginServiceImpl::GetInternalPlugins( |
792 std::vector<WebPluginInfo>* plugins) { | 792 std::vector<WebPluginInfo>* plugins) { |
793 PluginList::Singleton()->GetInternalPlugins(plugins); | 793 PluginList::Singleton()->GetInternalPlugins(plugins); |
794 } | 794 } |
795 | 795 |
796 bool PluginServiceImpl::NPAPIPluginsSupported() { | 796 bool PluginServiceImpl::NPAPIPluginsSupported() { |
797 static bool command_line_checked = false; | |
798 | |
799 if (!command_line_checked) { | |
800 #if defined(OS_WIN) || defined(OS_MACOSX) | 797 #if defined(OS_WIN) || defined(OS_MACOSX) |
801 const base::CommandLine* command_line = | 798 npapi_plugins_enabled_ = GetContentClient()->browser()->IsNPAPIEnabled(); |
802 base::CommandLine::ForCurrentProcess(); | |
803 npapi_plugins_enabled_ = | |
804 command_line->HasSwitch(switches::kEnableNpapiForTesting); | |
805 #if defined(OS_WIN) | 799 #if defined(OS_WIN) |
806 // NPAPI plugins don't play well with Win32k renderer lockdown. | 800 // NPAPI plugins don't play well with Win32k renderer lockdown. |
807 if (npapi_plugins_enabled_) | 801 if (npapi_plugins_enabled_) |
808 DisableWin32kRendererLockdown(); | 802 DisableWin32kRendererLockdown(); |
809 #endif | 803 #endif |
810 NPAPIPluginStatus status = | 804 NPAPIPluginStatus status = |
811 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; | 805 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; |
812 #else | 806 #else |
813 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; | 807 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; |
814 #endif | 808 #endif |
815 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, | 809 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, |
816 NPAPI_STATUS_ENUM_COUNT); | 810 NPAPI_STATUS_ENUM_COUNT); |
817 } | |
818 | 811 |
819 return npapi_plugins_enabled_; | 812 return npapi_plugins_enabled_; |
820 } | 813 } |
821 | 814 |
822 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 815 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
823 PluginList::Singleton()->DisablePluginsDiscovery(); | 816 PluginList::Singleton()->DisablePluginsDiscovery(); |
824 } | 817 } |
825 | 818 |
826 #if defined(OS_MACOSX) | 819 #if defined(OS_MACOSX) |
827 void PluginServiceImpl::AppActivated() { | 820 void PluginServiceImpl::AppActivated() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 859 } |
867 | 860 |
868 bool PluginServiceImpl::IsPluginWindow(HWND window) { | 861 bool PluginServiceImpl::IsPluginWindow(HWND window) { |
869 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); | 862 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); |
870 } | 863 } |
871 #endif | 864 #endif |
872 | 865 |
873 bool PluginServiceImpl::PpapiDevChannelSupported( | 866 bool PluginServiceImpl::PpapiDevChannelSupported( |
874 BrowserContext* browser_context, | 867 BrowserContext* browser_context, |
875 const GURL& document_url) { | 868 const GURL& document_url) { |
876 return content::GetContentClient()->browser()-> | 869 return GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( |
877 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); | 870 browser_context, document_url); |
878 } | 871 } |
879 | 872 |
880 } // namespace content | 873 } // namespace content |
OLD | NEW |