OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 26 matching lines...) Expand all Loading... |
37 GetProcessLocale() = locale; | 37 GetProcessLocale() = locale; |
38 } | 38 } |
39 | 39 |
40 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, | 40 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, |
41 std::string* error) { | 41 std::string* error) { |
42 std::string default_locale; | 42 std::string default_locale; |
43 if (manifest.GetString(keys::kDefaultLocale, &default_locale)) | 43 if (manifest.GetString(keys::kDefaultLocale, &default_locale)) |
44 return default_locale; | 44 return default_locale; |
45 | 45 |
46 *error = errors::kInvalidDefaultLocale; | 46 *error = errors::kInvalidDefaultLocale; |
47 return ""; | 47 return std::string(); |
48 | 48 |
49 } | 49 } |
50 | 50 |
51 bool ShouldRelocalizeManifest(const DictionaryValue* manifest) { | 51 bool ShouldRelocalizeManifest(const DictionaryValue* manifest) { |
52 if (!manifest) | 52 if (!manifest) |
53 return false; | 53 return false; |
54 | 54 |
55 if (!manifest->HasKey(keys::kDefaultLocale)) | 55 if (!manifest->HasKey(keys::kDefaultLocale)) |
56 return false; | 56 return false; |
57 | 57 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) | 393 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) |
394 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { | 394 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { |
395 extension_l10n_util::SetProcessLocale(locale); | 395 extension_l10n_util::SetProcessLocale(locale); |
396 } | 396 } |
397 | 397 |
398 ScopedLocaleForTest::~ScopedLocaleForTest() { | 398 ScopedLocaleForTest::~ScopedLocaleForTest() { |
399 extension_l10n_util::SetProcessLocale(locale_); | 399 extension_l10n_util::SetProcessLocale(locale_); |
400 } | 400 } |
401 | 401 |
402 } // namespace extension_l10n_util | 402 } // namespace extension_l10n_util |
OLD | NEW |