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