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

Side by Side Diff: content/browser/loader/navigation_resource_throttle.cc

Issue 2632633006: Implement NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE. (Closed)
Patch Set: Rebase. Created 3 years, 11 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/loader/navigation_resource_throttle.h" 5 #include "content/browser/loader/navigation_resource_throttle.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 DCHECK_NE(NavigationThrottle::DEFER, result); 341 DCHECK_NE(NavigationThrottle::DEFER, result);
342 if (in_cross_site_transition_) { 342 if (in_cross_site_transition_) {
343 on_transfer_done_result_ = result; 343 on_transfer_done_result_ = result;
344 return; 344 return;
345 } 345 }
346 346
347 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { 347 if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
348 CancelAndIgnore(); 348 CancelAndIgnore();
349 } else if (result == NavigationThrottle::CANCEL) { 349 } else if (result == NavigationThrottle::CANCEL) {
350 Cancel(); 350 Cancel();
351 } else if (result == NavigationThrottle::BLOCK_REQUEST) { 351 } else if (result == NavigationThrottle::BLOCK_REQUEST ||
352 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) {
352 CancelWithError(net::ERR_BLOCKED_BY_CLIENT); 353 CancelWithError(net::ERR_BLOCKED_BY_CLIENT);
353 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { 354 } else if (result == NavigationThrottle::BLOCK_RESPONSE) {
354 // TODO(mkwst): If we cancel the main frame request with anything other than 355 // TODO(mkwst): If we cancel the main frame request with anything other than
355 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be 356 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be
356 // desirable here (non-POSTs will reload the page, while POST has some logic 357 // desirable here (non-POSTs will reload the page, while POST has some logic
357 // around reloading to avoid duplicating actions server-side). For the 358 // around reloading to avoid duplicating actions server-side). For the
358 // moment, only child frame navigations should be blocked. If we need to 359 // moment, only child frame navigations should be blocked. If we need to
359 // block main frame navigations in the future, we'll need to carefully 360 // block main frame navigations in the future, we'll need to carefully
360 // consider the right thing to do here. 361 // consider the right thing to do here.
361 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); 362 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame());
(...skipping 21 matching lines...) Expand all
383 384
384 // If the results of the checks on the UI thread are known, unblock the 385 // If the results of the checks on the UI thread are known, unblock the
385 // navigation. Otherwise, wait until the callback has executed. 386 // navigation. Otherwise, wait until the callback has executed.
386 if (on_transfer_done_result_ != NavigationThrottle::DEFER) { 387 if (on_transfer_done_result_ != NavigationThrottle::DEFER) {
387 OnUIChecksPerformed(on_transfer_done_result_); 388 OnUIChecksPerformed(on_transfer_done_result_);
388 on_transfer_done_result_ = NavigationThrottle::DEFER; 389 on_transfer_done_result_ = NavigationThrottle::DEFER;
389 } 390 }
390 } 391 }
391 392
392 } // namespace content 393 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698