| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "webkit/glue/plugins/plugin_host.h" | 5 #include "webkit/glue/plugins/plugin_host.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 return reinterpret_cast<NPAPI::PluginInstance*>(id->ndata); | 39 return reinterpret_cast<NPAPI::PluginInstance*>(id->ndata); |
| 40 } | 40 } |
| 41 | 41 |
| 42 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
| 43 // Returns true if the OS supports shared accelerated surfaces via IOSurface. | 43 // Returns true if the OS supports shared accelerated surfaces via IOSurface. |
| 44 // This is true on Snow Leopard and higher. | 44 // This is true on Snow Leopard and higher. |
| 45 static bool SupportsSharingAcceleratedSurfaces() { | 45 static bool SupportsSharingAcceleratedSurfaces() { |
| 46 int32 major, minor, bugfix; | 46 int32 major, minor, bugfix; |
| 47 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 47 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
| 48 #if PINK_USE_COREANIMATION | |
| 49 // TODO(pinkerton): enable this, http://crbug.com/32012 | |
| 50 return major > 10 || (major == 10 && minor > 5); | 48 return major > 10 || (major == 10 && minor > 5); |
| 51 #else | |
| 52 return false; | |
| 53 #endif | |
| 54 } | 49 } |
| 55 #endif | 50 #endif |
| 56 | 51 |
| 57 namespace NPAPI { | 52 namespace NPAPI { |
| 58 | 53 |
| 59 scoped_refptr<PluginHost> PluginHost::singleton_; | 54 scoped_refptr<PluginHost> PluginHost::singleton_; |
| 60 | 55 |
| 61 PluginHost::PluginHost() { | 56 PluginHost::PluginHost() { |
| 62 InitializeHostFuncs(); | 57 InitializeHostFuncs(); |
| 63 } | 58 } |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 case NPNVsupportsCocoaBool: { | 787 case NPNVsupportsCocoaBool: { |
| 793 // we do support these drawing and event models. | 788 // we do support these drawing and event models. |
| 794 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 789 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
| 795 *supports_model = TRUE; | 790 *supports_model = TRUE; |
| 796 rv = NPERR_NO_ERROR; | 791 rv = NPERR_NO_ERROR; |
| 797 break; | 792 break; |
| 798 } | 793 } |
| 799 case NPNVsupportsCoreAnimationBool: { | 794 case NPNVsupportsCoreAnimationBool: { |
| 800 // We only support the Core Animation model on 10.6 and higher | 795 // We only support the Core Animation model on 10.6 and higher |
| 801 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 796 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
| 802 *supports_model = SupportsSharingAcceleratedSurfaces() ? TRUE : FALSE; | 797 // Our Core Animation support currently doesn't handle QuickTime correctly |
| 798 // (see <http://crbug.com/38336>), so for now we don't allow QuickTime to |
| 799 // negotiate that model. |
| 800 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 801 if (plugin && |
| 802 plugin->plugin_lib()->plugin_info().name.find(L"QuickTime") != |
| 803 std::wstring::npos) |
| 804 *supports_model = FALSE; |
| 805 else |
| 806 *supports_model = SupportsSharingAcceleratedSurfaces() ? TRUE : FALSE; |
| 803 rv = NPERR_NO_ERROR; | 807 rv = NPERR_NO_ERROR; |
| 804 break; | 808 break; |
| 805 } | 809 } |
| 806 case NPNVsupportsOpenGLBool: { | 810 case NPNVsupportsOpenGLBool: { |
| 807 // This drawing model was never widely supported, and we don't plan to | 811 // This drawing model was never widely supported, and we don't plan to |
| 808 // support it. | 812 // support it. |
| 809 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 813 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
| 810 *supports_model = FALSE; | 814 *supports_model = FALSE; |
| 811 rv = NPERR_NO_ERROR; | 815 rv = NPERR_NO_ERROR; |
| 812 break; | 816 break; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 1079 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 1076 if (plugin.get()) { | 1080 if (plugin.get()) { |
| 1077 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, | 1081 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, |
| 1078 destX, destY, destSpace); | 1082 destX, destY, destSpace); |
| 1079 } | 1083 } |
| 1080 NOTREACHED(); | 1084 NOTREACHED(); |
| 1081 return FALSE; | 1085 return FALSE; |
| 1082 } | 1086 } |
| 1083 | 1087 |
| 1084 } // extern "C" | 1088 } // extern "C" |
| OLD | NEW |