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 "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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 DCHECK_NE(NavigationThrottle::DEFER, result); | 347 DCHECK_NE(NavigationThrottle::DEFER, result); |
348 if (in_cross_site_transition_) { | 348 if (in_cross_site_transition_) { |
349 on_transfer_done_result_ = result; | 349 on_transfer_done_result_ = result; |
350 return; | 350 return; |
351 } | 351 } |
352 | 352 |
353 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { | 353 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { |
354 CancelAndIgnore(); | 354 CancelAndIgnore(); |
355 } else if (result == NavigationThrottle::CANCEL) { | 355 } else if (result == NavigationThrottle::CANCEL) { |
356 Cancel(); | 356 Cancel(); |
357 } else if (result == NavigationThrottle::BLOCK_REQUEST) { | 357 } else if (result == NavigationThrottle::BLOCK_REQUEST || |
| 358 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) { |
358 CancelWithError(net::ERR_BLOCKED_BY_CLIENT); | 359 CancelWithError(net::ERR_BLOCKED_BY_CLIENT); |
359 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { | 360 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { |
360 // TODO(mkwst): If we cancel the main frame request with anything other than | 361 // TODO(mkwst): If we cancel the main frame request with anything other than |
361 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be | 362 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be |
362 // desirable here (non-POSTs will reload the page, while POST has some logic | 363 // desirable here (non-POSTs will reload the page, while POST has some logic |
363 // around reloading to avoid duplicating actions server-side). For the | 364 // around reloading to avoid duplicating actions server-side). For the |
364 // moment, only child frame navigations should be blocked. If we need to | 365 // moment, only child frame navigations should be blocked. If we need to |
365 // block main frame navigations in the future, we'll need to carefully | 366 // block main frame navigations in the future, we'll need to carefully |
366 // consider the right thing to do here. | 367 // consider the right thing to do here. |
367 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); | 368 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); |
(...skipping 21 matching lines...) Expand all Loading... |
389 | 390 |
390 // If the results of the checks on the UI thread are known, unblock the | 391 // If the results of the checks on the UI thread are known, unblock the |
391 // navigation. Otherwise, wait until the callback has executed. | 392 // navigation. Otherwise, wait until the callback has executed. |
392 if (on_transfer_done_result_ != NavigationThrottle::DEFER) { | 393 if (on_transfer_done_result_ != NavigationThrottle::DEFER) { |
393 OnUIChecksPerformed(on_transfer_done_result_); | 394 OnUIChecksPerformed(on_transfer_done_result_); |
394 on_transfer_done_result_ = NavigationThrottle::DEFER; | 395 on_transfer_done_result_ = NavigationThrottle::DEFER; |
395 } | 396 } |
396 } | 397 } |
397 | 398 |
398 } // namespace content | 399 } // namespace content |
OLD | NEW |