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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2060313002: Navigation throttle for the Safe Browsing Subresource Filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pre-tab-activation
Patch Set: Comment to SubresourceFilterNavigationThrotle explaining its purpose. Created 4 years, 6 months 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 "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 CHECK_NE(INITIAL, state_) 176 CHECK_NE(INITIAL, state_)
177 << "This accessor should not be called before the request is started."; 177 << "This accessor should not be called before the request is started.";
178 return is_external_protocol_; 178 return is_external_protocol_;
179 } 179 }
180 180
181 net::Error NavigationHandleImpl::GetNetErrorCode() { 181 net::Error NavigationHandleImpl::GetNetErrorCode() {
182 return net_error_code_; 182 return net_error_code_;
183 } 183 }
184 184
185 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { 185 RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() {
186 CHECK(state_ >= READY_TO_COMMIT) 186 CHECK(state_ >= READY_TO_COMMIT || state_ == WILL_PROCESS_RESPONSE)
clamy 2016/06/24 12:13:38 This should be state_ >= WILL_PROCESS_RESPONSE.
Mike West 2016/06/24 14:46:32 Note that https://codereview.chromium.org/20256830
melandory 2016/06/25 01:46:10 Done
187 << "This accessor should only be called " 187 << "This accessor should only be called "
188 "after the navigation is ready to commit."; 188 "after the navigation is ready to commit.";
189 return render_frame_host_; 189 return render_frame_host_;
190 } 190 }
191 191
192 bool NavigationHandleImpl::IsSamePage() { 192 bool NavigationHandleImpl::IsSamePage() {
193 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE) 193 DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE)
194 << "This accessor should not be called before the navigation has " 194 << "This accessor should not be called before the navigation has "
195 "committed."; 195 "committed.";
196 return is_same_page_; 196 return is_same_page_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 WillRedirectRequest(new_url, new_method_is_post ? "POST" : "GET", 284 WillRedirectRequest(new_url, new_method_is_post ? "POST" : "GET",
285 new_referrer_url, new_is_external_protocol, 285 new_referrer_url, new_is_external_protocol,
286 scoped_refptr<net::HttpResponseHeaders>(), 286 scoped_refptr<net::HttpResponseHeaders>(),
287 base::Bind(&UpdateThrottleCheckResult, &result)); 287 base::Bind(&UpdateThrottleCheckResult, &result));
288 288
289 // Reset the callback to ensure it will not be called later. 289 // Reset the callback to ensure it will not be called later.
290 complete_callback_.Reset(); 290 complete_callback_.Reset();
291 return result; 291 return result;
292 } 292 }
293 293
294 NavigationThrottle::ThrottleCheckResult
295 NavigationHandleImpl::CallWillProcessResponseForTesting(
296 content::RenderFrameHost* render_frame_host) {
297 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
298 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host),
299 scoped_refptr<net::HttpResponseHeaders>(),
300 base::Bind(&UpdateThrottleCheckResult, &result));
301
302 // Reset the callback to ensure it will not be called later.
303 complete_callback_.Reset();
304 return result;
305 }
306
294 NavigationData* NavigationHandleImpl::GetNavigationData() { 307 NavigationData* NavigationHandleImpl::GetNavigationData() {
295 return navigation_data_.get(); 308 return navigation_data_.get();
296 } 309 }
297 310
298 void NavigationHandleImpl::InitServiceWorkerHandle( 311 void NavigationHandleImpl::InitServiceWorkerHandle(
299 ServiceWorkerContextWrapper* service_worker_context) { 312 ServiceWorkerContextWrapper* service_worker_context) {
300 DCHECK(IsBrowserSideNavigationEnabled()); 313 DCHECK(IsBrowserSideNavigationEnabled());
301 service_worker_handle_.reset( 314 service_worker_handle_.reset(
302 new ServiceWorkerNavigationHandle(service_worker_context)); 315 new ServiceWorkerNavigationHandle(service_worker_context));
303 } 316 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 complete_callback_.Reset(); 545 complete_callback_.Reset();
533 546
534 if (!callback.is_null()) 547 if (!callback.is_null())
535 callback.Run(result); 548 callback.Run(result);
536 549
537 // No code after running the callback, as it might have resulted in our 550 // No code after running the callback, as it might have resulted in our
538 // destruction. 551 // destruction.
539 } 552 }
540 553
541 } // namespace content 554 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698