| OLD | NEW |
| 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 8 | 8 |
| 9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
| 10 | 10 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 if (time_remaining.empty()) { | 453 if (time_remaining.empty()) { |
| 454 base::i18n::AdjustStringForLocaleDirection(&amount); | 454 base::i18n::AdjustStringForLocaleDirection(&amount); |
| 455 return l10n_util::GetStringFUTF16( | 455 return l10n_util::GetStringFUTF16( |
| 456 IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount); | 456 IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount); |
| 457 } | 457 } |
| 458 return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, | 458 return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, |
| 459 speed_text, amount, time_remaining); | 459 speed_text, amount, time_remaining); |
| 460 } | 460 } |
| 461 | 461 |
| 462 base::FilePath GetCrDownloadPath(const base::FilePath& suggested_path) { | |
| 463 return base::FilePath(suggested_path.value() + | |
| 464 FILE_PATH_LITERAL(".crdownload")); | |
| 465 } | |
| 466 | |
| 467 bool IsSavableURL(const GURL& url) { | 462 bool IsSavableURL(const GURL& url) { |
| 468 for (int i = 0; content::GetSavableSchemes()[i] != NULL; ++i) { | 463 for (int i = 0; content::GetSavableSchemes()[i] != NULL; ++i) { |
| 469 if (url.SchemeIs(content::GetSavableSchemes()[i])) { | 464 if (url.SchemeIs(content::GetSavableSchemes()[i])) { |
| 470 return true; | 465 return true; |
| 471 } | 466 } |
| 472 } | 467 } |
| 473 return false; | 468 return false; |
| 474 } | 469 } |
| 475 | 470 |
| 476 void RecordShelfClose(int size, int in_progress, bool autoclose) { | 471 void RecordShelfClose(int size, int in_progress, bool autoclose) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 496 UMA_HISTOGRAM_ENUMERATION( | 491 UMA_HISTOGRAM_ENUMERATION( |
| 497 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 492 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 498 } | 493 } |
| 499 | 494 |
| 500 void RecordDownloadSource(ChromeDownloadSource source) { | 495 void RecordDownloadSource(ChromeDownloadSource source) { |
| 501 UMA_HISTOGRAM_ENUMERATION( | 496 UMA_HISTOGRAM_ENUMERATION( |
| 502 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 497 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 503 } | 498 } |
| 504 | 499 |
| 505 } // namespace download_util | 500 } // namespace download_util |
| OLD | NEW |