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()->HasUserGesture(), |
| 71 navigation_handle()->GetMethod() == "POST", |
71 navigation_handle()->GetPageTransition(), is_redirect, | 72 navigation_handle()->GetPageTransition(), is_redirect, |
72 navigation_handle()->IsExternalProtocol(), true); | 73 navigation_handle()->IsExternalProtocol(), true); |
73 | 74 |
74 if (run_callback_synchronously_) { | 75 if (run_callback_synchronously_) { |
75 bool should_ignore_navigation = should_ignore_callback_.Run( | 76 bool should_ignore_navigation = should_ignore_callback_.Run( |
76 navigation_handle()->GetWebContents(), navigation_params); | 77 navigation_handle()->GetWebContents(), navigation_params); |
77 return should_ignore_navigation | 78 return should_ignore_navigation |
78 ? content::NavigationThrottle::CANCEL_AND_IGNORE | 79 ? content::NavigationThrottle::CANCEL_AND_IGNORE |
79 : content::NavigationThrottle::PROCEED; | 80 : content::NavigationThrottle::PROCEED; |
80 } | 81 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 CHECK(handle); | 123 CHECK(handle); |
123 if (should_ignore_navigation) { | 124 if (should_ignore_navigation) { |
124 navigation_handle()->CancelDeferredNavigation( | 125 navigation_handle()->CancelDeferredNavigation( |
125 content::NavigationThrottle::CANCEL_AND_IGNORE); | 126 content::NavigationThrottle::CANCEL_AND_IGNORE); |
126 } else { | 127 } else { |
127 handle->Resume(); | 128 handle->Resume(); |
128 } | 129 } |
129 } | 130 } |
130 | 131 |
131 } // namespace navigation_interception | 132 } // namespace navigation_interception |
OLD | NEW |