OLD | NEW |
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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
16 #include "third_party/npapi/bindings/npapi_extensions.h" | 16 #include "third_party/npapi/bindings/npapi_extensions.h" |
17 #include "third_party/npapi/bindings/npruntime.h" | 17 #include "third_party/npapi/bindings/npruntime.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
20 #include "ui/gfx/gl/gl_implementation.h" | 20 #include "ui/gfx/gl/gl_implementation.h" |
21 #include "ui/gfx/gl/gl_surface.h" | 21 #include "ui/gfx/gl/gl_surface.h" |
22 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
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/webplugininfo.h" |
31 | 31 |
32 #if defined(OS_MACOSX) | 32 #if defined(OS_MACOSX) |
33 #include "base/mac/mac_util.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" { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 if (use_mozilla_user_agent) | 595 if (use_mozilla_user_agent) |
596 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) " | 596 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) " |
597 "Gecko/20061103 Firefox/2.0a1"; | 597 "Gecko/20061103 Firefox/2.0a1"; |
598 #elif defined(OS_MACOSX) | 598 #elif defined(OS_MACOSX) |
599 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. | 599 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. |
600 scoped_refptr<PluginInstance> plugin; | 600 scoped_refptr<PluginInstance> plugin; |
601 if (id) | 601 if (id) |
602 plugin = FindInstance(id); | 602 plugin = FindInstance(id); |
603 if (plugin.get()) { | 603 if (plugin.get()) { |
604 webkit::npapi::WebPluginInfo plugin_info = | 604 webkit::WebPluginInfo plugin_info = |
605 plugin->plugin_lib()->plugin_info(); | 605 plugin->plugin_lib()->plugin_info(); |
606 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") && | 606 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") && |
607 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) { | 607 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) { |
608 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " | 608 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " |
609 "AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16"; | 609 "AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16"; |
610 } | 610 } |
611 } | 611 } |
612 #endif | 612 #endif |
613 | 613 |
614 return webkit_glue::GetUserAgent(GURL()).c_str(); | 614 return webkit_glue::GetUserAgent(GURL()).c_str(); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 } | 1158 } |
1159 | 1159 |
1160 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1160 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1161 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1161 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1162 if (plugin.get()) { | 1162 if (plugin.get()) { |
1163 plugin->URLRedirectResponse(!!allow, notify_data); | 1163 plugin->URLRedirectResponse(!!allow, notify_data); |
1164 } | 1164 } |
1165 } | 1165 } |
1166 | 1166 |
1167 } // extern "C" | 1167 } // extern "C" |
OLD | NEW |