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/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (request_->load_flags() & net::LOAD_ENABLE_UPLOAD_PROGRESS) { | 148 if (request_->load_flags() & net::LOAD_ENABLE_UPLOAD_PROGRESS) { |
149 handler_->OnUploadProgress( | 149 handler_->OnUploadProgress( |
150 info->GetRequestID(), progress.position(), progress.size()); | 150 info->GetRequestID(), progress.position(), progress.size()); |
151 waiting_for_upload_progress_ack_ = true; | 151 waiting_for_upload_progress_ack_ = true; |
152 } | 152 } |
153 last_upload_ticks_ = TimeTicks::Now(); | 153 last_upload_ticks_ = TimeTicks::Now(); |
154 last_upload_position_ = progress.position(); | 154 last_upload_position_ = progress.position(); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void ResourceLoader::MarkAsTransferring() { | 158 void ResourceLoader::MarkAsTransferring(const GURL& target_url) { |
| 159 CHECK_EQ(GetRequestInfo()->GetResourceType(), ResourceType::MAIN_FRAME) |
| 160 << "Cannot transfer non-main frame navigations"; |
159 is_transferring_ = true; | 161 is_transferring_ = true; |
160 | 162 |
| 163 // When transferring a request to another process, the renderer doesn't get |
| 164 // a chance to update the cookie policy URL. Do it here instead. |
| 165 request()->set_first_party_for_cookies(target_url); |
| 166 |
161 // When an URLRequest is transferred to a new RenderViewHost, its | 167 // When an URLRequest is transferred to a new RenderViewHost, its |
162 // ResourceHandler should not receive any notifications because it may depend | 168 // ResourceHandler should not receive any notifications because it may depend |
163 // on the state of the old RVH. We set a ResourceHandler that only allows | 169 // on the state of the old RVH. We set a ResourceHandler that only allows |
164 // canceling requests, because on shutdown of the RDH all pending requests | 170 // canceling requests, because on shutdown of the RDH all pending requests |
165 // are canceled. The RVH of requests that are being transferred may be gone | 171 // are canceled. The RVH of requests that are being transferred may be gone |
166 // by that time. In CompleteTransfer, the ResoureHandlers are substituted | 172 // by that time. In CompleteTransfer, the ResoureHandlers are substituted |
167 // again. | 173 // again. |
168 handler_.reset(new DoomedResourceHandler(handler_.Pass())); | 174 handler_.reset(new DoomedResourceHandler(handler_.Pass())); |
169 } | 175 } |
170 | 176 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 // we resume. | 666 // we resume. |
661 deferred_stage_ = DEFERRED_FINISH; | 667 deferred_stage_ = DEFERRED_FINISH; |
662 } | 668 } |
663 } | 669 } |
664 | 670 |
665 void ResourceLoader::CallDidFinishLoading() { | 671 void ResourceLoader::CallDidFinishLoading() { |
666 delegate_->DidFinishLoading(this); | 672 delegate_->DidFinishLoading(this); |
667 } | 673 } |
668 | 674 |
669 } // namespace content | 675 } // namespace content |
OLD | NEW |