Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/common/extensions/message_bundle.cc

Issue 11312228: Move extension_error_utils.* and url_pattern_set.* into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hate Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_bundle.h" 5 #include "chrome/common/extensions/message_bundle.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/common/extensions/extension_l10n_util.h"
19 #include "chrome/common/extensions/extension_manifest_constants.h" 20 #include "chrome/common/extensions/extension_manifest_constants.h"
20 #include "chrome/common/extensions/extension_error_utils.h" 21 #include "extensions/common/error_utils.h"
21 #include "chrome/common/extensions/extension_l10n_util.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 23
24 namespace errors = extension_manifest_errors; 24 namespace errors = extension_manifest_errors;
25 25
26 namespace extensions { 26 namespace extensions {
27 27
28 const char* MessageBundle::kContentKey = "content"; 28 const char* MessageBundle::kContentKey = "content";
29 const char* MessageBundle::kMessageKey = "message"; 29 const char* MessageBundle::kMessageKey = "message";
30 const char* MessageBundle::kPlaceholdersKey = "placeholders"; 30 const char* MessageBundle::kPlaceholdersKey = "placeholders";
31 31
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 append_messages[kBidiDirectionKey] = "ltr"; 111 append_messages[kBidiDirectionKey] = "ltr";
112 append_messages[kBidiReversedDirectionKey] = "rtl"; 112 append_messages[kBidiReversedDirectionKey] = "rtl";
113 append_messages[kBidiStartEdgeKey] = kBidiLeftEdgeValue; 113 append_messages[kBidiStartEdgeKey] = kBidiLeftEdgeValue;
114 append_messages[kBidiEndEdgeKey] = kBidiRightEdgeValue; 114 append_messages[kBidiEndEdgeKey] = kBidiRightEdgeValue;
115 } 115 }
116 116
117 // Add all reserved messages to the dictionary, but check for collisions. 117 // Add all reserved messages to the dictionary, but check for collisions.
118 SubstitutionMap::iterator it = append_messages.begin(); 118 SubstitutionMap::iterator it = append_messages.begin();
119 for (; it != append_messages.end(); ++it) { 119 for (; it != append_messages.end(); ++it) {
120 if (ContainsKey(dictionary_, it->first)) { 120 if (ContainsKey(dictionary_, it->first)) {
121 *error = ExtensionErrorUtils::FormatErrorMessage( 121 *error = ErrorUtils::FormatErrorMessage(
122 errors::kReservedMessageFound, it->first); 122 errors::kReservedMessageFound, it->first);
123 return false; 123 return false;
124 } else { 124 } else {
125 dictionary_[it->first] = it->second; 125 dictionary_[it->first] = it->second;
126 } 126 }
127 } 127 }
128 128
129 return true; 129 return true;
130 } 130 }
131 131
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id) { 336 L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id) {
337 ExtensionToL10nMessagesMap::iterator it = 337 ExtensionToL10nMessagesMap::iterator it =
338 g_extension_to_messages_map.Get().messages_map.find(extension_id); 338 g_extension_to_messages_map.Get().messages_map.find(extension_id);
339 if (it != g_extension_to_messages_map.Get().messages_map.end()) 339 if (it != g_extension_to_messages_map.Get().messages_map.end())
340 return &(it->second); 340 return &(it->second);
341 341
342 return NULL; 342 return NULL;
343 } 343 }
344 344
345 } // namespace extensions 345 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/matcher/url_matcher_factory.cc ('k') | chrome/common/extensions/message_bundle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698