OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |