summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/plugin_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/plugins/plugin_host.cc')
-rw-r--r--webkit/glue/plugins/plugin_host.cc23
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) {