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

Side by Side Diff: components/navigation_interception/intercept_navigation_throttle.cc

Issue 2524763002: make NavigationGesture part of public content API and use it outside content (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/navigation_interception/intercept_navigation_throttle.h" 5 #include "components/navigation_interception/intercept_navigation_throttle.h"
6 6
7 #include "components/navigation_interception/navigation_params.h" 7 #include "components/navigation_interception/navigation_params.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/navigation_handle.h" 9 #include "content/public/browser/navigation_handle.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 InterceptNavigationThrottle::WillRedirectRequest() { 60 InterceptNavigationThrottle::WillRedirectRequest() {
61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
62 return CheckIfShouldIgnoreNavigation(true); 62 return CheckIfShouldIgnoreNavigation(true);
63 } 63 }
64 64
65 content::NavigationThrottle::ThrottleCheckResult 65 content::NavigationThrottle::ThrottleCheckResult
66 InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation(bool is_redirect) { 66 InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation(bool is_redirect) {
67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
68 NavigationParams navigation_params( 68 NavigationParams navigation_params(
69 navigation_handle()->GetURL(), navigation_handle()->GetReferrer(), 69 navigation_handle()->GetURL(), navigation_handle()->GetReferrer(),
70 navigation_handle()->HasUserGesture(), navigation_handle()->IsPost(), 70 navigation_handle()->GetNavigationGesture(),
71 navigation_handle()->GetPageTransition(), is_redirect, 71 navigation_handle()->IsPost(), navigation_handle()->GetPageTransition(),
72 navigation_handle()->IsExternalProtocol(), true); 72 is_redirect, navigation_handle()->IsExternalProtocol(), true);
73 73
74 if (run_callback_synchronously_) { 74 if (run_callback_synchronously_) {
75 bool should_ignore_navigation = should_ignore_callback_.Run( 75 bool should_ignore_navigation = should_ignore_callback_.Run(
76 navigation_handle()->GetWebContents(), navigation_params); 76 navigation_handle()->GetWebContents(), navigation_params);
77 return should_ignore_navigation 77 return should_ignore_navigation
78 ? content::NavigationThrottle::CANCEL_AND_IGNORE 78 ? content::NavigationThrottle::CANCEL_AND_IGNORE
79 : content::NavigationThrottle::PROCEED; 79 : content::NavigationThrottle::PROCEED;
80 } 80 }
81 81
82 // When the callback can potentially destroy the WebContents, along with the 82 // When the callback can potentially destroy the WebContents, along with the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 CHECK(handle); 122 CHECK(handle);
123 if (should_ignore_navigation) { 123 if (should_ignore_navigation) {
124 navigation_handle()->CancelDeferredNavigation( 124 navigation_handle()->CancelDeferredNavigation(
125 content::NavigationThrottle::CANCEL_AND_IGNORE); 125 content::NavigationThrottle::CANCEL_AND_IGNORE);
126 } else { 126 } else {
127 handle->Resume(); 127 handle->Resume();
128 } 128 }
129 } 129 }
130 130
131 } // namespace navigation_interception 131 } // namespace navigation_interception
OLDNEW
« no previous file with comments | « chrome/browser/plugins/flash_download_interception_unittest.cc ('k') | components/navigation_interception/navigation_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698