| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // This file declares extension specific l10n utils. |
| 6 |
| 7 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| 8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| 9 |
| 10 #include <set> |
| 11 #include <string> |
| 12 |
| 13 class DictionaryValue; |
| 14 class Extension; |
| 15 class FilePath; |
| 16 |
| 17 namespace extension_l10n_util { |
| 18 |
| 19 // Returns true if default_locale was set to valid locale |
| 20 // (supported by the extension). |
| 21 bool ValidateDefaultLocale(const Extension* extension); |
| 22 |
| 23 // Adds locale_name to the extension if it's in chrome_locales, and |
| 24 // if messages file is present (we don't check content of messages file here). |
| 25 // Returns false if locale_name was not found in chrome_locales, and sets |
| 26 // error with locale_name. |
| 27 bool AddLocale(const std::set<std::string>& chrome_locales, |
| 28 const FilePath& locale_folder, |
| 29 Extension* extension, |
| 30 std::string* locale_name, |
| 31 std::string* error); |
| 32 |
| 33 // Adds valid locales to the extension. |
| 34 // 1. Do nothing if _locales directory is missing (not an error). |
| 35 // 2. Get list of Chrome locales. |
| 36 // 3. Enumerate all subdirectories of _locales directory. |
| 37 // 4. Intersect both lists, and add intersection to the extension. |
| 38 // Returns false if any of supplied locales don't match chrome list of locales. |
| 39 // Fills out error with offending locale name. |
| 40 bool AddValidLocales(const FilePath& locale_path, |
| 41 Extension* extension, |
| 42 std::string* error); |
| 43 |
| 44 } // namespace extension_l10n_util |
| 45 |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_L10N_UTIL_H_ |
| OLD | NEW |