| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // request. | 87 // request. |
| 88 // | 88 // |
| 89 // Similarly, HTTP 204 (No Content) responses leave us showing the previous | 89 // Similarly, HTTP 204 (No Content) responses leave us showing the previous |
| 90 // page. We should allow the navigation to finish without running the unload | 90 // page. We should allow the navigation to finish without running the unload |
| 91 // handler or swapping in the pending RenderViewHost. | 91 // handler or swapping in the pending RenderViewHost. |
| 92 // | 92 // |
| 93 // In both cases, the pending RenderViewHost will stick around until the next | 93 // In both cases, the pending RenderViewHost will stick around until the next |
| 94 // cross-site navigation, since we are unable to tell when to destroy it. | 94 // cross-site navigation, since we are unable to tell when to destroy it. |
| 95 // See RenderViewHostManager::RendererAbortedProvisionalLoad. | 95 // See RenderViewHostManager::RendererAbortedProvisionalLoad. |
| 96 if (info->is_download() || | 96 if (info->is_download() || |
| 97 (response->headers && response->headers->response_code() == 204)) { | 97 (response->data.headers && |
| 98 response->data.headers->response_code() == 204)) { |
| 98 return next_handler_->OnResponseStarted(request_id, response); | 99 return next_handler_->OnResponseStarted(request_id, response); |
| 99 } | 100 } |
| 100 | 101 |
| 101 // Tell the renderer to run the onunload event handler, and wait for the | 102 // Tell the renderer to run the onunload event handler, and wait for the |
| 102 // reply. | 103 // reply. |
| 103 StartCrossSiteTransition(request_id, response, global_id); | 104 StartCrossSiteTransition(request_id, response, global_id); |
| 104 return true; | 105 return true; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, | 108 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 &OnCrossSiteResponseHelper, | 225 &OnCrossSiteResponseHelper, |
| 225 render_process_host_id_, | 226 render_process_host_id_, |
| 226 render_view_id_, | 227 render_view_id_, |
| 227 request_id)); | 228 request_id)); |
| 228 | 229 |
| 229 // TODO(creis): If the above call should fail, then we need to notify the IO | 230 // TODO(creis): If the above call should fail, then we need to notify the IO |
| 230 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. | 231 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace content | 234 } // namespace content |
| OLD | NEW |