Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: chrome/browser/download/download_item_model.cc

Issue 1751603002: [Downloads] Rework how hashes are calculated for download files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/download/download_item_model.h" 5 #include "chrome/browser/download/download_item_model.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 break; 172 break;
173 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE: 173 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE:
174 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_UNREACHABLE; 174 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_UNREACHABLE;
175 break; 175 break;
176 176
177 case content::DOWNLOAD_INTERRUPT_REASON_NONE: 177 case content::DOWNLOAD_INTERRUPT_REASON_NONE:
178 NOTREACHED(); 178 NOTREACHED();
179 // fallthrough 179 // fallthrough
180 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE: 180 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
181 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: 181 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
182 case content::DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH:
asanka 2016/03/04 22:08:06 svaldez: note here and elsewhere that HASH_MISMATC
182 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 183 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
183 } 184 }
184 185
185 return l10n_util::GetStringUTF16(string_id); 186 return l10n_util::GetStringUTF16(string_id);
186 } 187 }
187 188
188 base::string16 InterruptReasonMessage(content::DownloadInterruptReason reason) { 189 base::string16 InterruptReasonMessage(content::DownloadInterruptReason reason) {
189 int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 190 int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
190 base::string16 status_text; 191 base::string16 status_text;
191 192
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_FORBIDDEN; 256 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_FORBIDDEN;
256 break; 257 break;
257 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE: 258 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE:
258 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_UNREACHABLE; 259 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_UNREACHABLE;
259 break; 260 break;
260 case content::DOWNLOAD_INTERRUPT_REASON_NONE: 261 case content::DOWNLOAD_INTERRUPT_REASON_NONE:
261 NOTREACHED(); 262 NOTREACHED();
262 // fallthrough 263 // fallthrough
263 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE: 264 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
264 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: 265 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
266 case content::DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH:
265 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 267 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
266 } 268 }
267 269
268 status_text = l10n_util::GetStringUTF16(string_id); 270 status_text = l10n_util::GetStringUTF16(string_id);
269 271
270 return status_text; 272 return status_text;
271 } 273 }
272 274
273 } // namespace 275 } // namespace
274 276
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 if (!download_service) 721 if (!download_service)
720 return; 722 return;
721 723
722 ChromeDownloadManagerDelegate* delegate = 724 ChromeDownloadManagerDelegate* delegate =
723 download_service->GetDownloadManagerDelegate(); 725 download_service->GetDownloadManagerDelegate();
724 if (!delegate) 726 if (!delegate)
725 return; 727 return;
726 delegate->OpenDownloadUsingPlatformHandler(download_); 728 delegate->OpenDownloadUsingPlatformHandler(download_);
727 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); 729 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM);
728 } 730 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698