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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months 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) 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"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/i18n/rtl.h"
12 #include "base/linked_ptr.h" 13 #include "base/linked_ptr.h"
13 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
14 #include "base/singleton.h" 15 #include "base/singleton.h"
15 #include "base/stl_util-inl.h" 16 #include "base/stl_util-inl.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
19 #include "chrome/common/extensions/extension_error_utils.h" 20 #include "chrome/common/extensions/extension_error_utils.h"
20 #include "chrome/common/extensions/extension_l10n_util.h" 21 #include "chrome/common/extensions/extension_l10n_util.h"
21 22
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return false; 89 return false;
89 90
90 return true; 91 return true;
91 } 92 }
92 93
93 bool ExtensionMessageBundle::AppendReservedMessagesForLocale( 94 bool ExtensionMessageBundle::AppendReservedMessagesForLocale(
94 const std::string& app_locale, std::string* error) { 95 const std::string& app_locale, std::string* error) {
95 SubstitutionMap append_messages; 96 SubstitutionMap append_messages;
96 append_messages[kUILocaleKey] = app_locale; 97 append_messages[kUILocaleKey] = app_locale;
97 98
98 // Calling l10n_util::GetTextDirection on non-UI threads doesn't seems safe, 99 // Calling base::i18n::GetTextDirection on non-UI threads doesn't seems safe,
99 // so we use GetTextDirectionForLocale instead. 100 // so we use GetTextDirectionForLocale instead.
100 if (l10n_util::GetTextDirectionForLocale(app_locale.c_str()) == 101 if (base::i18n::GetTextDirectionForLocale(app_locale.c_str()) ==
101 l10n_util::RIGHT_TO_LEFT) { 102 base::i18n::RIGHT_TO_LEFT) {
102 append_messages[kBidiDirectionKey] = "rtl"; 103 append_messages[kBidiDirectionKey] = "rtl";
103 append_messages[kBidiReversedDirectionKey] = "ltr"; 104 append_messages[kBidiReversedDirectionKey] = "ltr";
104 append_messages[kBidiStartEdgeKey] = kBidiRightEdgeValue; 105 append_messages[kBidiStartEdgeKey] = kBidiRightEdgeValue;
105 append_messages[kBidiEndEdgeKey] = kBidiLeftEdgeValue; 106 append_messages[kBidiEndEdgeKey] = kBidiLeftEdgeValue;
106 } else { 107 } else {
107 append_messages[kBidiDirectionKey] = "ltr"; 108 append_messages[kBidiDirectionKey] = "ltr";
108 append_messages[kBidiReversedDirectionKey] = "rtl"; 109 append_messages[kBidiReversedDirectionKey] = "rtl";
109 append_messages[kBidiStartEdgeKey] = kBidiLeftEdgeValue; 110 append_messages[kBidiStartEdgeKey] = kBidiLeftEdgeValue;
110 append_messages[kBidiEndEdgeKey] = kBidiRightEdgeValue; 111 append_messages[kBidiEndEdgeKey] = kBidiRightEdgeValue;
111 } 112 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 304 }
304 305
305 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) { 306 L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) {
306 ExtensionToL10nMessagesMap::iterator it = 307 ExtensionToL10nMessagesMap::iterator it =
307 Singleton<ExtensionToMessagesMap>()->messages_map.find(extension_id); 308 Singleton<ExtensionToMessagesMap>()->messages_map.find(extension_id);
308 if (it != Singleton<ExtensionToMessagesMap>()->messages_map.end()) 309 if (it != Singleton<ExtensionToMessagesMap>()->messages_map.end())
309 return &(it->second); 310 return &(it->second);
310 311
311 return NULL; 312 return NULL;
312 } 313 }
OLDNEW
« no previous file with comments | « chrome/common/child_process_info.cc ('k') | chrome/common/extensions/extension_message_bundle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698