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

Side by Side Diff: content/renderer/webplugin_delegate_proxy.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 | « content/renderer/renderer_main.cc ('k') | media/audio/mac/audio_manager_mac.cc » ('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 "content/renderer/webplugin_delegate_proxy.h" 5 #include "content/renderer/webplugin_delegate_proxy.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
11 #include <algorithm> 11 #include <algorithm>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/string_split.h" 19 #include "base/string_split.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/sys_info.h"
22 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
23 #include "base/version.h" 22 #include "base/version.h"
24 #include "content/common/child_process.h" 23 #include "content/common/child_process.h"
25 #include "content/common/plugin_messages.h" 24 #include "content/common/plugin_messages.h"
26 #include "content/common/view_messages.h" 25 #include "content/common/view_messages.h"
27 #include "content/plugin/npobject_proxy.h" 26 #include "content/plugin/npobject_proxy.h"
28 #include "content/plugin/npobject_stub.h" 27 #include "content/plugin/npobject_stub.h"
29 #include "content/plugin/npobject_util.h" 28 #include "content/plugin/npobject_util.h"
30 #include "content/renderer/gpu/command_buffer_proxy.h" 29 #include "content/renderer/gpu/command_buffer_proxy.h"
31 #include "content/renderer/content_renderer_client.h" 30 #include "content/renderer/content_renderer_client.h"
(...skipping 15 matching lines...) Expand all
47 #include "ui/gfx/size.h" 46 #include "ui/gfx/size.h"
48 #include "webkit/plugins/npapi/plugin_group.h" 47 #include "webkit/plugins/npapi/plugin_group.h"
49 #include "webkit/plugins/npapi/webplugin.h" 48 #include "webkit/plugins/npapi/webplugin.h"
50 #include "webkit/plugins/sad_plugin.h" 49 #include "webkit/plugins/sad_plugin.h"
51 #include "webkit/glue/webkit_glue.h" 50 #include "webkit/glue/webkit_glue.h"
52 51
53 #if defined(OS_POSIX) 52 #if defined(OS_POSIX)
54 #include "ipc/ipc_channel_posix.h" 53 #include "ipc/ipc_channel_posix.h"
55 #endif 54 #endif
56 55
56 #if defined(OS_MACOSX)
57 #include "base/mac/mac_util.h"
58 #endif
59
57 using WebKit::WebBindings; 60 using WebKit::WebBindings;
58 using WebKit::WebCursorInfo; 61 using WebKit::WebCursorInfo;
59 using WebKit::WebDragData; 62 using WebKit::WebDragData;
60 using WebKit::WebInputEvent; 63 using WebKit::WebInputEvent;
61 using WebKit::WebString; 64 using WebKit::WebString;
62 using WebKit::WebView; 65 using WebKit::WebView;
63 66
64 // Proxy for WebPluginResourceClient. The object owns itself after creation, 67 // Proxy for WebPluginResourceClient. The object owns itself after creation,
65 // deleting itself after its callback has been called. 68 // deleting itself after its callback has been called.
66 class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient { 69 class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (components.size() == 4 && !StartsWithASCII(components[0], "1", false)) 268 if (components.size() == 4 && !StartsWithASCII(components[0], "1", false))
266 return true; 269 return true;
267 } else if (LowerCaseEqualsASCII(color, "transparent")) { 270 } else if (LowerCaseEqualsASCII(color, "transparent")) {
268 return true; 271 return true;
269 } 272 }
270 // Anything else is a named, opaque color or an RGB form with no alpha. 273 // Anything else is a named, opaque color or an RGB form with no alpha.
271 return false; 274 return false;
272 } 275 }
273 276
274 #if defined(OS_MACOSX) 277 #if defined(OS_MACOSX)
275 // Returns true if the OS is 10.5 (Leopard).
276 static bool OSIsLeopard() {
277 int32 major, minor, bugfix;
278 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
279 return major == 10 && minor == 5;
280 }
281
282 // Returns true if the given Flash version assumes QuickDraw support is present 278 // Returns true if the given Flash version assumes QuickDraw support is present
283 // instead of checking using the negotiation system. 279 // instead of checking using the negotiation system.
284 static bool FlashVersionAssumesQuickDrawSupport(const string16& version) { 280 static bool FlashVersionAssumesQuickDrawSupport(const string16& version) {
285 scoped_ptr<Version> plugin_version( 281 scoped_ptr<Version> plugin_version(
286 webkit::npapi::PluginGroup::CreateVersionFromString(version)); 282 webkit::npapi::PluginGroup::CreateVersionFromString(version));
287 if (plugin_version.get() && plugin_version->components().size() >= 2) { 283 if (plugin_version.get() && plugin_version->components().size() >= 2) {
288 uint16 major = plugin_version->components()[0]; 284 uint16 major = plugin_version->components()[0];
289 uint16 minor = plugin_version->components()[1]; 285 uint16 minor = plugin_version->components()[1];
290 return major < 10 || (major == 10 && minor < 3); 286 return major < 10 || (major == 10 && minor < 3);
291 } 287 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 SilverlightColorIsTransparent(arg_values[i]))) { 354 SilverlightColorIsTransparent(arg_values[i]))) {
359 transparent_ = true; 355 transparent_ = true;
360 } 356 }
361 } 357 }
362 #if defined(OS_MACOSX) 358 #if defined(OS_MACOSX)
363 // Older versions of Flash just assume QuickDraw support during negotiation, 359 // Older versions of Flash just assume QuickDraw support during negotiation,
364 // so force everything but transparent mode to use opaque mode on 10.5 360 // so force everything but transparent mode to use opaque mode on 10.5
365 // (where Flash doesn't use CA) to prevent QuickDraw from being used. 361 // (where Flash doesn't use CA) to prevent QuickDraw from being used.
366 // TODO(stuartmorgan): Remove this code once the two latest major Flash 362 // TODO(stuartmorgan): Remove this code once the two latest major Flash
367 // releases negotiate correctly. 363 // releases negotiate correctly.
368 if (flash && !transparent_ && OSIsLeopard() && 364 if (flash && !transparent_ && base::mac::IsOSLeopardOrEarlier() &&
369 FlashVersionAssumesQuickDrawSupport(info_.version)) { 365 FlashVersionAssumesQuickDrawSupport(info_.version)) {
370 params.arg_names.push_back("wmode"); 366 params.arg_names.push_back("wmode");
371 params.arg_values.push_back("opaque"); 367 params.arg_values.push_back("opaque");
372 } 368 }
373 #endif 369 #endif
374 params.load_manually = load_manually; 370 params.load_manually = load_manually;
375 371
376 plugin_ = plugin; 372 plugin_ = plugin;
377 373
378 result = false; 374 result = false;
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 } 1361 }
1366 #endif 1362 #endif
1367 1363
1368 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, 1364 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow,
1369 int resource_id) { 1365 int resource_id) {
1370 if (!plugin_) 1366 if (!plugin_)
1371 return; 1367 return;
1372 1368
1373 plugin_->URLRedirectResponse(allow, resource_id); 1369 plugin_->URLRedirectResponse(allow, resource_id);
1374 } 1370 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | media/audio/mac/audio_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698