Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: chrome/common/extensions/extension_l10n_util.cc

Issue 23744004: Move the rest of extension_manifest_constants to top-level extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/json/json_file_value_serializer.h" 14 #include "base/json/json_file_value_serializer.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/common/extensions/extension_file_util.h" 19 #include "chrome/common/extensions/extension_file_util.h"
20 #include "chrome/common/extensions/extension_manifest_constants.h"
21 #include "chrome/common/extensions/message_bundle.h" 20 #include "chrome/common/extensions/message_bundle.h"
22 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
23 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
23 #include "extensions/common/manifest_constants.h"
24 #include "third_party/icu/source/common/unicode/uloc.h" 24 #include "third_party/icu/source/common/unicode/uloc.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 26
27 namespace errors = extension_manifest_errors; 27 namespace errors = extensions::manifest_errors;
28 namespace keys = extensions::manifest_keys; 28 namespace keys = extensions::manifest_keys;
29 29
30 static std::string& GetProcessLocale() { 30 static std::string& GetProcessLocale() {
31 CR_DEFINE_STATIC_LOCAL(std::string, locale, ()); 31 CR_DEFINE_STATIC_LOCAL(std::string, locale, ());
32 return locale; 32 return locale;
33 } 33 }
34 34
35 namespace extension_l10n_util { 35 namespace extension_l10n_util {
36 36
37 void SetProcessLocale(const std::string& locale) { 37 void SetProcessLocale(const std::string& locale) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (!AddLocale(chrome_locales, 284 if (!AddLocale(chrome_locales,
285 locale_folder, 285 locale_folder,
286 locale_name, 286 locale_name,
287 valid_locales, 287 valid_locales,
288 error)) { 288 error)) {
289 return false; 289 return false;
290 } 290 }
291 } 291 }
292 292
293 if (valid_locales->empty()) { 293 if (valid_locales->empty()) {
294 *error = extension_manifest_errors::kLocalesNoValidLocaleNamesListed; 294 *error = extensions::manifest_errors::kLocalesNoValidLocaleNamesListed;
295 return false; 295 return false;
296 } 296 }
297 297
298 return true; 298 return true;
299 } 299 }
300 300
301 // Loads contents of the messages file for given locale. If file is not found, 301 // Loads contents of the messages file for given locale. If file is not found,
302 // or there was parsing error we return NULL and set |error|. 302 // or there was parsing error we return NULL and set |error|.
303 // Caller owns the returned object. 303 // Caller owns the returned object.
304 static base::DictionaryValue* LoadMessageFile( 304 static base::DictionaryValue* LoadMessageFile(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) 379 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale)
380 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { 380 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) {
381 extension_l10n_util::SetProcessLocale(locale); 381 extension_l10n_util::SetProcessLocale(locale);
382 } 382 }
383 383
384 ScopedLocaleForTest::~ScopedLocaleForTest() { 384 ScopedLocaleForTest::~ScopedLocaleForTest() {
385 extension_l10n_util::SetProcessLocale(locale_); 385 extension_l10n_util::SetProcessLocale(locale_);
386 } 386 }
387 387
388 } // namespace extension_l10n_util 388 } // namespace extension_l10n_util
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_file_util.cc ('k') | chrome/common/extensions/extension_l10n_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698