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 #include <utility> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
11 #include "components/update_client/utils.h" | 12 #include "components/update_client/utils.h" |
12 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
13 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 namespace update_client { | 17 namespace update_client { |
17 | 18 |
18 UrlFetcherDownloader::UrlFetcherDownloader( | 19 UrlFetcherDownloader::UrlFetcherDownloader( |
19 scoped_ptr<CrxDownloader> successor, | 20 scoped_ptr<CrxDownloader> successor, |
20 net::URLRequestContextGetter* context_getter, | 21 net::URLRequestContextGetter* context_getter, |
21 scoped_refptr<base::SequencedTaskRunner> task_runner) | 22 scoped_refptr<base::SequencedTaskRunner> task_runner) |
22 : CrxDownloader(successor.Pass()), | 23 : CrxDownloader(std::move(successor)), |
23 context_getter_(context_getter), | 24 context_getter_(context_getter), |
24 task_runner_(task_runner), | 25 task_runner_(task_runner), |
25 downloaded_bytes_(-1), | 26 downloaded_bytes_(-1), |
26 total_bytes_(-1) { | 27 total_bytes_(-1) {} |
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_ = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); | 36 url_fetcher_ = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); |
37 url_fetcher_->SetRequestContext(context_getter_); | 37 url_fetcher_->SetRequestContext(context_getter_); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 total_bytes_ = total; | 99 total_bytes_ = total; |
100 | 100 |
101 Result result; | 101 Result result; |
102 result.downloaded_bytes = downloaded_bytes_; | 102 result.downloaded_bytes = downloaded_bytes_; |
103 result.total_bytes = total_bytes_; | 103 result.total_bytes = total_bytes_; |
104 | 104 |
105 OnDownloadProgress(result); | 105 OnDownloadProgress(result); |
106 } | 106 } |
107 | 107 |
108 } // namespace update_client | 108 } // namespace update_client |
OLD | NEW |