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/crx_downloader.h" | 5 #include "components/update_client/crx_downloader.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return; | 145 return; |
146 | 146 |
147 progress_callback_.Run(result); | 147 progress_callback_.Run(result); |
148 } | 148 } |
149 | 149 |
150 // The function mutates the values of the parameters |result| and | 150 // The function mutates the values of the parameters |result| and |
151 // |download_metrics|. | 151 // |download_metrics|. |
152 void CrxDownloader::VerifyResponse(bool is_handled, | 152 void CrxDownloader::VerifyResponse(bool is_handled, |
153 Result result, | 153 Result result, |
154 DownloadMetrics download_metrics) { | 154 DownloadMetrics download_metrics) { |
155 DCHECK(task_runner()->RunsTasksOnCurrentThread()); | 155 DCHECK(task_runner()->RunsTasksInCurrentSequence()); |
156 DCHECK_EQ(0, result.error); | 156 DCHECK_EQ(0, result.error); |
157 DCHECK_EQ(0, download_metrics.error); | 157 DCHECK_EQ(0, download_metrics.error); |
158 DCHECK(is_handled); | 158 DCHECK(is_handled); |
159 | 159 |
160 if (VerifyFileHash256(result.response, expected_hash_)) { | 160 if (VerifyFileHash256(result.response, expected_hash_)) { |
161 download_metrics_.push_back(download_metrics); | 161 download_metrics_.push_back(download_metrics); |
162 main_task_runner()->PostTask(FROM_HERE, | 162 main_task_runner()->PostTask(FROM_HERE, |
163 base::Bind(download_callback_, result)); | 163 base::Bind(download_callback_, result)); |
164 return; | 164 return; |
165 } | 165 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return; | 211 return; |
212 } | 212 } |
213 | 213 |
214 // The download ends here since there is no url nor downloader to handle this | 214 // The download ends here since there is no url nor downloader to handle this |
215 // download request further. | 215 // download request further. |
216 main_task_runner()->PostTask(FROM_HERE, | 216 main_task_runner()->PostTask(FROM_HERE, |
217 base::Bind(download_callback_, result)); | 217 base::Bind(download_callback_, result)); |
218 } | 218 } |
219 | 219 |
220 } // namespace update_client | 220 } // namespace update_client |
OLD | NEW |