| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 9 #include "config.h" |
| 10 | 10 |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 WebFrame* frame, const WebURLRequest& request, | 625 WebFrame* frame, const WebURLRequest& request, |
| 626 WebNavigationPolicy policy) { | 626 WebNavigationPolicy policy) { |
| 627 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab); | 627 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab); |
| 628 TestShell* shell = NULL; | 628 TestShell* shell = NULL; |
| 629 if (TestShell::CreateNewWindow(request.url(), &shell)) | 629 if (TestShell::CreateNewWindow(request.url(), &shell)) |
| 630 shell->Show(policy); | 630 shell->Show(policy); |
| 631 } | 631 } |
| 632 | 632 |
| 633 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation( | 633 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation( |
| 634 WebFrame* frame, const WebURLRequest& request, | 634 WebFrame* frame, const WebURLRequest& request, |
| 635 WebNavigationType type, WebNavigationPolicy default_policy, | 635 WebNavigationType type, const WebNode& originating_node, |
| 636 bool is_redirect) { | 636 WebNavigationPolicy default_policy, bool is_redirect) { |
| 637 WebNavigationPolicy result; | 637 WebNavigationPolicy result; |
| 638 if (policy_delegate_enabled_) { | 638 if (policy_delegate_enabled_) { |
| 639 printf("Policy delegate: attempt to load %s with navigation type '%s'\n", | 639 printf("Policy delegate: attempt to load %s with navigation type '%s'", |
| 640 GetURLDescription(request.url()).c_str(), | 640 GetURLDescription(request.url()).c_str(), |
| 641 WebNavigationTypeToString(type)); | 641 WebNavigationTypeToString(type)); |
| 642 WebNode node = originating_node; |
| 643 if (!node.isNull()) { |
| 644 printf(" originating from %s", node.nodeName().utf8().data()); |
| 645 for (node = node.parentNode(); !node.isNull(); node = node.parentNode()) { |
| 646 printf(" > %s", node.nodeName().utf8().data()); |
| 647 } |
| 648 } |
| 649 printf("\n"); |
| 642 if (policy_delegate_is_permissive_) { | 650 if (policy_delegate_is_permissive_) { |
| 643 result = WebKit::WebNavigationPolicyCurrentTab; | 651 result = WebKit::WebNavigationPolicyCurrentTab; |
| 644 } else { | 652 } else { |
| 645 result = WebKit::WebNavigationPolicyIgnore; | 653 result = WebKit::WebNavigationPolicyIgnore; |
| 646 } | 654 } |
| 647 if (policy_delegate_should_notify_done_) | 655 if (policy_delegate_should_notify_done_) |
| 648 shell_->layout_test_controller()->PolicyDelegateDone(); | 656 shell_->layout_test_controller()->PolicyDelegateDone(); |
| 649 } else { | 657 } else { |
| 650 result = default_policy; | 658 result = default_policy; |
| 651 } | 659 } |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 } | 1110 } |
| 1103 | 1111 |
| 1104 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1112 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1105 fake_rect_ = rect; | 1113 fake_rect_ = rect; |
| 1106 using_fake_rect_ = true; | 1114 using_fake_rect_ = true; |
| 1107 } | 1115 } |
| 1108 | 1116 |
| 1109 WebRect TestWebViewDelegate::fake_window_rect() { | 1117 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1110 return fake_rect_; | 1118 return fake_rect_; |
| 1111 } | 1119 } |
| OLD | NEW |