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

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

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « net/base/data_url.cc ('k') | net/base/filename_util_internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool IsReservedNameOnWindows(const base::FilePath::StringType& filename) { 156 bool IsReservedNameOnWindows(const base::FilePath::StringType& filename) {
157 // This list is taken from the MSDN article "Naming a file" 157 // This list is taken from the MSDN article "Naming a file"
158 // http://msdn2.microsoft.com/en-us/library/aa365247(VS.85).aspx 158 // http://msdn2.microsoft.com/en-us/library/aa365247(VS.85).aspx
159 // I also added clock$ because GetSaveFileName seems to consider it as a 159 // I also added clock$ because GetSaveFileName seems to consider it as a
160 // reserved name too. 160 // reserved name too.
161 static const char* const known_devices[] = { 161 static const char* const known_devices[] = {
162 "con", "prn", "aux", "nul", "com1", "com2", "com3", "com4", 162 "con", "prn", "aux", "nul", "com1", "com2", "com3", "com4",
163 "com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2", "lpt3", 163 "com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2", "lpt3",
164 "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "clock$"}; 164 "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "clock$"};
165 #if defined(OS_WIN) 165 #if defined(OS_WIN)
166 std::string filename_lower = 166 std::string filename_lower = base::ToLowerASCII(base::WideToUTF8(filename));
167 base::StringToLowerASCII(base::WideToUTF8(filename));
168 #elif defined(OS_POSIX) 167 #elif defined(OS_POSIX)
169 std::string filename_lower = base::StringToLowerASCII(filename); 168 std::string filename_lower = base::ToLowerASCII(filename);
170 #endif 169 #endif
171 170
172 for (size_t i = 0; i < arraysize(known_devices); ++i) { 171 for (size_t i = 0; i < arraysize(known_devices); ++i) {
173 // Exact match. 172 // Exact match.
174 if (filename_lower == known_devices[i]) 173 if (filename_lower == known_devices[i])
175 return true; 174 return true;
176 // Starts with "DEVICE.". 175 // Starts with "DEVICE.".
177 if (filename_lower.find(std::string(known_devices[i]) + ".") == 0) 176 if (filename_lower.find(std::string(known_devices[i]) + ".") == 0)
178 return true; 177 return true;
179 } 178 }
180 179
181 static const char* const magic_names[] = { 180 static const char* const magic_names[] = {
182 // These file names are used by the "Customize folder" feature of the 181 // These file names are used by the "Customize folder" feature of the
183 // shell. 182 // shell.
184 "desktop.ini", 183 "desktop.ini",
185 "thumbs.db", 184 "thumbs.db",
186 }; 185 };
187 186
188 for (size_t i = 0; i < arraysize(magic_names); ++i) { 187 for (size_t i = 0; i < arraysize(magic_names); ++i) {
189 if (filename_lower == magic_names[i]) 188 if (filename_lower == magic_names[i])
190 return true; 189 return true;
191 } 190 }
192 191
193 return false; 192 return false;
194 } 193 }
195 194
196 } // namespace net 195 } // namespace net
OLDNEW
« no previous file with comments | « net/base/data_url.cc ('k') | net/base/filename_util_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698