| 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 bool IsSavableURL(const GURL& url) { | |
| 463 for (int i = 0; content::GetSavableSchemes()[i] != NULL; ++i) { | |
| 464 if (url.SchemeIs(content::GetSavableSchemes()[i])) { | |
| 465 return true; | |
| 466 } | |
| 467 } | |
| 468 return false; | |
| 469 } | |
| 470 | |
| 471 void RecordShelfClose(int size, int in_progress, bool autoclose) { | 462 void RecordShelfClose(int size, int in_progress, bool autoclose) { |
| 472 static const int kMaxShelfSize = 16; | 463 static const int kMaxShelfSize = 16; |
| 473 if (autoclose) { | 464 if (autoclose) { |
| 474 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnAutoClose", | 465 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnAutoClose", |
| 475 size, | 466 size, |
| 476 kMaxShelfSize); | 467 kMaxShelfSize); |
| 477 UMA_HISTOGRAM_ENUMERATION("Download.ShelfInProgressSizeOnAutoClose", | 468 UMA_HISTOGRAM_ENUMERATION("Download.ShelfInProgressSizeOnAutoClose", |
| 478 in_progress, | 469 in_progress, |
| 479 kMaxShelfSize); | 470 kMaxShelfSize); |
| 480 } else { | 471 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 491 UMA_HISTOGRAM_ENUMERATION( | 482 UMA_HISTOGRAM_ENUMERATION( |
| 492 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 483 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 493 } | 484 } |
| 494 | 485 |
| 495 void RecordDownloadSource(ChromeDownloadSource source) { | 486 void RecordDownloadSource(ChromeDownloadSource source) { |
| 496 UMA_HISTOGRAM_ENUMERATION( | 487 UMA_HISTOGRAM_ENUMERATION( |
| 497 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 488 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 498 } | 489 } |
| 499 | 490 |
| 500 } // namespace download_util | 491 } // namespace download_util |
| OLD | NEW |