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/component_updater/url_fetcher_downloader.h" | 5 #include "components/component_updater/url_fetcher_downloader.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
9 #include "components/component_updater/component_updater_utils.h" | 11 #include "components/component_updater/component_updater_utils.h" |
10 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
11 #include "net/url_request/url_fetcher.h" | 13 #include "net/url_request/url_fetcher.h" |
12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
13 | 15 |
14 namespace component_updater { | 16 namespace component_updater { |
15 | 17 |
16 UrlFetcherDownloader::UrlFetcherDownloader( | 18 UrlFetcherDownloader::UrlFetcherDownloader( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::FilePath local_path_; | 85 base::FilePath local_path_; |
84 source->GetResponseAsFilePath(false, &local_path_); | 86 source->GetResponseAsFilePath(false, &local_path_); |
85 VLOG(1) << "Downloaded " << downloaded_bytes_ << " bytes in " | 87 VLOG(1) << "Downloaded " << downloaded_bytes_ << " bytes in " |
86 << download_time.InMilliseconds() << "ms from " | 88 << download_time.InMilliseconds() << "ms from " |
87 << source->GetURL().spec() << " to " << local_path_.value(); | 89 << source->GetURL().spec() << " to " << local_path_.value(); |
88 CrxDownloader::OnDownloadComplete(is_handled, result, download_metrics); | 90 CrxDownloader::OnDownloadComplete(is_handled, result, download_metrics); |
89 } | 91 } |
90 | 92 |
91 void UrlFetcherDownloader::OnURLFetchDownloadProgress( | 93 void UrlFetcherDownloader::OnURLFetchDownloadProgress( |
92 const net::URLFetcher* source, | 94 const net::URLFetcher* source, |
93 int64 current, | 95 int64_t current, |
94 int64 total) { | 96 int64_t total) { |
95 DCHECK(thread_checker_.CalledOnValidThread()); | 97 DCHECK(thread_checker_.CalledOnValidThread()); |
96 | 98 |
97 downloaded_bytes_ = current; | 99 downloaded_bytes_ = current; |
98 total_bytes_ = total; | 100 total_bytes_ = total; |
99 | 101 |
100 Result result; | 102 Result result; |
101 result.downloaded_bytes = downloaded_bytes_; | 103 result.downloaded_bytes = downloaded_bytes_; |
102 result.total_bytes = total_bytes_; | 104 result.total_bytes = total_bytes_; |
103 | 105 |
104 OnDownloadProgress(result); | 106 OnDownloadProgress(result); |
105 } | 107 } |
106 | 108 |
107 } // namespace component_updater | 109 } // namespace component_updater |
OLD | NEW |