| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Consider downloads 'dangerous' if they go to the home directory on Linux and | 159 // Consider downloads 'dangerous' if they go to the home directory on Linux and |
| 160 // to the desktop on any platform. | 160 // to the desktop on any platform. |
| 161 bool DownloadPathIsDangerous(const FilePath& download_path) { | 161 bool DownloadPathIsDangerous(const FilePath& download_path) { |
| 162 #if defined(OS_LINUX) | 162 #if defined(OS_LINUX) |
| 163 FilePath home_dir = file_util::GetHomeDir(); | 163 FilePath home_dir = file_util::GetHomeDir(); |
| 164 if (download_path == home_dir) { | 164 if (download_path == home_dir) { |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 #endif | 167 #endif |
| 168 | 168 |
| 169 #if defined(OS_ANDROID) |
| 170 // Android does not have a desktop dir. |
| 171 return false; |
| 172 #else |
| 169 FilePath desktop_dir; | 173 FilePath desktop_dir; |
| 170 if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { | 174 if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { |
| 171 NOTREACHED(); | 175 NOTREACHED(); |
| 172 return false; | 176 return false; |
| 173 } | 177 } |
| 174 return (download_path == desktop_dir); | 178 return (download_path == desktop_dir); |
| 179 #endif |
| 175 } | 180 } |
| 176 | 181 |
| 177 // Download progress painting -------------------------------------------------- | 182 // Download progress painting -------------------------------------------------- |
| 178 | 183 |
| 179 // Common images used for download progress animations. We load them once the | 184 // Common images used for download progress animations. We load them once the |
| 180 // first time we do a progress paint, then reuse them as they are always the | 185 // first time we do a progress paint, then reuse them as they are always the |
| 181 // same. | 186 // same. |
| 182 gfx::ImageSkia* g_foreground_16 = NULL; | 187 gfx::ImageSkia* g_foreground_16 = NULL; |
| 183 gfx::ImageSkia* g_background_16 = NULL; | 188 gfx::ImageSkia* g_background_16 = NULL; |
| 184 gfx::ImageSkia* g_foreground_32 = NULL; | 189 gfx::ImageSkia* g_foreground_32 = NULL; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 UMA_HISTOGRAM_ENUMERATION( | 639 UMA_HISTOGRAM_ENUMERATION( |
| 635 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 640 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 636 } | 641 } |
| 637 | 642 |
| 638 void RecordDownloadSource(ChromeDownloadSource source) { | 643 void RecordDownloadSource(ChromeDownloadSource source) { |
| 639 UMA_HISTOGRAM_ENUMERATION( | 644 UMA_HISTOGRAM_ENUMERATION( |
| 640 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 645 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 641 } | 646 } |
| 642 | 647 |
| 643 } // namespace download_util | 648 } // namespace download_util |
| OLD | NEW |