| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/cross_site_resource_handler.h" | 7 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/renderer_host/global_request_id.h" | 10 #include "chrome/browser/renderer_host/global_request_id.h" |
| 11 #include "chrome/browser/renderer_host/render_view_host.h" | 11 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, | 93 bool CrossSiteResourceHandler::OnReadCompleted(int request_id, |
| 94 int* bytes_read) { | 94 int* bytes_read) { |
| 95 if (!in_cross_site_transition_) { | 95 if (!in_cross_site_transition_) { |
| 96 return next_handler_->OnReadCompleted(request_id, bytes_read); | 96 return next_handler_->OnReadCompleted(request_id, bytes_read); |
| 97 } | 97 } |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool CrossSiteResourceHandler::OnResponseCompleted( | 101 bool CrossSiteResourceHandler::OnResponseCompleted( |
| 102 int request_id, | 102 int request_id, |
| 103 const URLRequestStatus& status, | 103 const net::URLRequestStatus& status, |
| 104 const std::string& security_info) { | 104 const std::string& security_info) { |
| 105 if (!in_cross_site_transition_) { | 105 if (!in_cross_site_transition_) { |
| 106 if (has_started_response_) { | 106 if (has_started_response_) { |
| 107 // We've already completed the transition, so just pass it through. | 107 // We've already completed the transition, so just pass it through. |
| 108 return next_handler_->OnResponseCompleted(request_id, status, | 108 return next_handler_->OnResponseCompleted(request_id, status, |
| 109 security_info); | 109 security_info); |
| 110 } else { | 110 } else { |
| 111 // An error occured, we should wait now for the cross-site transition, | 111 // An error occured, we should wait now for the cross-site transition, |
| 112 // so that the error message (e.g., 404) can be displayed to the user. | 112 // so that the error message (e.g., 404) can be displayed to the user. |
| 113 // Also continue with the logic below to remember that we completed | 113 // Also continue with the logic below to remember that we completed |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // starting, so that it can tell its old renderer to run its onunload | 210 // starting, so that it can tell its old renderer to run its onunload |
| 211 // handler now. We will wait to hear the corresponding ClosePage_ACK. | 211 // handler now. We will wait to hear the corresponding ClosePage_ACK. |
| 212 CallRenderViewHostRendererManagementDelegate( | 212 CallRenderViewHostRendererManagementDelegate( |
| 213 render_process_host_id_, render_view_id_, | 213 render_process_host_id_, render_view_id_, |
| 214 &RenderViewHostDelegate::RendererManagement::OnCrossSiteResponse, | 214 &RenderViewHostDelegate::RendererManagement::OnCrossSiteResponse, |
| 215 render_process_host_id_, request_id); | 215 render_process_host_id_, request_id); |
| 216 | 216 |
| 217 // TODO(creis): If the above call should fail, then we need to notify the IO | 217 // TODO(creis): If the above call should fail, then we need to notify the IO |
| 218 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. | 218 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. |
| 219 } | 219 } |
| OLD | NEW |