OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ | 5 #ifndef EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ |
6 #define EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ | 6 #define EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/memory/linked_ptr.h" | |
15 | |
16 namespace base { | 15 namespace base { |
17 class DictionaryValue; | 16 class DictionaryValue; |
18 class Value; | 17 class Value; |
19 } | 18 } |
20 | 19 |
21 namespace extensions { | 20 namespace extensions { |
22 | 21 |
23 // Contains localized extension messages for one locale. Any messages that the | 22 // Contains localized extension messages for one locale. Any messages that the |
24 // locale does not provide are pulled from the default locale. | 23 // locale does not provide are pulled from the default locale. |
25 class MessageBundle { | 24 class MessageBundle { |
26 public: | 25 public: |
27 typedef std::map<std::string, std::string> SubstitutionMap; | 26 using SubstitutionMap = std::map<std::string, std::string>; |
28 typedef std::vector<linked_ptr<base::DictionaryValue> > CatalogVector; | 27 using CatalogVector = std::vector<std::unique_ptr<base::DictionaryValue>>; |
29 | 28 |
30 // JSON keys of interest for messages file. | 29 // JSON keys of interest for messages file. |
31 static const char kContentKey[]; | 30 static const char kContentKey[]; |
32 static const char kMessageKey[]; | 31 static const char kMessageKey[]; |
33 static const char kPlaceholdersKey[]; | 32 static const char kPlaceholdersKey[]; |
34 | 33 |
35 // Begin/end markers for placeholders and messages | 34 // Begin/end markers for placeholders and messages |
36 static const char kPlaceholderBegin[]; | 35 static const char kPlaceholderBegin[]; |
37 static const char kPlaceholderEnd[]; | 36 static const char kPlaceholderEnd[]; |
38 static const char kMessageBegin[]; | 37 static const char kMessageBegin[]; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 165 |
167 // Returns message map that matches given extension_id, or NULL. | 166 // Returns message map that matches given extension_id, or NULL. |
168 L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id); | 167 L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id); |
169 | 168 |
170 // Erases the L10nMessagesMap for the given |extension_id|. | 169 // Erases the L10nMessagesMap for the given |extension_id|. |
171 void EraseL10nMessagesMap(const std::string& extension_id); | 170 void EraseL10nMessagesMap(const std::string& extension_id); |
172 | 171 |
173 } // namespace extensions | 172 } // namespace extensions |
174 | 173 |
175 #endif // EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ | 174 #endif // EXTENSIONS_COMMON_MESSAGE_BUNDLE_H_ |
OLD | NEW |