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

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

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot tu upload patchset with added comment Created 8 years, 9 months 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 | Annotate | Revision Log
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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
11 #endif 11 #endif
12 #include <string> 12 #include <string>
13 13
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/i18n/icu_string_conversions.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"
24 #include "base/utf_string_conversions.h" 25 #include "base/utf_string_conversions.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); 156 l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
156 157
157 *generated_name = net::GenerateFileName(download_item.GetURL(), 158 *generated_name = net::GenerateFileName(download_item.GetURL(),
158 download_item.GetContentDisposition(), 159 download_item.GetContentDisposition(),
159 download_item.GetReferrerCharset(), 160 download_item.GetReferrerCharset(),
160 download_item.GetSuggestedFilename(), 161 download_item.GetSuggestedFilename(),
161 download_item.GetMimeType(), 162 download_item.GetMimeType(),
162 default_file_name); 163 default_file_name);
163 } 164 }
164 165
166 void NormalizeFileNameOnChromeOS(FilePath* file_name) {
167 #if defined(OS_CHROMEOS)
168 std::string normalized_str;
169 if (base::ConvertToUtf8AndNormalize(file_name->value(),
170 base::kCodepageUTF8,
171 &normalized_str)) {
172 *file_name = FilePath(normalized_str);
173 }
174 #endif
175 }
176
165 // Download progress painting -------------------------------------------------- 177 // Download progress painting --------------------------------------------------
166 178
167 // Common bitmaps used for download progress animations. We load them once the 179 // Common bitmaps used for download progress animations. We load them once the
168 // first time we do a progress paint, then reuse them as they are always the 180 // first time we do a progress paint, then reuse them as they are always the
169 // same. 181 // same.
170 SkBitmap* g_foreground_16 = NULL; 182 SkBitmap* g_foreground_16 = NULL;
171 SkBitmap* g_background_16 = NULL; 183 SkBitmap* g_background_16 = NULL;
172 SkBitmap* g_foreground_32 = NULL; 184 SkBitmap* g_foreground_32 = NULL;
173 SkBitmap* g_background_32 = NULL; 185 SkBitmap* g_background_32 = NULL;
174 186
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 UMA_HISTOGRAM_ENUMERATION( 645 UMA_HISTOGRAM_ENUMERATION(
634 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 646 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
635 } 647 }
636 648
637 void RecordDownloadSource(ChromeDownloadSource source) { 649 void RecordDownloadSource(ChromeDownloadSource source) {
638 UMA_HISTOGRAM_ENUMERATION( 650 UMA_HISTOGRAM_ENUMERATION(
639 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); 651 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
640 } 652 }
641 653
642 } // namespace download_util 654 } // namespace download_util
OLDNEW
« chrome/browser/download/download_util.h ('K') | « chrome/browser/download/download_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698