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

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

Issue 10787002: Moved ExtensionMessage* into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file declares extension specific l10n utils. 5 // This file declares extension specific l10n utils.
6 6
7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 class ExtensionMessageBundle;
15 class FilePath; 14 class FilePath;
16 15
17 namespace base { 16 namespace base {
18 class DictionaryValue; 17 class DictionaryValue;
19 } 18 }
20 19
21 namespace extensions { 20 namespace extensions {
22 struct ExtensionInfo; 21 struct ExtensionInfo;
22 class MessageBundle;
23 } 23 }
24 24
25 namespace extension_l10n_util { 25 namespace extension_l10n_util {
26 26
27 // Set the locale for this process to a fixed value, rather than using the 27 // Set the locale for this process to a fixed value, rather than using the
28 // normal file-based lookup mechanisms. This is used to set the locale inside 28 // normal file-based lookup mechanisms. This is used to set the locale inside
29 // the sandboxed utility process, where file reading is not allowed. 29 // the sandboxed utility process, where file reading is not allowed.
30 void SetProcessLocale(const std::string& locale); 30 void SetProcessLocale(const std::string& locale);
31 31
32 // Returns default locale in form "en-US" or "sr" or empty string if 32 // Returns default locale in form "en-US" or "sr" or empty string if
33 // "default_locale" section was not defined in the manifest.json file. 33 // "default_locale" section was not defined in the manifest.json file.
34 std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest, 34 std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest,
35 std::string* error); 35 std::string* error);
36 36
37 // Returns true iff the extension was localized, and the current locale 37 // Returns true iff the extension was localized, and the current locale
38 // doesn't match the locale written into info.extension_manifest. 38 // doesn't match the locale written into info.extension_manifest.
39 bool ShouldRelocalizeManifest(const extensions::ExtensionInfo& info); 39 bool ShouldRelocalizeManifest(const extensions::ExtensionInfo& info);
40 40
41 // Localize extension name, description, browser_action and other fields 41 // Localize extension name, description, browser_action and other fields
42 // in the manifest. 42 // in the manifest.
43 bool LocalizeManifest(const ExtensionMessageBundle& messages, 43 bool LocalizeManifest(const extensions::MessageBundle& messages,
44 base::DictionaryValue* manifest, 44 base::DictionaryValue* manifest,
45 std::string* error); 45 std::string* error);
46 46
47 // Load message catalogs, localize manifest and attach message bundle to the 47 // Load message catalogs, localize manifest and attach message bundle to the
48 // extension. 48 // extension.
49 bool LocalizeExtension(const FilePath& extension_path, 49 bool LocalizeExtension(const FilePath& extension_path,
50 base::DictionaryValue* manifest, 50 base::DictionaryValue* manifest,
51 std::string* error); 51 std::string* error);
52 52
53 // Adds locale_name to the extension if it's in chrome_locales, and 53 // Adds locale_name to the extension if it's in chrome_locales, and
(...skipping 23 matching lines...) Expand all
77 // Fills out error with offending locale name. 77 // Fills out error with offending locale name.
78 bool GetValidLocales(const FilePath& locale_path, 78 bool GetValidLocales(const FilePath& locale_path,
79 std::set<std::string>* locales, 79 std::set<std::string>* locales,
80 std::string* error); 80 std::string* error);
81 81
82 // Loads messages file for default locale, and application locales (application 82 // Loads messages file for default locale, and application locales (application
83 // locales doesn't have to exist). Application locale is current locale and its 83 // locales doesn't have to exist). Application locale is current locale and its
84 // parents. 84 // parents.
85 // Returns message bundle if it can load default locale messages file, and all 85 // Returns message bundle if it can load default locale messages file, and all
86 // messages are valid, else returns NULL and sets error. 86 // messages are valid, else returns NULL and sets error.
87 ExtensionMessageBundle* LoadMessageCatalogs( 87 extensions::MessageBundle* LoadMessageCatalogs(
88 const FilePath& locale_path, 88 const FilePath& locale_path,
89 const std::string& default_locale, 89 const std::string& default_locale,
90 const std::string& app_locale, 90 const std::string& app_locale,
91 const std::set<std::string>& valid_locales, 91 const std::set<std::string>& valid_locales,
92 std::string* error); 92 std::string* error);
93 93
94 // Returns true if directory has "." in the name (for .svn) or if it doesn't 94 // Returns true if directory has "." in the name (for .svn) or if it doesn't
95 // belong to Chrome locales. 95 // belong to Chrome locales.
96 // |locales_path| is extension_id/_locales 96 // |locales_path| is extension_id/_locales
97 // |locale_path| is extension_id/_locales/xx 97 // |locale_path| is extension_id/_locales/xx
98 // |all_locales| is a set of all valid Chrome locales. 98 // |all_locales| is a set of all valid Chrome locales.
99 bool ShouldSkipValidation(const FilePath& locales_path, 99 bool ShouldSkipValidation(const FilePath& locales_path,
100 const FilePath& locale_path, 100 const FilePath& locale_path,
101 const std::set<std::string>& all_locales); 101 const std::set<std::string>& all_locales);
102 102
103 } // namespace extension_l10n_util 103 } // namespace extension_l10n_util
104 104
105 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 105 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_file_util.cc ('k') | chrome/common/extensions/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698