| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cross_site_resource_handler.h" | 5 #include "content/browser/loader/cross_site_resource_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // request. | 154 // request. |
| 155 // | 155 // |
| 156 // Similarly, HTTP 204 (No Content) responses leave us showing the previous | 156 // Similarly, HTTP 204 (No Content) responses leave us showing the previous |
| 157 // page. We should allow the navigation to finish without running the unload | 157 // page. We should allow the navigation to finish without running the unload |
| 158 // handler or swapping in the pending RenderViewHost. | 158 // handler or swapping in the pending RenderViewHost. |
| 159 // | 159 // |
| 160 // In both cases, any pending RenderViewHost (if one was created for this | 160 // In both cases, any pending RenderViewHost (if one was created for this |
| 161 // navigation) will stick around until the next cross-site navigation, since | 161 // navigation) will stick around until the next cross-site navigation, since |
| 162 // we are unable to tell when to destroy it. | 162 // we are unable to tell when to destroy it. |
| 163 // See RenderFrameHostManager::RendererAbortedProvisionalLoad. | 163 // See RenderFrameHostManager::RendererAbortedProvisionalLoad. |
| 164 if (!swap_needed || info->IsDownload() || | 164 // |
| 165 // TODO(davidben): Unify IsDownload() and is_stream(). Several places need to |
| 166 // check for both and remembering about streams is error-prone. |
| 167 if (!swap_needed || info->IsDownload() || info->is_stream() || |
| 165 (response->head.headers.get() && | 168 (response->head.headers.get() && |
| 166 response->head.headers->response_code() == 204)) { | 169 response->head.headers->response_code() == 204)) { |
| 167 return next_handler_->OnResponseStarted(request_id, response, defer); | 170 return next_handler_->OnResponseStarted(request_id, response, defer); |
| 168 } | 171 } |
| 169 | 172 |
| 170 // Now that we know a swap is needed and we have something to commit, we | 173 // Now that we know a swap is needed and we have something to commit, we |
| 171 // pause to let the UI thread run the unload handler of the previous page | 174 // pause to let the UI thread run the unload handler of the previous page |
| 172 // and set up a transfer if needed. | 175 // and set up a transfer if needed. |
| 173 StartCrossSiteTransition(request_id, response, should_transfer); | 176 StartCrossSiteTransition(request_id, response, should_transfer); |
| 174 | 177 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 313 } |
| 311 | 314 |
| 312 void CrossSiteResourceHandler::ResumeIfDeferred() { | 315 void CrossSiteResourceHandler::ResumeIfDeferred() { |
| 313 if (did_defer_) { | 316 if (did_defer_) { |
| 314 did_defer_ = false; | 317 did_defer_ = false; |
| 315 controller()->Resume(); | 318 controller()->Resume(); |
| 316 } | 319 } |
| 317 } | 320 } |
| 318 | 321 |
| 319 } // namespace content | 322 } // namespace content |
| OLD | NEW |