| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/update_client/url_fetcher_downloader.h" | 5 #include "components/update_client/url_fetcher_downloader.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 total_bytes_(-1) { | 26 total_bytes_(-1) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 UrlFetcherDownloader::~UrlFetcherDownloader() { | 29 UrlFetcherDownloader::~UrlFetcherDownloader() { |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); | 30 DCHECK(thread_checker_.CalledOnValidThread()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void UrlFetcherDownloader::DoStartDownload(const GURL& url) { | 33 void UrlFetcherDownloader::DoStartDownload(const GURL& url) { |
| 34 DCHECK(thread_checker_.CalledOnValidThread()); | 34 DCHECK(thread_checker_.CalledOnValidThread()); |
| 35 | 35 |
| 36 url_fetcher_.reset( | 36 url_fetcher_ = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); |
| 37 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this)); | |
| 38 url_fetcher_->SetRequestContext(context_getter_); | 37 url_fetcher_->SetRequestContext(context_getter_); |
| 39 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 38 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 40 net::LOAD_DO_NOT_SAVE_COOKIES | | 39 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 41 net::LOAD_DISABLE_CACHE); | 40 net::LOAD_DISABLE_CACHE); |
| 42 url_fetcher_->SetAutomaticallyRetryOn5xx(false); | 41 url_fetcher_->SetAutomaticallyRetryOn5xx(false); |
| 43 url_fetcher_->SaveResponseToTemporaryFile(task_runner_); | 42 url_fetcher_->SaveResponseToTemporaryFile(task_runner_); |
| 44 | 43 |
| 45 VLOG(1) << "Starting background download: " << url.spec(); | 44 VLOG(1) << "Starting background download: " << url.spec(); |
| 46 url_fetcher_->Start(); | 45 url_fetcher_->Start(); |
| 47 | 46 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 total_bytes_ = total; | 99 total_bytes_ = total; |
| 101 | 100 |
| 102 Result result; | 101 Result result; |
| 103 result.downloaded_bytes = downloaded_bytes_; | 102 result.downloaded_bytes = downloaded_bytes_; |
| 104 result.total_bytes = total_bytes_; | 103 result.total_bytes = total_bytes_; |
| 105 | 104 |
| 106 OnDownloadProgress(result); | 105 OnDownloadProgress(result); |
| 107 } | 106 } |
| 108 | 107 |
| 109 } // namespace update_client | 108 } // namespace update_client |
| OLD | NEW |