| 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 "net/url_request/url_fetcher_core.h" | 5 #include "net/url_request/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/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 // Since StartURLRequest() is posted as a *delayed* task, it may | 656 // Since StartURLRequest() is posted as a *delayed* task, it may |
| 657 // run after the URLFetcher was already stopped. | 657 // run after the URLFetcher was already stopped. |
| 658 return; | 658 return; |
| 659 } | 659 } |
| 660 | 660 |
| 661 DCHECK(request_context_getter_); | 661 DCHECK(request_context_getter_); |
| 662 DCHECK(!request_.get()); | 662 DCHECK(!request_.get()); |
| 663 | 663 |
| 664 g_registry.Get().AddURLFetcherCore(this); | 664 g_registry.Get().AddURLFetcherCore(this); |
| 665 current_response_bytes_ = 0; | 665 current_response_bytes_ = 0; |
| 666 request_.reset(new URLRequest( | 666 request_.reset(request_context_getter_->GetURLRequestContext()->CreateRequest( |
| 667 original_url_, | 667 original_url_, this)); |
| 668 this, | |
| 669 request_context_getter_->GetURLRequestContext())); | |
| 670 request_->set_stack_trace(stack_trace_); | 668 request_->set_stack_trace(stack_trace_); |
| 671 int flags = request_->load_flags() | load_flags_; | 669 int flags = request_->load_flags() | load_flags_; |
| 672 if (!g_interception_enabled) | 670 if (!g_interception_enabled) |
| 673 flags = flags | LOAD_DISABLE_INTERCEPT; | 671 flags = flags | LOAD_DISABLE_INTERCEPT; |
| 674 | 672 |
| 675 if (is_chunked_upload_) | 673 if (is_chunked_upload_) |
| 676 request_->EnableChunkedUpload(); | 674 request_->EnableChunkedUpload(); |
| 677 request_->set_load_flags(flags); | 675 request_->set_load_flags(flags); |
| 678 request_->set_referrer(referrer_); | 676 request_->set_referrer(referrer_); |
| 679 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() ? |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 } | 996 } |
| 999 | 997 |
| 1000 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( | 998 void URLFetcherCore::InformDelegateDownloadDataInDelegateThread( |
| 1001 scoped_ptr<std::string> download_data) { | 999 scoped_ptr<std::string> download_data) { |
| 1002 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); | 1000 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); |
| 1003 if (delegate_) | 1001 if (delegate_) |
| 1004 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); | 1002 delegate_->OnURLFetchDownloadData(fetcher_, download_data.Pass()); |
| 1005 } | 1003 } |
| 1006 | 1004 |
| 1007 } // namespace net | 1005 } // namespace net |
| OLD | NEW |