| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // cross-site check. The renderer will see it is a download and abort the | 126 // cross-site check. The renderer will see it is a download and abort the |
| 127 // request. | 127 // request. |
| 128 // | 128 // |
| 129 // Similarly, HTTP 204 (No Content) responses leave us showing the previous | 129 // Similarly, HTTP 204 (No Content) responses leave us showing the previous |
| 130 // page. We should allow the navigation to finish without running the unload | 130 // page. We should allow the navigation to finish without running the unload |
| 131 // handler or swapping in the pending RenderViewHost. | 131 // handler or swapping in the pending RenderViewHost. |
| 132 // | 132 // |
| 133 // In both cases, any pending RenderViewHost (if one was created for this | 133 // In both cases, any pending RenderViewHost (if one was created for this |
| 134 // navigation) will stick around until the next cross-site navigation, since | 134 // navigation) will stick around until the next cross-site navigation, since |
| 135 // we are unable to tell when to destroy it. | 135 // we are unable to tell when to destroy it. |
| 136 // See RenderViewHostManager::RendererAbortedProvisionalLoad. | 136 // See RenderFrameHostManager::RendererAbortedProvisionalLoad. |
| 137 if (!swap_needed || info->IsDownload() || | 137 if (!swap_needed || info->IsDownload() || |
| 138 (response->head.headers.get() && | 138 (response->head.headers.get() && |
| 139 response->head.headers->response_code() == 204)) { | 139 response->head.headers->response_code() == 204)) { |
| 140 return next_handler_->OnResponseStarted(request_id, response, defer); | 140 return next_handler_->OnResponseStarted(request_id, response, defer); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Now that we know a swap is needed and we have something to commit, we | 143 // Now that we know a swap is needed and we have something to commit, we |
| 144 // pause to let the UI thread run the unload handler of the previous page | 144 // pause to let the UI thread run the unload handler of the previous page |
| 145 // and set up a transfer if needed. | 145 // and set up a transfer if needed. |
| 146 StartCrossSiteTransition(request_id, response, should_transfer); | 146 StartCrossSiteTransition(request_id, response, should_transfer); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void CrossSiteResourceHandler::ResumeIfDeferred() { | 284 void CrossSiteResourceHandler::ResumeIfDeferred() { |
| 285 if (did_defer_) { | 285 if (did_defer_) { |
| 286 did_defer_ = false; | 286 did_defer_ = false; |
| 287 controller()->Resume(); | 287 controller()->Resume(); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace content | 291 } // namespace content |
| OLD | NEW |