| 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/loader/doomed_resource_handler.h" | 10 #include "content/browser/loader/doomed_resource_handler.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 render_view_id, | 296 render_view_id, |
| 297 ssl_info, | 297 ssl_info, |
| 298 fatal); | 298 fatal); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) { | 301 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) { |
| 302 DCHECK_EQ(request_.get(), unused); | 302 DCHECK_EQ(request_.get(), unused); |
| 303 | 303 |
| 304 VLOG(1) << "OnResponseStarted: " << request_->url().spec(); | 304 VLOG(1) << "OnResponseStarted: " << request_->url().spec(); |
| 305 | 305 |
| 306 // The CanLoadPage check should take place after any server redirects have |
| 307 // finished, at the point in time that we know a page will commit in the |
| 308 // renderer process. |
| 309 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 310 ChildProcessSecurityPolicyImpl* policy = |
| 311 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 312 if (!policy->CanLoadPage(info->GetChildID(), |
| 313 request_->url(), |
| 314 info->GetResourceType())) { |
| 315 Cancel(); |
| 316 return; |
| 317 } |
| 318 |
| 306 if (!request_->status().is_success()) { | 319 if (!request_->status().is_success()) { |
| 307 ResponseCompleted(); | 320 ResponseCompleted(); |
| 308 return; | 321 return; |
| 309 } | 322 } |
| 310 | 323 |
| 311 // We want to send a final upload progress message prior to sending the | 324 // We want to send a final upload progress message prior to sending the |
| 312 // response complete message even if we're waiting for an ack to to a | 325 // response complete message even if we're waiting for an ack to to a |
| 313 // previous upload progress message. | 326 // previous upload progress message. |
| 314 waiting_for_upload_progress_ack_ = false; | 327 waiting_for_upload_progress_ack_ = false; |
| 315 ReportUploadProgress(); | 328 ReportUploadProgress(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 // we resume. | 586 // we resume. |
| 574 deferred_stage_ = DEFERRED_FINISH; | 587 deferred_stage_ = DEFERRED_FINISH; |
| 575 } | 588 } |
| 576 } | 589 } |
| 577 | 590 |
| 578 void ResourceLoader::CallDidFinishLoading() { | 591 void ResourceLoader::CallDidFinishLoading() { |
| 579 delegate_->DidFinishLoading(this); | 592 delegate_->DidFinishLoading(this); |
| 580 } | 593 } |
| 581 | 594 |
| 582 } // namespace content | 595 } // namespace content |
| OLD | NEW |