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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return CheckIfShouldIgnoreNavigation(true); | 58 return CheckIfShouldIgnoreNavigation(true); |
59 } | 59 } |
60 | 60 |
61 content::NavigationThrottle::ThrottleCheckResult | 61 content::NavigationThrottle::ThrottleCheckResult |
62 InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation(bool is_redirect) { | 62 InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation(bool is_redirect) { |
63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
64 NavigationParams navigation_params( | 64 NavigationParams navigation_params( |
65 navigation_handle()->GetURL(), navigation_handle()->GetReferrer(), | 65 navigation_handle()->GetURL(), navigation_handle()->GetReferrer(), |
66 navigation_handle()->HasUserGesture(), navigation_handle()->IsPost(), | 66 navigation_handle()->HasUserGesture(), navigation_handle()->IsPost(), |
67 navigation_handle()->GetPageTransition(), is_redirect, | 67 navigation_handle()->GetPageTransition(), is_redirect, |
68 navigation_handle()->IsExternalProtocol(), | 68 navigation_handle()->IsExternalProtocol(), true); |
69 navigation_handle()->IsInMainFrame()); | |
70 | 69 |
71 if (run_callback_synchronously_) { | 70 if (run_callback_synchronously_) { |
72 bool should_ignore_navigation = should_ignore_callback_.Run( | 71 bool should_ignore_navigation = should_ignore_callback_.Run( |
73 navigation_handle()->GetWebContents(), navigation_params); | 72 navigation_handle()->GetWebContents(), navigation_params); |
74 return should_ignore_navigation | 73 return should_ignore_navigation |
75 ? content::NavigationThrottle::CANCEL_AND_IGNORE | 74 ? content::NavigationThrottle::CANCEL_AND_IGNORE |
76 : content::NavigationThrottle::PROCEED; | 75 : content::NavigationThrottle::PROCEED; |
77 } | 76 } |
78 | 77 |
79 // When the callback can potentially destroy the WebContents, along with the | 78 // When the callback can potentially destroy the WebContents, along with the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool should_ignore_navigation) { | 113 bool should_ignore_navigation) { |
115 if (should_ignore_navigation) { | 114 if (should_ignore_navigation) { |
116 navigation_handle()->CancelDeferredNavigation( | 115 navigation_handle()->CancelDeferredNavigation( |
117 content::NavigationThrottle::CANCEL_AND_IGNORE); | 116 content::NavigationThrottle::CANCEL_AND_IGNORE); |
118 } else { | 117 } else { |
119 navigation_handle()->Resume(); | 118 navigation_handle()->Resume(); |
120 } | 119 } |
121 } | 120 } |
122 | 121 |
123 } // namespace navigation_interception | 122 } // namespace navigation_interception |
OLD | NEW |