Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: webkit/plugins/npapi/plugin_host.cc

Issue 7144007: Improve and unify Mac OS X run-time version checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/resource/resource_bundle_mac.mm ('k') | webkit/plugins/npapi/webplugin_delegate_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/plugins/npapi/plugin_host.h" 5 #include "webkit/plugins/npapi/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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 12 matching lines...) Expand all
23 #include "webkit/plugins/npapi/default_plugin_shared.h" 23 #include "webkit/plugins/npapi/default_plugin_shared.h"
24 #include "webkit/plugins/npapi/npapi_extension_thunk.h" 24 #include "webkit/plugins/npapi/npapi_extension_thunk.h"
25 #include "webkit/plugins/npapi/plugin_instance.h" 25 #include "webkit/plugins/npapi/plugin_instance.h"
26 #include "webkit/plugins/npapi/plugin_lib.h" 26 #include "webkit/plugins/npapi/plugin_lib.h"
27 #include "webkit/plugins/npapi/plugin_list.h" 27 #include "webkit/plugins/npapi/plugin_list.h"
28 #include "webkit/plugins/npapi/plugin_stream_url.h" 28 #include "webkit/plugins/npapi/plugin_stream_url.h"
29 #include "webkit/plugins/npapi/webplugin_delegate.h" 29 #include "webkit/plugins/npapi/webplugin_delegate.h"
30 #include "webkit/plugins/npapi/webplugininfo.h" 30 #include "webkit/plugins/npapi/webplugininfo.h"
31 31
32 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
33 #include "base/sys_info.h" 33 #include "base/mac/mac_util.h"
34 #endif 34 #endif
35 35
36 using WebKit::WebBindings; 36 using WebKit::WebBindings;
37 37
38 // Declarations for stub implementations of deprecated functions, which are no 38 // Declarations for stub implementations of deprecated functions, which are no
39 // longer listed in npapi.h. 39 // longer listed in npapi.h.
40 extern "C" { 40 extern "C" {
41 void* NPN_GetJavaEnv(); 41 void* NPN_GetJavaEnv();
42 void* NPN_GetJavaPeer(NPP); 42 void* NPN_GetJavaPeer(NPP);
43 } 43 }
44 44
45 namespace webkit { 45 namespace webkit {
46 namespace npapi { 46 namespace npapi {
47 47
48 // Finds a PluginInstance from an NPP. 48 // Finds a PluginInstance from an NPP.
49 // The caller must take a reference if needed. 49 // The caller must take a reference if needed.
50 static PluginInstance* FindInstance(NPP id) { 50 static PluginInstance* FindInstance(NPP id) {
51 if (id == NULL) { 51 if (id == NULL) {
52 return NULL; 52 return NULL;
53 } 53 }
54 return reinterpret_cast<PluginInstance*>(id->ndata); 54 return reinterpret_cast<PluginInstance*>(id->ndata);
55 } 55 }
56 56
57 #if defined(OS_MACOSX) 57 #if defined(OS_MACOSX)
58 // Returns true if the OS supports shared accelerated surfaces via IOSurface. 58 // Returns true if the OS supports shared accelerated surfaces via IOSurface.
59 // This is true on Snow Leopard and higher. 59 // This is true on Snow Leopard and higher.
60 static bool SupportsSharingAcceleratedSurfaces() { 60 static bool SupportsSharingAcceleratedSurfaces() {
61 int32 major, minor, bugfix; 61 if (base::mac::IsOSLeopardOrEarlier())
62 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
63 bool isSnowLeopardOrLater = major > 10 || (major == 10 && minor > 5);
64 if (!isSnowLeopardOrLater)
65 return false; 62 return false;
66 // We also need to be running with desktop GL and not the software 63 // We also need to be running with desktop GL and not the software
67 // OSMesa renderer in order to share accelerated surfaces between 64 // OSMesa renderer in order to share accelerated surfaces between
68 // processes. 65 // processes.
69 gfx::GLImplementation implementation = gfx::GetGLImplementation(); 66 gfx::GLImplementation implementation = gfx::GetGLImplementation();
70 if (implementation == gfx::kGLImplementationNone) { 67 if (implementation == gfx::kGLImplementationNone) {
71 // Not initialized yet. 68 // Not initialized yet.
72 if (!gfx::GLSurface::InitializeOneOff()) { 69 if (!gfx::GLSurface::InitializeOneOff()) {
73 return false; 70 return false;
74 } 71 }
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // support it. 861 // support it.
865 NPBool* supports_model = reinterpret_cast<NPBool*>(value); 862 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
866 *supports_model = false; 863 *supports_model = false;
867 rv = NPERR_NO_ERROR; 864 rv = NPERR_NO_ERROR;
868 break; 865 break;
869 } 866 }
870 case NPNVsupportsUpdatedCocoaTextInputBool: { 867 case NPNVsupportsUpdatedCocoaTextInputBool: {
871 // We support the clarifications to the Cocoa IME event spec, but since 868 // We support the clarifications to the Cocoa IME event spec, but since
872 // IME currently only works on 10.6, only answer true there. 869 // IME currently only works on 10.6, only answer true there.
873 NPBool* supports_update = reinterpret_cast<NPBool*>(value); 870 NPBool* supports_update = reinterpret_cast<NPBool*>(value);
874 int32 major, minor, bugfix; 871 *supports_update = base::mac::IsOSSnowLeopardOrLater();
875 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
876 *supports_update = major > 10 || (major == 10 && minor > 5);
877 rv = NPERR_NO_ERROR; 872 rv = NPERR_NO_ERROR;
878 break; 873 break;
879 } 874 }
880 #endif // OS_MACOSX 875 #endif // OS_MACOSX
881 case NPNVPepperExtensions: 876 case NPNVPepperExtensions:
882 // Available for any plugin that attempts to get it. 877 // Available for any plugin that attempts to get it.
883 // If the plugin is not started in a Pepper implementation, it 878 // If the plugin is not started in a Pepper implementation, it
884 // will likely fail when it tries to use any of the functions 879 // will likely fail when it tries to use any of the functions
885 // attached to the extension vector. 880 // attached to the extension vector.
886 rv = webkit::npapi::GetPepperExtensionsFunctions(value); 881 rv = webkit::npapi::GetPepperExtensionsFunctions(value);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 } 1158 }
1164 1159
1165 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 1160 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
1166 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); 1161 scoped_refptr<PluginInstance> plugin(FindInstance(instance));
1167 if (plugin.get()) { 1162 if (plugin.get()) {
1168 plugin->URLRedirectResponse(!!allow, notify_data); 1163 plugin->URLRedirectResponse(!!allow, notify_data);
1169 } 1164 }
1170 } 1165 }
1171 1166
1172 } // extern "C" 1167 } // extern "C"
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle_mac.mm ('k') | webkit/plugins/npapi/webplugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698