| 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> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/json/json_file_value_serializer.h" | 16 #include "base/json/json_file_value_serializer.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/values.h" | 22 #include "base/values.h" |
| 22 #include "extensions/common/constants.h" | 23 #include "extensions/common/constants.h" |
| 23 #include "extensions/common/error_utils.h" | 24 #include "extensions/common/error_utils.h" |
| 24 #include "extensions/common/file_util.h" | 25 #include "extensions/common/file_util.h" |
| 25 #include "extensions/common/manifest_constants.h" | 26 #include "extensions/common/manifest_constants.h" |
| 26 #include "extensions/common/message_bundle.h" | 27 #include "extensions/common/message_bundle.h" |
| 27 #include "third_party/icu/source/common/unicode/uloc.h" | 28 #include "third_party/icu/source/common/unicode/uloc.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 std::string* error) { | 86 std::string* error) { |
| 86 base::ListValue* list = NULL; | 87 base::ListValue* list = NULL; |
| 87 if (!manifest->GetList(key, &list)) | 88 if (!manifest->GetList(key, &list)) |
| 88 return true; | 89 return true; |
| 89 | 90 |
| 90 bool ret = true; | 91 bool ret = true; |
| 91 for (size_t i = 0; i < list->GetSize(); ++i) { | 92 for (size_t i = 0; i < list->GetSize(); ++i) { |
| 92 std::string result; | 93 std::string result; |
| 93 if (list->GetString(i, &result)) { | 94 if (list->GetString(i, &result)) { |
| 94 if (messages.ReplaceMessages(&result, error)) | 95 if (messages.ReplaceMessages(&result, error)) |
| 95 list->Set(i, new base::Value(result)); | 96 list->Set(i, base::MakeUnique<base::Value>(result)); |
| 96 else | 97 else |
| 97 ret = false; | 98 ret = false; |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 return ret; | 101 return ret; |
| 101 } | 102 } |
| 102 | 103 |
| 103 std::string& GetProcessLocale() { | 104 std::string& GetProcessLocale() { |
| 104 CR_DEFINE_STATIC_LOCAL(std::string, locale, ()); | 105 CR_DEFINE_STATIC_LOCAL(std::string, locale, ()); |
| 105 return locale; | 106 return locale; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) | 459 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) |
| 459 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { | 460 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { |
| 460 extension_l10n_util::SetProcessLocale(locale); | 461 extension_l10n_util::SetProcessLocale(locale); |
| 461 } | 462 } |
| 462 | 463 |
| 463 ScopedLocaleForTest::~ScopedLocaleForTest() { | 464 ScopedLocaleForTest::~ScopedLocaleForTest() { |
| 464 extension_l10n_util::SetProcessLocale(locale_); | 465 extension_l10n_util::SetProcessLocale(locale_); |
| 465 } | 466 } |
| 466 | 467 |
| 467 } // namespace extension_l10n_util | 468 } // namespace extension_l10n_util |
| OLD | NEW |