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

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

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 9 #pragma once
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 class DictionaryValue;
16 class Extension; 15 class Extension;
17 class ExtensionMessageBundle; 16 class ExtensionMessageBundle;
18 class FilePath; 17 class FilePath;
19 class GURL; 18 class GURL;
20 class ResourceDispatcherHostRequestInfo; 19 class ResourceDispatcherHostRequestInfo;
21 struct ExtensionInfo; 20 struct ExtensionInfo;
22 21
22 namespace base {
23 class DictionaryValue;
24 }
25
23 namespace extension_l10n_util { 26 namespace extension_l10n_util {
24 27
25 // Set the locale for this process to a fixed value, rather than using the 28 // Set the locale for this process to a fixed value, rather than using the
26 // normal file-based lookup mechanisms. This is used to set the locale inside 29 // normal file-based lookup mechanisms. This is used to set the locale inside
27 // the sandboxed utility process, where file reading is not allowed. 30 // the sandboxed utility process, where file reading is not allowed.
28 void SetProcessLocale(const std::string& locale); 31 void SetProcessLocale(const std::string& locale);
29 32
30 // Returns default locale in form "en-US" or "sr" or empty string if 33 // Returns default locale in form "en-US" or "sr" or empty string if
31 // "default_locale" section was not defined in the manifest.json file. 34 // "default_locale" section was not defined in the manifest.json file.
32 std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, 35 std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest,
33 std::string* error); 36 std::string* error);
34 37
35 // Returns true iff the extension was localized, and the current locale 38 // Returns true iff the extension was localized, and the current locale
36 // doesn't match the locale written into info.extension_manifest. 39 // doesn't match the locale written into info.extension_manifest.
37 bool ShouldRelocalizeManifest(const ExtensionInfo& info); 40 bool ShouldRelocalizeManifest(const ExtensionInfo& info);
38 41
39 // Localize extension name, description, browser_action and other fields 42 // Localize extension name, description, browser_action and other fields
40 // in the manifest. 43 // in the manifest.
41 bool LocalizeManifest(const ExtensionMessageBundle& messages, 44 bool LocalizeManifest(const ExtensionMessageBundle& messages,
42 DictionaryValue* manifest, 45 base::DictionaryValue* manifest,
43 std::string* error); 46 std::string* error);
44 47
45 // Load message catalogs, localize manifest and attach message bundle to the 48 // Load message catalogs, localize manifest and attach message bundle to the
46 // extension. 49 // extension.
47 bool LocalizeExtension(const FilePath& extension_path, 50 bool LocalizeExtension(const FilePath& extension_path,
48 DictionaryValue* manifest, 51 base::DictionaryValue* manifest,
49 std::string* error); 52 std::string* error);
50 53
51 // Adds locale_name to the extension if it's in chrome_locales, and 54 // Adds locale_name to the extension if it's in chrome_locales, and
52 // if messages file is present (we don't check content of messages file here). 55 // if messages file is present (we don't check content of messages file here).
53 // Returns false if locale_name was not found in chrome_locales, and sets 56 // Returns false if locale_name was not found in chrome_locales, and sets
54 // error with locale_name. 57 // error with locale_name.
55 // If file name starts with . return true (helps testing extensions under svn). 58 // If file name starts with . return true (helps testing extensions under svn).
56 bool AddLocale(const std::set<std::string>& chrome_locales, 59 bool AddLocale(const std::set<std::string>& chrome_locales,
57 const FilePath& locale_folder, 60 const FilePath& locale_folder,
58 const std::string& locale_name, 61 const std::string& locale_name,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // |locales_path| is extension_id/_locales 97 // |locales_path| is extension_id/_locales
95 // |locale_path| is extension_id/_locales/xx 98 // |locale_path| is extension_id/_locales/xx
96 // |all_locales| is a set of all valid Chrome locales. 99 // |all_locales| is a set of all valid Chrome locales.
97 bool ShouldSkipValidation(const FilePath& locales_path, 100 bool ShouldSkipValidation(const FilePath& locales_path,
98 const FilePath& locale_path, 101 const FilePath& locale_path,
99 const std::set<std::string>& all_locales); 102 const std::set<std::string>& all_locales);
100 103
101 } // namespace extension_l10n_util 104 } // namespace extension_l10n_util
102 105
103 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 106 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_message_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698