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

Side by Side Diff: base/i18n/rtl.h

Issue 6878089: Add and use a base::i18n::StringWithDirection for carrying titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license Created 9 years, 8 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_I18N_RTL_H_ 5 #ifndef BASE_I18N_RTL_H_
6 #define BASE_I18N_RTL_H_ 6 #define BASE_I18N_RTL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
(...skipping 12 matching lines...) Expand all
24 const char16 kPopDirectionalFormatting = 0x202C; 24 const char16 kPopDirectionalFormatting = 0x202C;
25 const char16 kLeftToRightOverride = 0x202D; 25 const char16 kLeftToRightOverride = 0x202D;
26 const char16 kRightToLeftOverride = 0x202E; 26 const char16 kRightToLeftOverride = 0x202E;
27 27
28 enum TextDirection { 28 enum TextDirection {
29 UNKNOWN_DIRECTION, 29 UNKNOWN_DIRECTION,
30 RIGHT_TO_LEFT, 30 RIGHT_TO_LEFT,
31 LEFT_TO_RIGHT, 31 LEFT_TO_RIGHT,
32 }; 32 };
33 33
34 // A string along with the text direction it should be displayed in.
35 // Conceptually this is a struct; we just use 'class' to make it easier for
36 // others to forward-declare us with 'class String16WithDirection'.
37 class String16WithDirection {
38 public:
39 String16WithDirection() : direction_(UNKNOWN_DIRECTION) { }
40 String16WithDirection(const string16& str, TextDirection dir)
41 : string_(str), direction_(dir) { }
42
43 const string16& string() const { return string_; }
44 TextDirection direction() const { return direction_; }
45
46 bool empty() const { return string_.empty(); }
darin (slow to review) 2011/04/21 18:03:30 in chromium, we generally add a verb to methods li
Evan Martin 2011/04/21 18:11:52 In the equivalent WebKit review, I tried to add no
47
48 string16 string_;
darin (slow to review) 2011/04/21 18:03:30 nit: these should be marked private.
49 TextDirection direction_;
50 };
51
34 // Get the locale that the currently running process has been configured to use. 52 // Get the locale that the currently running process has been configured to use.
35 // The return value is of the form language[-country] (e.g., en-US) where the 53 // The return value is of the form language[-country] (e.g., en-US) where the
36 // language is the 2 or 3 letter code from ISO-639. 54 // language is the 2 or 3 letter code from ISO-639.
37 std::string GetConfiguredLocale(); 55 std::string GetConfiguredLocale();
38 56
39 // Canonicalize a string (eg. a POSIX locale string) to a Chrome locale name. 57 // Canonicalize a string (eg. a POSIX locale string) to a Chrome locale name.
40 std::string GetCanonicalLocale(const char* locale); 58 std::string GetCanonicalLocale(const char* locale);
41 59
42 // Sets the default locale of ICU. 60 // Sets the default locale of ICU.
43 // Once the application locale of Chrome in GetApplicationLocale is determined, 61 // Once the application locale of Chrome in GetApplicationLocale is determined,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // return the text itself. Explicit bidi control characters display and have 158 // return the text itself. Explicit bidi control characters display and have
141 // semantic effect. They can be deleted so they might not always appear in a 159 // semantic effect. They can be deleted so they might not always appear in a
142 // pair. 160 // pair.
143 const string16 StripWrappingBidiControlCharacters(const string16& text) 161 const string16 StripWrappingBidiControlCharacters(const string16& text)
144 WARN_UNUSED_RESULT; 162 WARN_UNUSED_RESULT;
145 163
146 } // namespace i18n 164 } // namespace i18n
147 } // namespace base 165 } // namespace base
148 166
149 #endif // BASE_I18N_RTL_H_ 167 #endif // BASE_I18N_RTL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/balloon_host.h » ('j') | content/browser/renderer_host/render_view_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698