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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
8 | 8 |
9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
10 | 10 |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "gfx/native_widget_types.h" | 19 #include "gfx/native_widget_types.h" |
20 #include "gfx/point.h" | 20 #include "gfx/point.h" |
21 #include "media/base/filter_collection.h" | 21 #include "media/base/filter_collection.h" |
| 22 #include "media/base/message_loop_factory_impl.h" |
22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" |
24 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
25 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" |
26 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" |
27 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" |
28 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
29 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" | 30 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" |
30 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" | 31 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" |
31 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" | 32 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 frame, params, info.path, actual_mime_type, AsWeakPtr()); | 717 frame, params, info.path, actual_mime_type, AsWeakPtr()); |
717 } | 718 } |
718 | 719 |
719 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, | 720 WebWorker* TestWebViewDelegate::createWorker(WebFrame* frame, |
720 WebWorkerClient* client) { | 721 WebWorkerClient* client) { |
721 return new TestWebWorker(); | 722 return new TestWebWorker(); |
722 } | 723 } |
723 | 724 |
724 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( | 725 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( |
725 WebFrame* frame, WebMediaPlayerClient* client) { | 726 WebFrame* frame, WebMediaPlayerClient* client) { |
| 727 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
| 728 new media::MessageLoopFactoryImpl()); |
| 729 |
726 scoped_ptr<media::FilterCollection> collection( | 730 scoped_ptr<media::FilterCollection> collection( |
727 new media::FilterCollection()); | 731 new media::FilterCollection()); |
728 | 732 |
729 scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( | 733 scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( |
730 new webkit_glue::VideoRendererImpl(false)); | 734 new webkit_glue::VideoRendererImpl(false)); |
731 collection->AddVideoRenderer(video_renderer); | 735 collection->AddVideoRenderer(video_renderer); |
732 | 736 |
733 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( | 737 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( |
734 new webkit_glue::WebMediaPlayerImpl(client, collection.release())); | 738 new webkit_glue::WebMediaPlayerImpl(client, |
| 739 collection.release(), |
| 740 message_loop_factory.release())); |
735 if (!result->Initialize(frame, false, video_renderer)) { | 741 if (!result->Initialize(frame, false, video_renderer)) { |
736 return NULL; | 742 return NULL; |
737 } | 743 } |
738 return result.release(); | 744 return result.release(); |
739 } | 745 } |
740 | 746 |
741 WebApplicationCacheHost* TestWebViewDelegate::createApplicationCacheHost( | 747 WebApplicationCacheHost* TestWebViewDelegate::createApplicationCacheHost( |
742 WebFrame* frame, WebApplicationCacheHostClient* client) { | 748 WebFrame* frame, WebApplicationCacheHostClient* client) { |
743 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); | 749 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); |
744 } | 750 } |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 } | 1327 } |
1322 | 1328 |
1323 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1329 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
1324 fake_rect_ = rect; | 1330 fake_rect_ = rect; |
1325 using_fake_rect_ = true; | 1331 using_fake_rect_ = true; |
1326 } | 1332 } |
1327 | 1333 |
1328 WebRect TestWebViewDelegate::fake_window_rect() { | 1334 WebRect TestWebViewDelegate::fake_window_rect() { |
1329 return fake_rect_; | 1335 return fake_rect_; |
1330 } | 1336 } |
OLD | NEW |