OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/support/webkit_support.h" | 5 #include "webkit/support/webkit_support.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug_util.h" | 9 #include "base/debug_util.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/i18n/icu_util.h" | 12 #include "base/i18n/icu_util.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/sys_string_conversions.h" | 16 #include "base/sys_string_conversions.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/weak_ptr.h" | 18 #include "base/weak_ptr.h" |
19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
22 #include "webkit/appcache/web_application_cache_host_impl.h" | 22 #include "webkit/appcache/web_application_cache_host_impl.h" |
23 #include "webkit/glue/media/buffered_data_source.h" | 23 #include "webkit/glue/media/buffered_data_source.h" |
24 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" | 24 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" |
25 #include "webkit/glue/media/simple_data_source.h" | 25 #include "webkit/glue/media/simple_data_source.h" |
26 #include "webkit/glue/media/video_renderer_impl.h" | 26 #include "webkit/glue/media/video_renderer_impl.h" |
| 27 #include "webkit/glue/plugins/plugin_list.h" |
27 #include "webkit/glue/plugins/webplugin_impl.h" | 28 #include "webkit/glue/plugins/webplugin_impl.h" |
28 #include "webkit/glue/plugins/webplugin_page_delegate.h" | 29 #include "webkit/glue/plugins/webplugin_page_delegate.h" |
| 30 #include "webkit/glue/plugins/webplugininfo.h" |
29 #include "webkit/glue/webkitclient_impl.h" | 31 #include "webkit/glue/webkitclient_impl.h" |
30 #include "webkit/glue/webmediaplayer_impl.h" | 32 #include "webkit/glue/webmediaplayer_impl.h" |
31 #include "webkit/support/platform_support.h" | 33 #include "webkit/support/platform_support.h" |
32 #include "webkit/support/test_webplugin_page_delegate.h" | 34 #include "webkit/support/test_webplugin_page_delegate.h" |
33 #include "webkit/support/test_webkit_client.h" | 35 #include "webkit/support/test_webkit_client.h" |
34 #include "webkit/tools/test_shell/simple_database_system.h" | 36 #include "webkit/tools/test_shell/simple_database_system.h" |
35 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 37 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
36 | 38 |
37 using WebKit::WebFrame; | 39 using WebKit::WebFrame; |
38 using WebKit::WebMediaPlayerClient; | 40 using WebKit::WebMediaPlayerClient; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 scoped_ptr<MessageLoopForUI> main_message_loop_; | 77 scoped_ptr<MessageLoopForUI> main_message_loop_; |
76 scoped_ptr<TestWebKitClient> webkit_client_; | 78 scoped_ptr<TestWebKitClient> webkit_client_; |
77 }; | 79 }; |
78 | 80 |
79 class WebPluginImplWithPageDelegate | 81 class WebPluginImplWithPageDelegate |
80 : public webkit_support::TestWebPluginPageDelegate, | 82 : public webkit_support::TestWebPluginPageDelegate, |
81 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, | 83 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, |
82 public webkit_glue::WebPluginImpl { | 84 public webkit_glue::WebPluginImpl { |
83 public: | 85 public: |
84 WebPluginImplWithPageDelegate(WebFrame* frame, | 86 WebPluginImplWithPageDelegate(WebFrame* frame, |
85 const WebPluginParams& params) | 87 const WebPluginParams& params, |
| 88 const FilePath& path, |
| 89 const std::string& mime_type) |
86 : webkit_support::TestWebPluginPageDelegate(), | 90 : webkit_support::TestWebPluginPageDelegate(), |
87 webkit_glue::WebPluginImpl( | 91 webkit_glue::WebPluginImpl( |
88 frame, params, FilePath(), params.mimeType.utf8(), AsWeakPtr()) {} | 92 frame, params, path, mime_type, AsWeakPtr()) {} |
89 virtual ~WebPluginImplWithPageDelegate() {} | 93 virtual ~WebPluginImplWithPageDelegate() {} |
90 private: | 94 private: |
91 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); | 95 DISALLOW_COPY_AND_ASSIGN(WebPluginImplWithPageDelegate); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace | 98 } // namespace |
95 | 99 |
96 namespace webkit_support { | 100 namespace webkit_support { |
97 | 101 |
98 static TestEnvironment* test_environment; | 102 static TestEnvironment* test_environment; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 AfterShutdown(); | 141 AfterShutdown(); |
138 } | 142 } |
139 | 143 |
140 WebKit::WebKitClient* GetWebKitClient() { | 144 WebKit::WebKitClient* GetWebKitClient() { |
141 DCHECK(test_environment); | 145 DCHECK(test_environment); |
142 return test_environment->webkit_client(); | 146 return test_environment->webkit_client(); |
143 } | 147 } |
144 | 148 |
145 WebPlugin* CreateWebPlugin(WebFrame* frame, | 149 WebPlugin* CreateWebPlugin(WebFrame* frame, |
146 const WebPluginParams& params) { | 150 const WebPluginParams& params) { |
147 return new WebPluginImplWithPageDelegate(frame, params); | 151 const bool kAllowWildcard = true; |
| 152 WebPluginInfo info; |
| 153 std::string actual_mime_type; |
| 154 if (!NPAPI::PluginList::Singleton()->GetPluginInfo( |
| 155 params.url, params.mimeType.utf8(), kAllowWildcard, &info, |
| 156 &actual_mime_type)) { |
| 157 return NULL; |
| 158 } |
| 159 |
| 160 if (actual_mime_type.empty()) |
| 161 actual_mime_type = params.mimeType.utf8(); |
| 162 |
| 163 return new WebPluginImplWithPageDelegate( |
| 164 frame, params, info.path, actual_mime_type); |
148 } | 165 } |
149 | 166 |
150 WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame, | 167 WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame, |
151 WebMediaPlayerClient* client) { | 168 WebMediaPlayerClient* client) { |
152 scoped_refptr<media::FilterFactoryCollection> factory = | 169 scoped_refptr<media::FilterFactoryCollection> factory = |
153 new media::FilterFactoryCollection(); | 170 new media::FilterFactoryCollection(); |
154 | 171 |
155 appcache::WebApplicationCacheHostImpl* appcache_host = | 172 appcache::WebApplicationCacheHostImpl* appcache_host = |
156 appcache::WebApplicationCacheHostImpl::FromFrame(frame); | 173 appcache::WebApplicationCacheHostImpl::FromFrame(frame); |
157 | 174 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 329 } |
313 | 330 |
314 WebKit::WebThemeEngine* GetThemeEngine() { | 331 WebKit::WebThemeEngine* GetThemeEngine() { |
315 DCHECK(test_environment); | 332 DCHECK(test_environment); |
316 return test_environment->theme_engine(); | 333 return test_environment->theme_engine(); |
317 } | 334 } |
318 | 335 |
319 #endif | 336 #endif |
320 | 337 |
321 } // namespace webkit_support | 338 } // namespace webkit_support |
OLD | NEW |