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

Side by Side Diff: net/base/filename_util_icu.cc

Issue 642403002: git cl format the first third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/base/filename_util.h" 5 #include "net/base/filename_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return IsSafePortablePathComponent(path.BaseName()); 43 return IsSafePortablePathComponent(path.BaseName());
44 } 44 }
45 45
46 base::string16 GetSuggestedFilename(const GURL& url, 46 base::string16 GetSuggestedFilename(const GURL& url,
47 const std::string& content_disposition, 47 const std::string& content_disposition,
48 const std::string& referrer_charset, 48 const std::string& referrer_charset,
49 const std::string& suggested_name, 49 const std::string& suggested_name,
50 const std::string& mime_type, 50 const std::string& mime_type,
51 const std::string& default_name) { 51 const std::string& default_name) {
52 return GetSuggestedFilenameImpl( 52 return GetSuggestedFilenameImpl(
53 url, 53 url, content_disposition, referrer_charset, suggested_name, mime_type,
54 content_disposition, 54 default_name, base::Bind(&base::i18n::ReplaceIllegalCharactersInPath));
55 referrer_charset,
56 suggested_name,
57 mime_type,
58 default_name,
59 base::Bind(&base::i18n::ReplaceIllegalCharactersInPath));
60 } 55 }
61 56
62 base::FilePath GenerateFileName(const GURL& url, 57 base::FilePath GenerateFileName(const GURL& url,
63 const std::string& content_disposition, 58 const std::string& content_disposition,
64 const std::string& referrer_charset, 59 const std::string& referrer_charset,
65 const std::string& suggested_name, 60 const std::string& suggested_name,
66 const std::string& mime_type, 61 const std::string& mime_type,
67 const std::string& default_file_name) { 62 const std::string& default_file_name) {
68 base::FilePath generated_name(GenerateFileNameImpl( 63 base::FilePath generated_name(GenerateFileNameImpl(
69 url, 64 url, content_disposition, referrer_charset, suggested_name, mime_type,
70 content_disposition,
71 referrer_charset,
72 suggested_name,
73 mime_type,
74 default_file_name, 65 default_file_name,
75 base::Bind(&base::i18n::ReplaceIllegalCharactersInPath))); 66 base::Bind(&base::i18n::ReplaceIllegalCharactersInPath)));
76 67
77 #if defined(OS_CHROMEOS) 68 #if defined(OS_CHROMEOS)
78 // When doing file manager operations on ChromeOS, the file paths get 69 // When doing file manager operations on ChromeOS, the file paths get
79 // normalized in WebKit layer, so let's ensure downloaded files have 70 // normalized in WebKit layer, so let's ensure downloaded files have
80 // normalized names. Otherwise, we won't be able to handle files with NFD 71 // normalized names. Otherwise, we won't be able to handle files with NFD
81 // utf8 encoded characters in name. 72 // utf8 encoded characters in name.
82 base::i18n::NormalizeFileNameEncoding(&generated_name); 73 base::i18n::NormalizeFileNameEncoding(&generated_name);
83 #endif 74 #endif
84 75
85 DCHECK(!generated_name.empty()); 76 DCHECK(!generated_name.empty());
86 77
87 return generated_name; 78 return generated_name;
88 } 79 }
89 80
90 } // namespace net 81 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698