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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 void NavigationResourceThrottle::OnUIChecksPerformed( | 277 void NavigationResourceThrottle::OnUIChecksPerformed( |
278 NavigationThrottle::ThrottleCheckResult result) { | 278 NavigationThrottle::ThrottleCheckResult result) { |
279 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 279 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
280 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { | 280 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { |
281 controller()->CancelAndIgnore(); | 281 controller()->CancelAndIgnore(); |
282 } else if (result == NavigationThrottle::CANCEL) { | 282 } else if (result == NavigationThrottle::CANCEL) { |
283 controller()->Cancel(); | 283 controller()->Cancel(); |
284 } else if (result == NavigationThrottle::BLOCK_REQUEST) { | 284 } else if (result == NavigationThrottle::BLOCK_REQUEST) { |
285 controller()->CancelWithError(net::ERR_BLOCKED_BY_CLIENT); | 285 controller()->CancelWithError(net::ERR_BLOCKED_BY_CLIENT); |
| 286 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { |
| 287 // TODO(mkwst): If we cancel the main frame request with anything other than |
| 288 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be |
| 289 // desirable here (non-POSTs will reload the page, while POST has some logic |
| 290 // around reloading to avoid duplicating actions server-side). For the |
| 291 // moment, only child frame navigations should be blocked. If we need to |
| 292 // block main frame navigations in the future, we'll need to carefully |
| 293 // consider the right thing to do here. |
| 294 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); |
| 295 controller()->CancelWithError(net::ERR_BLOCKED_BY_RESPONSE); |
286 } else { | 296 } else { |
287 controller()->Resume(); | 297 controller()->Resume(); |
288 } | 298 } |
289 } | 299 } |
290 | 300 |
291 } // namespace content | 301 } // namespace content |
OLD | NEW |