| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return "NavigationResourceThrottle"; | 252 return "NavigationResourceThrottle"; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void NavigationResourceThrottle::OnUIChecksPerformed( | 255 void NavigationResourceThrottle::OnUIChecksPerformed( |
| 256 NavigationThrottle::ThrottleCheckResult result) { | 256 NavigationThrottle::ThrottleCheckResult result) { |
| 257 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 257 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 258 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { | 258 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { |
| 259 controller()->CancelAndIgnore(); | 259 controller()->CancelAndIgnore(); |
| 260 } else if (result == NavigationThrottle::CANCEL) { | 260 } else if (result == NavigationThrottle::CANCEL) { |
| 261 controller()->Cancel(); | 261 controller()->Cancel(); |
| 262 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { | |
| 263 // TODO(mkwst): If we cancel the main frame request with anything other than | |
| 264 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be | |
| 265 // desirable here (non-POSTs will reload the page, while POST has some logic | |
| 266 // around reloading to avoid duplicating actions server-side). For the | |
| 267 // moment, only child frame navigations should be blocked. If we need to | |
| 268 // block main frame navigations in the future, we'll need to carefully | |
| 269 // consider the right thing to do here. | |
| 270 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); | |
| 271 controller()->CancelWithError(net::ERR_BLOCKED_BY_RESPONSE); | |
| 272 } else { | 262 } else { |
| 273 controller()->Resume(); | 263 controller()->Resume(); |
| 274 } | 264 } |
| 275 } | 265 } |
| 276 | 266 |
| 277 } // namespace content | 267 } // namespace content |
| OLD | NEW |