summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 19:58:30 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 19:58:30 +0000
commit5b26f658eb6f9d08c3cc1695604ae573b5831782 (patch)
tree1ce8f1ef7db7c70199eb051add45a1f4f56c3749 /content/renderer
parent40a7a10ec7aa328181e1257009e688fc1df40636 (diff)
downloadchromium_src-5b26f658eb6f9d08c3cc1695604ae573b5831782.zip
chromium_src-5b26f658eb6f9d08c3cc1695604ae573b5831782.tar.gz
chromium_src-5b26f658eb6f9d08c3cc1695604ae573b5831782.tar.bz2
Mac Plugins: Clean up the Flash wmode hack logic
Update to handle the upcoming Flash 10.3, since testing shows that the 10.3rc has fixed this handling. Also remove logic for Flash 9 and 10.0 since they are too old to be worth having special logic for. BUG=None TEST=Flash should continue to work, especially windowed mode Flash on 10.5 Review URL: http://codereview.chromium.org/6903010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc59
1 files changed, 34 insertions, 25 deletions
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 0667ef4..91faa71 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -20,6 +20,7 @@
#include "base/string_util.h"
#include "base/sys_info.h"
#include "base/utf_string_conversions.h"
+#include "base/version.h"
#include "content/common/child_process.h"
#include "content/common/plugin_messages.h"
#include "content/common/view_messages.h"
@@ -44,6 +45,7 @@
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
+#include "webkit/plugins/npapi/plugin_group.h"
#include "webkit/plugins/npapi/webplugin.h"
#include "webkit/plugins/sad_plugin.h"
#include "webkit/glue/webkit_glue.h"
@@ -269,6 +271,29 @@ static bool SilverlightColorIsTransparent(const std::string& color) {
return false;
}
+#if defined(OS_MACOSX)
+// Returns true if the OS is 10.5 (Leopard).
+static bool OSIsLeopard() {
+ int32 major, minor, bugfix;
+ base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
+ return major == 10 && minor == 5;
+}
+
+// Returns true if the given Flash version assumes QuickDraw support is present
+// instead of checking using the negotiation system.
+static bool FlashVersionAssumesQuickDrawSupport(const string16& version) {
+ scoped_ptr<Version> plugin_version(
+ webkit::npapi::PluginGroup::CreateVersionFromString(version));
+ if (plugin_version.get() && plugin_version->components().size() >= 2) {
+ uint16 major = plugin_version->components()[0];
+ uint16 minor = plugin_version->components()[1];
+ return major < 10 || (major == 10 && minor < 3);
+ }
+ // If parsing fails for some reason, assume the best.
+ return false;
+}
+#endif
+
bool WebPluginDelegateProxy::Initialize(
const GURL& url,
const std::vector<std::string>& arg_names,
@@ -335,31 +360,15 @@ bool WebPluginDelegateProxy::Initialize(
}
}
#if defined(OS_MACOSX)
- // Unless we have a real way to support accelerated (3D) drawing on Macs
- // (which for now at least means the Core Animation drawing model), ask
- // Flash to use windowless mode so that it use CoreGraphics instead of opening
- // OpenGL contexts overlaying the browser window (which requires a very
- // expensive extra copy for us).
- if (!transparent_ && mime_type_ == "application/x-shockwave-flash") {
- bool force_opaque_mode = false;
- if (StartsWith(info_.version, ASCIIToUTF16("10.0"), false) ||
- StartsWith(info_.version, ASCIIToUTF16("9."), false)) {
- // Older versions of Flash don't support CA (and they assume QuickDraw
- // support, so we can't rely on negotiation to do the right thing).
- force_opaque_mode = true;
- } else {
- // Flash 10.1 doesn't respect QuickDraw negotiation either, so we still
- // have to force opaque mode on 10.5 (where it doesn't use CA).
- int32 major, minor, bugfix;
- base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
- if (major < 10 || (major == 10 && minor < 6))
- force_opaque_mode = true;
- }
-
- if (force_opaque_mode) {
- params.arg_names.push_back("wmode");
- params.arg_values.push_back("opaque");
- }
+ // Older versions of Flash just assume QuickDraw support during negotiation,
+ // so force everything but transparent mode to use opaque mode on 10.5
+ // (where Flash doesn't use CA) to prevent QuickDraw from being used.
+ // TODO(stuartmorgan): Remove this code once the two latest major Flash
+ // releases negotiate correctly.
+ if (flash && !transparent_ && OSIsLeopard() &&
+ FlashVersionAssumesQuickDrawSupport(info_.version)) {
+ params.arg_names.push_back("wmode");
+ params.arg_values.push_back("opaque");
}
#endif
params.load_manually = load_manually;