| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 bridge_factory); | 656 bridge_factory); |
| 657 // A sophisticated data source that does memory caching. | 657 // A sophisticated data source that does memory caching. |
| 658 media::FilterFactory* buffered_data_source_factory = | 658 media::FilterFactory* buffered_data_source_factory = |
| 659 webkit_glue::BufferedDataSource::CreateFactory(MessageLoop::current(), | 659 webkit_glue::BufferedDataSource::CreateFactory(MessageLoop::current(), |
| 660 bridge_factory); | 660 bridge_factory); |
| 661 factory->AddFactory(buffered_data_source_factory); | 661 factory->AddFactory(buffered_data_source_factory); |
| 662 factory->AddFactory(simple_data_source_factory); | 662 factory->AddFactory(simple_data_source_factory); |
| 663 return new webkit_glue::WebMediaPlayerImpl(client, factory); | 663 return new webkit_glue::WebMediaPlayerImpl(client, factory); |
| 664 } | 664 } |
| 665 | 665 |
| 666 bool TestWebViewDelegate::allowPlugins(WebFrame* frame, |
| 667 bool enabled_per_settings) { |
| 668 return shell_->allow_plugins(); |
| 669 } |
| 670 |
| 671 bool TestWebViewDelegate::allowImages(WebFrame* frame, |
| 672 bool enabled_per_settings) { |
| 673 return shell_->allow_images(); |
| 674 } |
| 675 |
| 666 void TestWebViewDelegate::loadURLExternally( | 676 void TestWebViewDelegate::loadURLExternally( |
| 667 WebFrame* frame, const WebURLRequest& request, | 677 WebFrame* frame, const WebURLRequest& request, |
| 668 WebNavigationPolicy policy) { | 678 WebNavigationPolicy policy) { |
| 669 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab); | 679 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab); |
| 670 TestShell* shell = NULL; | 680 TestShell* shell = NULL; |
| 671 if (TestShell::CreateNewWindow(request.url(), &shell)) | 681 if (TestShell::CreateNewWindow(request.url(), &shell)) |
| 672 shell->Show(policy); | 682 shell->Show(policy); |
| 673 } | 683 } |
| 674 | 684 |
| 675 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation( | 685 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation( |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 if (shell_->ShouldDumpFrameLoadCallbacks()) | 1001 if (shell_->ShouldDumpFrameLoadCallbacks()) |
| 992 printf("didDisplayInsecureContent\n"); | 1002 printf("didDisplayInsecureContent\n"); |
| 993 } | 1003 } |
| 994 | 1004 |
| 995 void TestWebViewDelegate::didRunInsecureContent( | 1005 void TestWebViewDelegate::didRunInsecureContent( |
| 996 WebFrame* frame, const WebSecurityOrigin& origin) { | 1006 WebFrame* frame, const WebSecurityOrigin& origin) { |
| 997 if (shell_->ShouldDumpFrameLoadCallbacks()) | 1007 if (shell_->ShouldDumpFrameLoadCallbacks()) |
| 998 printf("didRunInsecureContent\n"); | 1008 printf("didRunInsecureContent\n"); |
| 999 } | 1009 } |
| 1000 | 1010 |
| 1011 bool TestWebViewDelegate::allowScript(WebFrame* frame, |
| 1012 bool enabled_per_settings) { |
| 1013 return shell_->allow_scripts(); |
| 1014 } |
| 1015 |
| 1001 void TestWebViewDelegate::focusAccessibilityObject( | 1016 void TestWebViewDelegate::focusAccessibilityObject( |
| 1002 const WebAccessibilityObject& object) { | 1017 const WebAccessibilityObject& object) { |
| 1003 shell_->accessibility_controller()->SetFocusedElement(object); | 1018 shell_->accessibility_controller()->SetFocusedElement(object); |
| 1004 } | 1019 } |
| 1005 | 1020 |
| 1006 // Public methods ------------------------------------------------------------ | 1021 // Public methods ------------------------------------------------------------ |
| 1007 | 1022 |
| 1008 TestWebViewDelegate::TestWebViewDelegate(TestShell* shell) | 1023 TestWebViewDelegate::TestWebViewDelegate(TestShell* shell) |
| 1009 : policy_delegate_enabled_(false), | 1024 : policy_delegate_enabled_(false), |
| 1010 policy_delegate_is_permissive_(false), | 1025 policy_delegate_is_permissive_(false), |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 } | 1213 } |
| 1199 | 1214 |
| 1200 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1215 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1201 fake_rect_ = rect; | 1216 fake_rect_ = rect; |
| 1202 using_fake_rect_ = true; | 1217 using_fake_rect_ = true; |
| 1203 } | 1218 } |
| 1204 | 1219 |
| 1205 WebRect TestWebViewDelegate::fake_window_rect() { | 1220 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1206 return fake_rect_; | 1221 return fake_rect_; |
| 1207 } | 1222 } |
| OLD | NEW |