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

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

Issue 1444253003: Use If-Range instead of If-Match/If-Unmodified-Since for partial requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it obvious that the interrupt reason is obsolete. Created 5 years, 1 month 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM: 167 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM:
168 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_SERVER_CERT_PROBLEM; 168 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_SERVER_CERT_PROBLEM;
169 break; 169 break;
170 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN: 170 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN:
171 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_FORBIDDEN; 171 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_FORBIDDEN;
172 break; 172 break;
173 case content::DOWNLOAD_INTERRUPT_REASON_NONE: 173 case content::DOWNLOAD_INTERRUPT_REASON_NONE:
174 NOTREACHED(); 174 NOTREACHED();
175 // fallthrough 175 // fallthrough
176 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE: 176 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
177 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
178 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: 177 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
179 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 178 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
180 } 179 }
181 180
182 return l10n_util::GetStringUTF16(string_id); 181 return l10n_util::GetStringUTF16(string_id);
183 } 182 }
184 183
185 base::string16 InterruptReasonMessage(int reason) { 184 base::string16 InterruptReasonMessage(int reason) {
186 int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 185 int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
187 base::string16 status_text; 186 base::string16 status_text;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM: 247 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM:
249 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_SERVER_CERT_PROBLEM; 248 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_SERVER_CERT_PROBLEM;
250 break; 249 break;
251 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN: 250 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN:
252 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_FORBIDDEN; 251 string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_FORBIDDEN;
253 break; 252 break;
254 case content::DOWNLOAD_INTERRUPT_REASON_NONE: 253 case content::DOWNLOAD_INTERRUPT_REASON_NONE:
255 NOTREACHED(); 254 NOTREACHED();
256 // fallthrough 255 // fallthrough
257 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE: 256 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
258 case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
259 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: 257 case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
260 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS; 258 string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
261 } 259 }
262 260
263 status_text = l10n_util::GetStringUTF16(string_id); 261 status_text = l10n_util::GetStringUTF16(string_id);
264 262
265 return status_text; 263 return status_text;
266 } 264 }
267 265
268 } // namespace 266 } // namespace
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 if (!download_service) 711 if (!download_service)
714 return; 712 return;
715 713
716 ChromeDownloadManagerDelegate* delegate = 714 ChromeDownloadManagerDelegate* delegate =
717 download_service->GetDownloadManagerDelegate(); 715 download_service->GetDownloadManagerDelegate();
718 if (!delegate) 716 if (!delegate)
719 return; 717 return;
720 delegate->OpenDownloadUsingPlatformHandler(download_); 718 delegate->OpenDownloadUsingPlatformHandler(download_);
721 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); 719 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM);
722 } 720 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_item_model_unittest.cc » ('j') | chrome/common/extensions/api/downloads.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698