| 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 #include "chrome/common/extensions/extension_message_bundle.h" | 5 #include "chrome/common/extensions/extension_message_bundle.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const char* ExtensionMessageBundle::kMessageBegin = "__MSG_"; | 30 const char* ExtensionMessageBundle::kMessageBegin = "__MSG_"; |
| 31 const char* ExtensionMessageBundle::kMessageEnd = "__"; | 31 const char* ExtensionMessageBundle::kMessageEnd = "__"; |
| 32 | 32 |
| 33 // Reserved messages names. | 33 // Reserved messages names. |
| 34 const char* ExtensionMessageBundle::kUILocaleKey = "@@ui_locale"; | 34 const char* ExtensionMessageBundle::kUILocaleKey = "@@ui_locale"; |
| 35 const char* ExtensionMessageBundle::kBidiDirectionKey = "@@bidi_dir"; | 35 const char* ExtensionMessageBundle::kBidiDirectionKey = "@@bidi_dir"; |
| 36 const char* ExtensionMessageBundle::kBidiReversedDirectionKey = | 36 const char* ExtensionMessageBundle::kBidiReversedDirectionKey = |
| 37 "@@bidi_reversed_dir"; | 37 "@@bidi_reversed_dir"; |
| 38 const char* ExtensionMessageBundle::kBidiStartEdgeKey = "@@bidi_start_edge"; | 38 const char* ExtensionMessageBundle::kBidiStartEdgeKey = "@@bidi_start_edge"; |
| 39 const char* ExtensionMessageBundle::kBidiEndEdgeKey = "@@bidi_end_edge"; | 39 const char* ExtensionMessageBundle::kBidiEndEdgeKey = "@@bidi_end_edge"; |
| 40 const char* ExtensionMessageBundle::kExtensionIdKey = "@@extension_id"; |
| 40 | 41 |
| 41 // Reserved messages values. | 42 // Reserved messages values. |
| 42 const char* ExtensionMessageBundle::kBidiLeftEdgeValue = "left"; | 43 const char* ExtensionMessageBundle::kBidiLeftEdgeValue = "left"; |
| 43 const char* ExtensionMessageBundle::kBidiRightEdgeValue = "right"; | 44 const char* ExtensionMessageBundle::kBidiRightEdgeValue = "right"; |
| 44 | 45 |
| 45 // Formats message in case we encounter a bad formed key in the JSON object. | 46 // Formats message in case we encounter a bad formed key in the JSON object. |
| 46 // Returns false and sets |error| to actual error message. | 47 // Returns false and sets |error| to actual error message. |
| 47 static bool BadKeyMessage(const std::string& name, std::string* error) { | 48 static bool BadKeyMessage(const std::string& name, std::string* error) { |
| 48 *error = StringPrintf("Name of a key \"%s\" is invalid. Only ASCII [a-z], " | 49 *error = StringPrintf("Name of a key \"%s\" is invalid. Only ASCII [a-z], " |
| 49 "[A-Z], [0-9] and \"_\" are allowed.", name.c_str()); | 50 "[A-Z], [0-9] and \"_\" are allowed.", name.c_str()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 303 } |
| 303 | 304 |
| 304 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) { | 305 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) { |
| 305 ExtensionToL10nMessagesMap::iterator it = | 306 ExtensionToL10nMessagesMap::iterator it = |
| 306 Singleton<ExtensionToMessagesMap>()->messages_map.find(extension_id); | 307 Singleton<ExtensionToMessagesMap>()->messages_map.find(extension_id); |
| 307 if (it != Singleton<ExtensionToMessagesMap>()->messages_map.end()) | 308 if (it != Singleton<ExtensionToMessagesMap>()->messages_map.end()) |
| 308 return &(it->second); | 309 return &(it->second); |
| 309 | 310 |
| 310 return NULL; | 311 return NULL; |
| 311 } | 312 } |
| OLD | NEW |