| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return "NavigationResourceThrottle"; | 228 return "NavigationResourceThrottle"; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void NavigationResourceThrottle::OnUIChecksPerformed( | 231 void NavigationResourceThrottle::OnUIChecksPerformed( |
| 232 NavigationThrottle::ThrottleCheckResult result) { | 232 NavigationThrottle::ThrottleCheckResult result) { |
| 233 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 233 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 234 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { | 234 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { |
| 235 controller()->CancelAndIgnore(); | 235 controller()->CancelAndIgnore(); |
| 236 } else if (result == NavigationThrottle::CANCEL) { | 236 } else if (result == NavigationThrottle::CANCEL) { |
| 237 controller()->Cancel(); | 237 controller()->Cancel(); |
| 238 } else if (result == NavigationThrottle::BLOCK_RESPONSE) { |
| 239 // TODO(mkwst): If we cancel the main frame request with anything other than |
| 240 // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be |
| 241 // desirable here (non-POSTs will reload the page, while POST has some logic |
| 242 // around reloading to avoid duplicating actions server-side). For the |
| 243 // moment, only child frame navigations should be blocked. If we need to |
| 244 // block main frame navigations in the future, we'll need to carefully |
| 245 // consider the right thing to do here. |
| 246 DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame()); |
| 247 controller()->CancelWithError(net::ERR_BLOCKED_BY_RESPONSE); |
| 238 } else { | 248 } else { |
| 239 controller()->Resume(); | 249 controller()->Resume(); |
| 240 } | 250 } |
| 241 } | 251 } |
| 242 | 252 |
| 243 } // namespace content | 253 } // namespace content |
| OLD | NEW |