OLD | NEW |
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 std::string filename_lower = base::ToLowerASCII(base::WideToUTF8(filename)); | 167 std::string filename_lower = base::ToLowerASCII(base::WideToUTF8(filename)); |
168 #elif defined(OS_POSIX) | 168 #elif defined(OS_POSIX) |
169 std::string filename_lower = base::ToLowerASCII(filename); | 169 std::string filename_lower = base::ToLowerASCII(filename); |
170 #endif | 170 #endif |
171 | 171 |
172 for (size_t i = 0; i < arraysize(known_devices); ++i) { | 172 for (size_t i = 0; i < arraysize(known_devices); ++i) { |
173 // Exact match. | 173 // Exact match. |
174 if (filename_lower == known_devices[i]) | 174 if (filename_lower == known_devices[i]) |
175 return true; | 175 return true; |
176 // Starts with "DEVICE.". | 176 // Starts with "DEVICE.". |
177 if (base::StartsWith(filename_lower, std::string(known_devices[i]) + ".", | 177 if (filename_lower.find(std::string(known_devices[i]) + ".") == 0) |
178 base::CompareCase::SENSITIVE)) { | |
179 return true; | 178 return true; |
180 } | |
181 } | 179 } |
182 | 180 |
183 static const char* const magic_names[] = { | 181 static const char* const magic_names[] = { |
184 // These file names are used by the "Customize folder" feature of the | 182 // These file names are used by the "Customize folder" feature of the |
185 // shell. | 183 // shell. |
186 "desktop.ini", | 184 "desktop.ini", |
187 "thumbs.db", | 185 "thumbs.db", |
188 }; | 186 }; |
189 | 187 |
190 for (size_t i = 0; i < arraysize(magic_names); ++i) { | 188 for (size_t i = 0; i < arraysize(magic_names); ++i) { |
191 if (filename_lower == magic_names[i]) | 189 if (filename_lower == magic_names[i]) |
192 return true; | 190 return true; |
193 } | 191 } |
194 | 192 |
195 return false; | 193 return false; |
196 } | 194 } |
197 | 195 |
198 } // namespace net | 196 } // namespace net |
OLD | NEW |