diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 17:50:02 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 17:50:02 +0000 |
commit | d1589966f18d4c14334f8997fbb605891e2bea94 (patch) | |
tree | 48ed479e042c9d37081d6c8fbbb30b007687687b /webkit/glue | |
parent | 93918d8db3cef1d14c14286d26f7cb54052beda1 (diff) | |
download | chromium_src-d1589966f18d4c14334f8997fbb605891e2bea94.zip chromium_src-d1589966f18d4c14334f8997fbb605891e2bea94.tar.gz chromium_src-d1589966f18d4c14334f8997fbb605891e2bea94.tar.bz2 |
Spoof as Safari when running Silverlight 4 on the Mac
Silverlight 4 doesn't support Chrome, so Chrome doesn't end up on the right event path; spoofing as Safari fixes mouseover handling, and doesn't appear to regress anything.
BUG=46842
TEST=Mouseovers should work in Silverlight 4 on the Mac.
Review URL: http://codereview.chromium.org/2805019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 02e4af9..ba6ac76 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -561,18 +561,29 @@ const char* NPN_UserAgent(NPP id) { // Flash passes in a null id during the NP_initialize call. We need to // default to the Mozilla user agent if we don't have an NPP instance or // else Flash won't request windowless mode. + bool use_mozilla_user_agent = true; if (id) { scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); if (plugin.get() && !plugin->use_mozilla_user_agent()) - return webkit_glue::GetUserAgent(GURL()).c_str(); + use_mozilla_user_agent = false; } - return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061103 Firefox/2.0a1"; -#else - // TODO(port): For now we always use our real useragent on Mac and Linux. - // We might eventually need to spoof for some plugins. - return webkit_glue::GetUserAgent(GURL()).c_str(); + if (use_mozilla_user_agent) + return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061103 Firefox/2.0a1"; +#elif defined(OS_MACOSX) + // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (plugin.get()) { + WebPluginInfo plugin_info = plugin->plugin_lib()->plugin_info(); + if (plugin_info.name == L"Silverlight Plug-In" && + StartsWith(plugin_info.version, L"4.", false)) { + return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " + "AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16"; + } + } #endif + + return webkit_glue::GetUserAgent(GURL()).c_str(); } void NPN_Status(NPP id, const char* message) { |