OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 #include "content/browser/web_contents/web_contents_impl.h" | 6 #include "content/browser/web_contents/web_contents_impl.h" |
7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
9 #include "content/public/common/request_context_type.h" | 9 #include "content/public/common/request_context_type.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void Resume() { navigation_handle()->Resume(); } | 143 void Resume() { navigation_handle()->Resume(); } |
144 | 144 |
145 RequestContextType request_context_type() { return request_context_type_; } | 145 RequestContextType request_context_type() { return request_context_type_; } |
146 | 146 |
147 private: | 147 private: |
148 // NavigationThrottle implementation. | 148 // NavigationThrottle implementation. |
149 NavigationThrottle::ThrottleCheckResult WillStartRequest() override { | 149 NavigationThrottle::ThrottleCheckResult WillStartRequest() override { |
150 NavigationHandleImpl* navigation_handle_impl = | 150 NavigationHandleImpl* navigation_handle_impl = |
151 static_cast<NavigationHandleImpl*>(navigation_handle()); | 151 static_cast<NavigationHandleImpl*>(navigation_handle()); |
152 CHECK_NE(REQUEST_CONTEXT_TYPE_UNSPECIFIED, | 152 CHECK_NE(REQUEST_CONTEXT_TYPE_UNSPECIFIED, |
153 navigation_handle_impl->GetRequestContextType()); | 153 navigation_handle_impl->request_context_type()); |
154 request_context_type_ = navigation_handle_impl->GetRequestContextType(); | 154 request_context_type_ = navigation_handle_impl->request_context_type(); |
155 | 155 |
156 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, did_call_will_start_); | 156 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, did_call_will_start_); |
157 return will_start_result_; | 157 return will_start_result_; |
158 } | 158 } |
159 | 159 |
160 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override { | 160 NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override { |
161 NavigationHandleImpl* navigation_handle_impl = | 161 NavigationHandleImpl* navigation_handle_impl = |
162 static_cast<NavigationHandleImpl*>(navigation_handle()); | 162 static_cast<NavigationHandleImpl*>(navigation_handle()); |
163 CHECK_EQ(request_context_type_, | 163 CHECK_EQ(request_context_type_, |
164 navigation_handle_impl->GetRequestContextType()); | 164 navigation_handle_impl->request_context_type()); |
165 | 165 |
166 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 166 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
167 did_call_will_redirect_); | 167 did_call_will_redirect_); |
168 return will_redirect_result_; | 168 return will_redirect_result_; |
169 } | 169 } |
170 | 170 |
171 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override { | 171 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override { |
172 NavigationHandleImpl* navigation_handle_impl = | 172 NavigationHandleImpl* navigation_handle_impl = |
173 static_cast<NavigationHandleImpl*>(navigation_handle()); | 173 static_cast<NavigationHandleImpl*>(navigation_handle()); |
174 CHECK_EQ(request_context_type_, | 174 CHECK_EQ(request_context_type_, |
175 navigation_handle_impl->GetRequestContextType()); | 175 navigation_handle_impl->request_context_type()); |
176 | 176 |
177 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 177 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
178 did_call_will_process_); | 178 did_call_will_process_); |
179 return will_process_result_; | 179 return will_process_result_; |
180 } | 180 } |
181 | 181 |
182 NavigationThrottle::ThrottleCheckResult will_start_result_; | 182 NavigationThrottle::ThrottleCheckResult will_start_result_; |
183 NavigationThrottle::ThrottleCheckResult will_redirect_result_; | 183 NavigationThrottle::ThrottleCheckResult will_redirect_result_; |
184 NavigationThrottle::ThrottleCheckResult will_process_result_; | 184 NavigationThrottle::ThrottleCheckResult will_process_result_; |
185 base::Closure did_call_will_start_; | 185 base::Closure did_call_will_start_; |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 IN_PROC_BROWSER_TEST_F(NavigationHandleImplHttpsUpgradeBrowserTest, | 898 IN_PROC_BROWSER_TEST_F(NavigationHandleImplHttpsUpgradeBrowserTest, |
899 StartUrlIsHttpsUpgradedCrossSite) { | 899 StartUrlIsHttpsUpgradedCrossSite) { |
900 GURL start_url( | 900 GURL start_url( |
901 embedded_test_server()->GetURL("/https_upgrade_cross_site.html")); | 901 embedded_test_server()->GetURL("/https_upgrade_cross_site.html")); |
902 GURL cross_site_iframe_secure_url("https://other.com/title1.html"); | 902 GURL cross_site_iframe_secure_url("https://other.com/title1.html"); |
903 | 903 |
904 CheckHttpsUpgradedIframeNavigation(start_url, cross_site_iframe_secure_url); | 904 CheckHttpsUpgradedIframeNavigation(start_url, cross_site_iframe_secure_url); |
905 } | 905 } |
906 | 906 |
907 } // namespace content | 907 } // namespace content |
OLD | NEW |