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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { | 820 void PluginServiceImpl::DisablePluginsDiscoveryForTesting() { |
821 PluginList::Singleton()->DisablePluginsDiscovery(); | 821 PluginList::Singleton()->DisablePluginsDiscovery(); |
822 } | 822 } |
823 | 823 |
824 #if defined(OS_MACOSX) | 824 #if defined(OS_MACOSX) |
825 void PluginServiceImpl::AppActivated() { | 825 void PluginServiceImpl::AppActivated() { |
826 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 826 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
827 base::Bind(&NotifyPluginsOfActivation)); | 827 base::Bind(&NotifyPluginsOfActivation)); |
828 } | 828 } |
829 #elif defined(OS_WIN) | |
830 | |
831 bool GetPluginPropertyFromWindow( | |
832 HWND window, const wchar_t* plugin_atom_property, | |
833 base::string16* plugin_property) { | |
834 ATOM plugin_atom = static_cast<ATOM>( | |
835 reinterpret_cast<uintptr_t>(GetPropW(window, plugin_atom_property))); | |
836 if (plugin_atom != 0) { | |
837 WCHAR plugin_property_local[MAX_PATH] = {0}; | |
838 GlobalGetAtomNameW(plugin_atom, | |
839 plugin_property_local, | |
840 ARRAYSIZE(plugin_property_local)); | |
841 *plugin_property = plugin_property_local; | |
842 return true; | |
843 } | |
844 return false; | |
845 } | |
846 | |
847 bool PluginServiceImpl::GetPluginInfoFromWindow( | |
848 HWND window, | |
849 base::string16* plugin_name, | |
850 base::string16* plugin_version) { | |
851 if (!IsPluginWindow(window)) | |
852 return false; | |
853 | |
854 | |
855 DWORD process_id = 0; | |
856 GetWindowThreadProcessId(window, &process_id); | |
857 WebPluginInfo info; | |
858 if (!PluginProcessHost::GetWebPluginInfoFromPluginPid(process_id, &info)) | |
859 return false; | |
860 | |
861 *plugin_name = info.name; | |
862 *plugin_version = info.version; | |
863 return true; | |
864 } | |
865 | |
866 bool PluginServiceImpl::IsPluginWindow(HWND window) { | |
867 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); | |
868 } | |
869 #endif | 829 #endif |
870 | 830 |
871 bool PluginServiceImpl::PpapiDevChannelSupported( | 831 bool PluginServiceImpl::PpapiDevChannelSupported( |
872 BrowserContext* browser_context, | 832 BrowserContext* browser_context, |
873 const GURL& document_url) { | 833 const GURL& document_url) { |
874 return GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( | 834 return GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( |
875 browser_context, document_url); | 835 browser_context, document_url); |
876 } | 836 } |
877 | 837 |
878 } // namespace content | 838 } // namespace content |
OLD | NEW |