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 "extensions/common/extension_l10n_util.h" | 5 #include "extensions/common/extension_l10n_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | |
10 #include <set> | 9 #include <set> |
11 #include <string> | 10 #include <string> |
12 #include <vector> | 11 #include <vector> |
13 | 12 |
14 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
15 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
16 #include "base/json/json_file_value_serializer.h" | 15 #include "base/json/json_file_value_serializer.h" |
17 #include "base/logging.h" | 16 #include "base/logging.h" |
18 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/stl_util.h" |
19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "extensions/common/constants.h" | 23 #include "extensions/common/constants.h" |
24 #include "extensions/common/error_utils.h" | 24 #include "extensions/common/error_utils.h" |
25 #include "extensions/common/file_util.h" | 25 #include "extensions/common/file_util.h" |
26 #include "extensions/common/manifest_constants.h" | 26 #include "extensions/common/manifest_constants.h" |
27 #include "extensions/common/message_bundle.h" | 27 #include "extensions/common/message_bundle.h" |
28 #include "third_party/icu/source/common/unicode/uloc.h" | 28 #include "third_party/icu/source/common/unicode/uloc.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // '.svn' directories. | 437 // '.svn' directories. |
438 base::FilePath relative_path; | 438 base::FilePath relative_path; |
439 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) { | 439 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) { |
440 NOTREACHED(); | 440 NOTREACHED(); |
441 return true; | 441 return true; |
442 } | 442 } |
443 std::string subdir = relative_path.MaybeAsASCII(); | 443 std::string subdir = relative_path.MaybeAsASCII(); |
444 if (subdir.empty()) | 444 if (subdir.empty()) |
445 return true; // Non-ASCII. | 445 return true; // Non-ASCII. |
446 | 446 |
447 if (std::find(subdir.begin(), subdir.end(), '.') != subdir.end()) | 447 if (base::ContainsValue(subdir, '.')) |
448 return true; | 448 return true; |
449 | 449 |
450 if (all_locales.find(subdir) == all_locales.end()) | 450 if (all_locales.find(subdir) == all_locales.end()) |
451 return true; | 451 return true; |
452 | 452 |
453 return false; | 453 return false; |
454 } | 454 } |
455 | 455 |
456 ScopedLocaleForTest::ScopedLocaleForTest() | 456 ScopedLocaleForTest::ScopedLocaleForTest() |
457 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) {} | 457 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) {} |
458 | 458 |
459 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) | 459 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) |
460 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { | 460 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { |
461 extension_l10n_util::SetProcessLocale(locale); | 461 extension_l10n_util::SetProcessLocale(locale); |
462 } | 462 } |
463 | 463 |
464 ScopedLocaleForTest::~ScopedLocaleForTest() { | 464 ScopedLocaleForTest::~ScopedLocaleForTest() { |
465 extension_l10n_util::SetProcessLocale(locale_); | 465 extension_l10n_util::SetProcessLocale(locale_); |
466 } | 466 } |
467 | 467 |
468 } // namespace extension_l10n_util | 468 } // namespace extension_l10n_util |
OLD | NEW |