| 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 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 720 |
| 721 WebWorker* TestWebViewDelegate::createWorker( | 721 WebWorker* TestWebViewDelegate::createWorker( |
| 722 WebFrame* frame, WebWorkerClient* client) { | 722 WebFrame* frame, WebWorkerClient* client) { |
| 723 return new TestWebWorker(); | 723 return new TestWebWorker(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( | 726 WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( |
| 727 WebFrame* frame, WebMediaPlayerClient* client) { | 727 WebFrame* frame, WebMediaPlayerClient* client) { |
| 728 scoped_ptr<media::MediaFilterCollection> collection( | 728 scoped_ptr<media::MediaFilterCollection> collection( |
| 729 new media::MediaFilterCollection()); | 729 new media::MediaFilterCollection()); |
| 730 | 730 /* |
| 731 appcache::WebApplicationCacheHostImpl* appcache_host = | 731 appcache::WebApplicationCacheHostImpl* appcache_host = |
| 732 appcache::WebApplicationCacheHostImpl::FromFrame(frame); | 732 appcache::WebApplicationCacheHostImpl::FromFrame(frame); |
| 733 | 733 */ |
| 734 // TODO(hclam): this is the same piece of code as in RenderView, maybe they | |
| 735 // should be grouped together. | |
| 736 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_simple = | |
| 737 new webkit_glue::MediaResourceLoaderBridgeFactory( | |
| 738 GURL(frame->url()), // referrer | |
| 739 "null", // frame origin | |
| 740 "null", // main_frame_origin | |
| 741 base::GetCurrentProcId(), | |
| 742 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, | |
| 743 0); | |
| 744 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_buffered = | |
| 745 new webkit_glue::MediaResourceLoaderBridgeFactory( | |
| 746 GURL(frame->url()), // referrer | |
| 747 "null", // frame origin | |
| 748 "null", // main_frame_origin | |
| 749 base::GetCurrentProcId(), | |
| 750 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, | |
| 751 0); | |
| 752 | |
| 753 scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( | 734 scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( |
| 754 new webkit_glue::VideoRendererImpl(false)); | 735 new webkit_glue::VideoRendererImpl(false)); |
| 755 collection->AddVideoRenderer(video_renderer); | 736 collection->AddVideoRenderer(video_renderer); |
| 756 | 737 |
| 757 return new webkit_glue::WebMediaPlayerImpl( | 738 return new webkit_glue::WebMediaPlayerImpl( |
| 758 client, collection.release(), bridge_factory_simple, | 739 client, collection.release(), frame, false, video_renderer); |
| 759 bridge_factory_buffered, false, video_renderer); | |
| 760 } | 740 } |
| 761 | 741 |
| 762 WebApplicationCacheHost* TestWebViewDelegate::createApplicationCacheHost( | 742 WebApplicationCacheHost* TestWebViewDelegate::createApplicationCacheHost( |
| 763 WebFrame* frame, WebApplicationCacheHostClient* client) { | 743 WebFrame* frame, WebApplicationCacheHostClient* client) { |
| 764 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); | 744 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); |
| 765 } | 745 } |
| 766 | 746 |
| 767 bool TestWebViewDelegate::allowPlugins(WebFrame* frame, | 747 bool TestWebViewDelegate::allowPlugins(WebFrame* frame, |
| 768 bool enabled_per_settings) { | 748 bool enabled_per_settings) { |
| 769 return enabled_per_settings && shell_->allow_plugins(); | 749 return enabled_per_settings && shell_->allow_plugins(); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 } | 1332 } |
| 1353 | 1333 |
| 1354 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1334 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1355 fake_rect_ = rect; | 1335 fake_rect_ = rect; |
| 1356 using_fake_rect_ = true; | 1336 using_fake_rect_ = true; |
| 1357 } | 1337 } |
| 1358 | 1338 |
| 1359 WebRect TestWebViewDelegate::fake_window_rect() { | 1339 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1360 return fake_rect_; | 1340 return fake_rect_; |
| 1361 } | 1341 } |
| OLD | NEW |