| OLD | NEW |
| 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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/linked_ptr.h" | 13 #include "base/linked_ptr.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 | 16 |
| 17 // Contains localized extension messages for one locale. Any messages that the | 17 // Contains localized extension messages for one locale. Any messages that the |
| 18 // locale does not provide are pulled from the default locale. | 18 // locale does not provide are pulled from the default locale. |
| 19 class ExtensionMessageBundle { | 19 class ExtensionMessageBundle { |
| 20 public: | 20 public: |
| 21 typedef std::map<std::string, std::string> SubstitutionMap; | 21 typedef std::map<std::string, std::string> SubstitutionMap; |
| 22 typedef std::vector<linked_ptr<DictionaryValue> > CatalogVector; | 22 typedef std::vector<linked_ptr<DictionaryValue> > CatalogVector; |
| 23 | 23 |
| 24 // JSON keys of interest for messages file. | 24 // JSON keys of interest for messages file. |
| 25 static const wchar_t* kContentKey; | 25 static const char* kContentKey; |
| 26 static const wchar_t* kMessageKey; | 26 static const char* kMessageKey; |
| 27 static const wchar_t* kPlaceholdersKey; | 27 static const char* kPlaceholdersKey; |
| 28 | 28 |
| 29 // Begin/end markers for placeholders and messages | 29 // Begin/end markers for placeholders and messages |
| 30 static const char* kPlaceholderBegin; | 30 static const char* kPlaceholderBegin; |
| 31 static const char* kPlaceholderEnd; | 31 static const char* kPlaceholderEnd; |
| 32 static const char* kMessageBegin; | 32 static const char* kMessageBegin; |
| 33 static const char* kMessageEnd; | 33 static const char* kMessageEnd; |
| 34 | 34 |
| 35 // Reserved message names in the dictionary. | 35 // Reserved message names in the dictionary. |
| 36 // Update i18n documentation when adding new reserved value. | 36 // Update i18n documentation when adding new reserved value. |
| 37 static const char* kUILocaleKey; | 37 static const char* kUILocaleKey; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 ExtensionToL10nMessagesMap messages_map; | 172 ExtensionToL10nMessagesMap messages_map; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 // Returns the extension_id to messages map. | 175 // Returns the extension_id to messages map. |
| 176 ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); | 176 ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); |
| 177 | 177 |
| 178 // Returns message map that matches given extension_id, or NULL. | 178 // Returns message map that matches given extension_id, or NULL. |
| 179 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id); | 179 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id); |
| 180 | 180 |
| 181 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ | 181 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ |
| OLD | NEW |