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_ = |
802 base::CommandLine::ForCurrentProcess(); | 799 content::GetContentClient()->browser()->IsNPAPIEnabled(); |
jam
2015/07/20 16:36:22
nit: no content::
Will Harris
2015/07/20 16:54:50
Done, also below where I stole this from :)
| |
803 npapi_plugins_enabled_ = | |
804 command_line->HasSwitch(switches::kEnableNpapiForTesting); | |
805 #if defined(OS_WIN) | 800 #if defined(OS_WIN) |
806 // NPAPI plugins don't play well with Win32k renderer lockdown. | 801 // NPAPI plugins don't play well with Win32k renderer lockdown. |
807 if (npapi_plugins_enabled_) | 802 if (npapi_plugins_enabled_) |
808 DisableWin32kRendererLockdown(); | 803 DisableWin32kRendererLockdown(); |
809 #endif | 804 #endif |
810 NPAPIPluginStatus status = | 805 NPAPIPluginStatus status = |
811 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; | 806 npapi_plugins_enabled_ ? NPAPI_STATUS_ENABLED : NPAPI_STATUS_DISABLED; |
812 #else | 807 #else |
813 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; | 808 NPAPIPluginStatus status = NPAPI_STATUS_UNSUPPORTED; |
814 #endif | 809 #endif |
815 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, | 810 UMA_HISTOGRAM_ENUMERATION("Plugin.NPAPIStatus", status, |
816 NPAPI_STATUS_ENUM_COUNT); | 811 NPAPI_STATUS_ENUM_COUNT); |
817 } | |
818 | 812 |
819 return npapi_plugins_enabled_; | 813 return npapi_plugins_enabled_; |
820 } | 814 } |
821 | 815 |
822 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 816 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
823 PluginList::Singleton()->DisablePluginsDiscovery(); | 817 PluginList::Singleton()->DisablePluginsDiscovery(); |
824 } | 818 } |
825 | 819 |
826 #if defined(OS_MACOSX) | 820 #if defined(OS_MACOSX) |
827 void PluginServiceImpl::AppActivated() { | 821 void PluginServiceImpl::AppActivated() { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 #endif | 865 #endif |
872 | 866 |
873 bool PluginServiceImpl::PpapiDevChannelSupported( | 867 bool PluginServiceImpl::PpapiDevChannelSupported( |
874 BrowserContext* browser_context, | 868 BrowserContext* browser_context, |
875 const GURL& document_url) { | 869 const GURL& document_url) { |
876 return content::GetContentClient()->browser()-> | 870 return content::GetContentClient()->browser()-> |
877 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); | 871 IsPluginAllowedToUseDevChannelAPIs(browser_context, document_url); |
878 } | 872 } |
879 | 873 |
880 } // namespace content | 874 } // namespace content |
OLD | NEW |