Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/linked_ptr.h" | 12 #include "base/linked_ptr.h" |
| 13 #include "base/string_util.h" | |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 | 15 |
| 15 // Contains localized extension messages for one locale. Any messages that the | 16 // Contains localized extension messages for one locale. Any messages that the |
| 16 // locale does not provide are pulled from the default locale. | 17 // locale does not provide are pulled from the default locale. |
| 17 class ExtensionMessageBundle { | 18 class ExtensionMessageBundle { |
| 18 public: | 19 public: |
| 19 typedef std::map<std::string, std::string> SubstitutionMap; | 20 typedef std::map<std::string, std::string> SubstitutionMap; |
| 20 typedef std::vector<linked_ptr<DictionaryValue> > CatalogVector; | 21 typedef std::vector<linked_ptr<DictionaryValue> > CatalogVector; |
| 21 | 22 |
| 22 // JSON keys of interest for messages file. | 23 // JSON keys of interest for messages file. |
| 23 static const wchar_t* kContentKey; | 24 static const wchar_t* kContentKey; |
|
willchan no longer on Chromium
2010/03/30 17:13:18
ew, none of these are constants :(
| |
| 24 static const wchar_t* kMessageKey; | 25 static const wchar_t* kMessageKey; |
| 25 static const wchar_t* kPlaceholdersKey; | 26 static const wchar_t* kPlaceholdersKey; |
| 26 | 27 |
| 27 // Begin/end markers for placeholders and messages | 28 // Begin/end markers for placeholders and messages |
| 28 static const char* kPlaceholderBegin; | 29 static const char* kPlaceholderBegin; |
| 29 static const char* kPlaceholderEnd; | 30 static const char* kPlaceholderEnd; |
| 30 static const char* kMessageBegin; | 31 static const char* kMessageBegin; |
| 31 static const char* kMessageEnd; | 32 static const char* kMessageEnd; |
| 32 | 33 |
| 33 // Reserved message names in the dictionary. | 34 // Reserved message names in the dictionary. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 ExtensionToL10nMessagesMap messages_map; | 171 ExtensionToL10nMessagesMap messages_map; |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 // Returns the extension_id to messages map. | 174 // Returns the extension_id to messages map. |
| 174 ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); | 175 ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); |
| 175 | 176 |
| 176 // Returns message map that matches given extension_id, or NULL. | 177 // Returns message map that matches given extension_id, or NULL. |
| 177 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id); | 178 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id); |
| 178 | 179 |
| 179 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ | 180 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ |
| OLD | NEW |