OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/extensions/extension_l10n_util.h" | 5 #include "chrome/common/extensions/extension_l10n_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return ExtensionMessageBundle::Create(catalogs, error); | 270 return ExtensionMessageBundle::Create(catalogs, error); |
271 } | 271 } |
272 | 272 |
273 bool ShouldSkipValidation(const FilePath& locales_path, | 273 bool ShouldSkipValidation(const FilePath& locales_path, |
274 const FilePath& locale_path, | 274 const FilePath& locale_path, |
275 const std::set<std::string>& all_locales) { | 275 const std::set<std::string>& all_locales) { |
276 // Since we use this string as a key in a DictionaryValue, be paranoid about | 276 // Since we use this string as a key in a DictionaryValue, be paranoid about |
277 // skipping any strings with '.'. This happens sometimes, for example with | 277 // skipping any strings with '.'. This happens sometimes, for example with |
278 // '.svn' directories. | 278 // '.svn' directories. |
279 FilePath relative_path; | 279 FilePath relative_path; |
280 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) | 280 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) { |
281 NOTREACHED(); | 281 NOTREACHED(); |
282 std::wstring subdir(relative_path.ToWStringHack()); | 282 return true; |
283 if (std::find(subdir.begin(), subdir.end(), L'.') != subdir.end()) | 283 } |
| 284 std::string subdir = relative_path.MaybeAsASCII(); |
| 285 if (subdir.empty()) |
| 286 return true; // Non-ASCII. |
| 287 |
| 288 if (std::find(subdir.begin(), subdir.end(), '.') != subdir.end()) |
284 return true; | 289 return true; |
285 | 290 |
286 if (all_locales.find(WideToASCII(subdir)) == all_locales.end()) | 291 if (all_locales.find(subdir) == all_locales.end()) |
287 return true; | 292 return true; |
288 | 293 |
289 return false; | 294 return false; |
290 } | 295 } |
291 | 296 |
292 } // namespace extension_l10n_util | 297 } // namespace extension_l10n_util |
OLD | NEW |