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/common/net/url_fetcher_core.h" | 5 #include "content/common/net/url_fetcher_core.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util_proxy.h" | 8 #include "base/file_util_proxy.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 // Since StartURLRequest() is posted as a *delayed* task, it may | 654 // Since StartURLRequest() is posted as a *delayed* task, it may |
655 // run after the URLFetcher was already stopped. | 655 // run after the URLFetcher was already stopped. |
656 return; | 656 return; |
657 } | 657 } |
658 | 658 |
659 DCHECK(request_context_getter_); | 659 DCHECK(request_context_getter_); |
660 DCHECK(!request_.get()); | 660 DCHECK(!request_.get()); |
661 | 661 |
662 g_registry.Get().AddURLFetcherCore(this); | 662 g_registry.Get().AddURLFetcherCore(this); |
663 current_response_bytes_ = 0; | 663 current_response_bytes_ = 0; |
664 request_.reset(new net::URLRequest(original_url_, this)); | 664 request_.reset(new net::URLRequest( |
| 665 original_url_, |
| 666 this, |
| 667 request_context_getter_->GetURLRequestContext())); |
665 request_->set_stack_trace(stack_trace_); | 668 request_->set_stack_trace(stack_trace_); |
666 int flags = request_->load_flags() | load_flags_; | 669 int flags = request_->load_flags() | load_flags_; |
667 if (!g_interception_enabled) | 670 if (!g_interception_enabled) |
668 flags = flags | net::LOAD_DISABLE_INTERCEPT; | 671 flags = flags | net::LOAD_DISABLE_INTERCEPT; |
669 | 672 |
670 if (is_chunked_upload_) | 673 if (is_chunked_upload_) |
671 request_->EnableChunkedUpload(); | 674 request_->EnableChunkedUpload(); |
672 request_->set_load_flags(flags); | 675 request_->set_load_flags(flags); |
673 request_->set_context(request_context_getter_->GetURLRequestContext()); | |
674 request_->set_referrer(referrer_); | 676 request_->set_referrer(referrer_); |
675 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? | 677 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? |
676 original_url_ : first_party_for_cookies_); | 678 original_url_ : first_party_for_cookies_); |
677 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) { | 679 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) { |
678 request_->SetUserData(url_request_data_key_, | 680 request_->SetUserData(url_request_data_key_, |
679 url_request_create_data_callback_.Run()); | 681 url_request_create_data_callback_.Run()); |
680 } | 682 } |
681 | 683 |
682 switch (request_type_) { | 684 switch (request_type_) { |
683 case net::URLFetcher::GET: | 685 case net::URLFetcher::GET: |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 997 } |
996 | 998 |
997 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( | 999 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( |
998 scoped_ptr<std::string> download_data) { | 1000 scoped_ptr<std::string> download_data) { |
999 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); | 1001 DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); |
1000 if (delegate_) | 1002 if (delegate_) |
1001 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); | 1003 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); |
1002 } | 1004 } |
1003 | 1005 |
1004 } // namespace content | 1006 } // namespace content |
OLD | NEW |