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

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

Issue 924793003: Cleanup: Convert const char* kFoo to const char kFoo[]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 5 years 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
« no previous file with comments | « extensions/common/message_bundle.h ('k') | remoting/host/win/wts_terminal_monitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "extensions/common/message_bundle.h" 5 #include "extensions/common/message_bundle.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/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/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "extensions/common/error_utils.h" 20 #include "extensions/common/error_utils.h"
21 #include "extensions/common/extension_l10n_util.h" 21 #include "extensions/common/extension_l10n_util.h"
22 #include "extensions/common/manifest_constants.h" 22 #include "extensions/common/manifest_constants.h"
23 23
24 namespace extensions { 24 namespace extensions {
25 25
26 namespace errors = manifest_errors; 26 namespace errors = manifest_errors;
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
32 const char* MessageBundle::kPlaceholderBegin = "$"; 32 const char MessageBundle::kPlaceholderBegin[] = "$";
33 const char* MessageBundle::kPlaceholderEnd = "$"; 33 const char MessageBundle::kPlaceholderEnd[] = "$";
34 const char* MessageBundle::kMessageBegin = "__MSG_"; 34 const char MessageBundle::kMessageBegin[] = "__MSG_";
35 const char* MessageBundle::kMessageEnd = "__"; 35 const char MessageBundle::kMessageEnd[] = "__";
36 36
37 // Reserved messages names. 37 // Reserved messages names.
38 const char* MessageBundle::kUILocaleKey = "@@ui_locale"; 38 const char MessageBundle::kUILocaleKey[] = "@@ui_locale";
39 const char* MessageBundle::kBidiDirectionKey = "@@bidi_dir"; 39 const char MessageBundle::kBidiDirectionKey[] = "@@bidi_dir";
40 const char* MessageBundle::kBidiReversedDirectionKey = 40 const char MessageBundle::kBidiReversedDirectionKey[] = "@@bidi_reversed_dir";
41 "@@bidi_reversed_dir"; 41 const char MessageBundle::kBidiStartEdgeKey[] = "@@bidi_start_edge";
42 const char* MessageBundle::kBidiStartEdgeKey = "@@bidi_start_edge"; 42 const char MessageBundle::kBidiEndEdgeKey[] = "@@bidi_end_edge";
43 const char* MessageBundle::kBidiEndEdgeKey = "@@bidi_end_edge"; 43 const char MessageBundle::kExtensionIdKey[] = "@@extension_id";
44 const char* MessageBundle::kExtensionIdKey = "@@extension_id";
45 44
46 // Reserved messages values. 45 // Reserved messages values.
47 const char* MessageBundle::kBidiLeftEdgeValue = "left"; 46 const char MessageBundle::kBidiLeftEdgeValue[] = "left";
48 const char* MessageBundle::kBidiRightEdgeValue = "right"; 47 const char MessageBundle::kBidiRightEdgeValue[] = "right";
49 48
50 // Formats message in case we encounter a bad formed key in the JSON object. 49 // Formats message in case we encounter a bad formed key in the JSON object.
51 // Returns false and sets |error| to actual error message. 50 // Returns false and sets |error| to actual error message.
52 static bool BadKeyMessage(const std::string& name, std::string* error) { 51 static bool BadKeyMessage(const std::string& name, std::string* error) {
53 *error = base::StringPrintf( 52 *error = base::StringPrintf(
54 "Name of a key \"%s\" is invalid. Only ASCII [a-z], " 53 "Name of a key \"%s\" is invalid. Only ASCII [a-z], "
55 "[A-Z], [0-9] and \"_\" are allowed.", 54 "[A-Z], [0-9] and \"_\" are allowed.",
56 name.c_str()); 55 name.c_str());
57 return false; 56 return false;
58 } 57 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return &(it->second); 337 return &(it->second);
339 338
340 return NULL; 339 return NULL;
341 } 340 }
342 341
343 void EraseL10nMessagesMap(const std::string& extension_id) { 342 void EraseL10nMessagesMap(const std::string& extension_id) {
344 g_extension_to_messages_map.Get().messages_map.erase(extension_id); 343 g_extension_to_messages_map.Get().messages_map.erase(extension_id);
345 } 344 }
346 345
347 } // namespace extensions 346 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/message_bundle.h ('k') | remoting/host/win/wts_terminal_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698