Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate.cc

Issue 14330009: Remove WebNode parameter from decidePolicyForNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 WebFrame* frame, const WebURLRequest& request, 551 WebFrame* frame, const WebURLRequest& request,
552 WebNavigationPolicy policy) { 552 WebNavigationPolicy policy) {
553 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab); 553 DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab);
554 TestShell* shell = NULL; 554 TestShell* shell = NULL;
555 if (TestShell::CreateNewWindow(request.url(), &shell)) 555 if (TestShell::CreateNewWindow(request.url(), &shell))
556 shell->Show(policy); 556 shell->Show(policy);
557 } 557 }
558 558
559 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation( 559 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation(
560 WebFrame* frame, const WebURLRequest& request, 560 WebFrame* frame, const WebURLRequest& request,
561 WebNavigationType type, const WebNode& originating_node, 561 WebNavigationType type, WebNavigationPolicy default_policy,
562 WebNavigationPolicy default_policy, bool is_redirect) { 562 bool is_redirect) {
563 WebNavigationPolicy result; 563 WebNavigationPolicy result;
564 if (policy_delegate_enabled_) { 564 if (policy_delegate_enabled_) {
565 printf("Policy delegate: attempt to load %s with navigation type '%s'", 565 printf("Policy delegate: attempt to load %s with navigation type '%s'\n",
566 GetURLDescription(request.url()).c_str(), 566 GetURLDescription(request.url()).c_str(),
567 WebNavigationTypeToString(type)); 567 WebNavigationTypeToString(type));
568 if (!originating_node.isNull()) {
569 printf(" originating from %s",
570 GetNodeDescription(originating_node, 0).c_str());
571 }
572 printf("\n");
573 if (policy_delegate_is_permissive_) { 568 if (policy_delegate_is_permissive_) {
574 result = WebKit::WebNavigationPolicyCurrentTab; 569 result = WebKit::WebNavigationPolicyCurrentTab;
575 } else { 570 } else {
576 result = WebKit::WebNavigationPolicyIgnore; 571 result = WebKit::WebNavigationPolicyIgnore;
577 } 572 }
578 } else { 573 } else {
579 result = default_policy; 574 result = default_policy;
580 } 575 }
581 return result; 576 return result;
582 } 577 }
583 578
579 WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation(
580 WebFrame* frame, const WebURLRequest& request,
581 WebNavigationType type, const WebNode& originating_node,
582 WebNavigationPolicy default_policy, bool is_redirect) {
583 return decidePolicyForNavigation(frame, request, type,
584 default_policy, is_redirect);
585 }
586
584 bool TestWebViewDelegate::canHandleRequest( 587 bool TestWebViewDelegate::canHandleRequest(
585 WebFrame* frame, const WebURLRequest& request) { 588 WebFrame* frame, const WebURLRequest& request) {
586 GURL url = request.url(); 589 GURL url = request.url();
587 // Just reject the scheme used in 590 // Just reject the scheme used in
588 // LayoutTests/http/tests/misc/redirect-to-external-url.html 591 // LayoutTests/http/tests/misc/redirect-to-external-url.html
589 return !url.SchemeIs("spaceballs"); 592 return !url.SchemeIs("spaceballs");
590 } 593 }
591 594
592 WebURLError TestWebViewDelegate::cannotHandleRequestError( 595 WebURLError TestWebViewDelegate::cannotHandleRequestError(
593 WebFrame* frame, const WebURLRequest& request) { 596 WebFrame* frame, const WebURLRequest& request) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 1001 }
999 1002
1000 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { 1003 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) {
1001 fake_rect_ = rect; 1004 fake_rect_ = rect;
1002 using_fake_rect_ = true; 1005 using_fake_rect_ = true;
1003 } 1006 }
1004 1007
1005 WebRect TestWebViewDelegate::fake_window_rect() { 1008 WebRect TestWebViewDelegate::fake_window_rect() {
1006 return fake_rect_; 1009 return fake_rect_;
1007 } 1010 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698