| 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 |
| 11 #include <cmath> | 11 #include <cmath> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/base_paths.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 16 #include "base/i18n/time_formatting.h" | 17 #include "base/i18n/time_formatting.h" |
| 17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/string16.h" | 21 #include "base/string16.h" |
| 21 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 22 #include "base/sys_string_conversions.h" | 23 #include "base/sys_string_conversions.h" |
| 23 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (download_path == home_dir) { | 132 if (download_path == home_dir) { |
| 132 return true; | 133 return true; |
| 133 } | 134 } |
| 134 #endif | 135 #endif |
| 135 | 136 |
| 136 #if defined(OS_ANDROID) | 137 #if defined(OS_ANDROID) |
| 137 // Android does not have a desktop dir. | 138 // Android does not have a desktop dir. |
| 138 return false; | 139 return false; |
| 139 #else | 140 #else |
| 140 FilePath desktop_dir; | 141 FilePath desktop_dir; |
| 141 if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { | 142 if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_dir)) { |
| 142 NOTREACHED(); | 143 NOTREACHED(); |
| 143 return false; | 144 return false; |
| 144 } | 145 } |
| 145 return (download_path == desktop_dir); | 146 return (download_path == desktop_dir); |
| 146 #endif | 147 #endif |
| 147 } | 148 } |
| 148 | 149 |
| 149 // Download progress painting -------------------------------------------------- | 150 // Download progress painting -------------------------------------------------- |
| 150 | 151 |
| 151 // Common images used for download progress animations. We load them once the | 152 // Common images used for download progress animations. We load them once the |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 UMA_HISTOGRAM_ENUMERATION( | 479 UMA_HISTOGRAM_ENUMERATION( |
| 479 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 480 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 480 } | 481 } |
| 481 | 482 |
| 482 void RecordDownloadSource(ChromeDownloadSource source) { | 483 void RecordDownloadSource(ChromeDownloadSource source) { |
| 483 UMA_HISTOGRAM_ENUMERATION( | 484 UMA_HISTOGRAM_ENUMERATION( |
| 484 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 485 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 485 } | 486 } |
| 486 | 487 |
| 487 } // namespace download_util | 488 } // namespace download_util |
| OLD | NEW |