| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/cross_site_resource_handler.h" | 7 #include "content/browser/renderer_host/cross_site_resource_handler.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // request. | 85 // request. |
| 86 // | 86 // |
| 87 // Similarly, HTTP 204 (No Content) responses leave us showing the previous | 87 // Similarly, HTTP 204 (No Content) responses leave us showing the previous |
| 88 // page. We should allow the navigation to finish without running the unload | 88 // page. We should allow the navigation to finish without running the unload |
| 89 // handler or swapping in the pending RenderViewHost. | 89 // handler or swapping in the pending RenderViewHost. |
| 90 // | 90 // |
| 91 // In both cases, the pending RenderViewHost will stick around until the next | 91 // In both cases, the pending RenderViewHost will stick around until the next |
| 92 // cross-site navigation, since we are unable to tell when to destroy it. | 92 // cross-site navigation, since we are unable to tell when to destroy it. |
| 93 // See RenderViewHostManager::RendererAbortedProvisionalLoad. | 93 // See RenderViewHostManager::RendererAbortedProvisionalLoad. |
| 94 if (info->is_download() || | 94 if (info->is_download() || |
| 95 (response->headers && response->headers->response_code() == 204)) { | 95 (response->head.headers && |
| 96 response->head.headers->response_code() == 204)) { |
| 96 return next_handler_->OnResponseStarted(request_id, response, defer); | 97 return next_handler_->OnResponseStarted(request_id, response, defer); |
| 97 } | 98 } |
| 98 | 99 |
| 99 // Tell the renderer to run the onunload event handler, and wait for the | 100 // Tell the renderer to run the onunload event handler, and wait for the |
| 100 // reply. | 101 // reply. |
| 101 StartCrossSiteTransition(request_id, response, defer); | 102 StartCrossSiteTransition(request_id, response, defer); |
| 102 return true; | 103 return true; |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, | 106 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 221 } |
| 221 | 222 |
| 222 void CrossSiteResourceHandler::ResumeIfDeferred() { | 223 void CrossSiteResourceHandler::ResumeIfDeferred() { |
| 223 if (did_defer_) { | 224 if (did_defer_) { |
| 224 did_defer_ = false; | 225 did_defer_ = false; |
| 225 controller()->Resume(); | 226 controller()->Resume(); |
| 226 } | 227 } |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace content | 230 } // namespace content |
| OLD | NEW |