OLD | NEW |
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 // This file implements utility functions for eliding and formatting UI text. | 5 // This file implements utility functions for eliding and formatting UI text. |
6 // | 6 // |
7 // Note that several of the functions declared in text_elider.h are implemented | 7 // Note that several of the functions declared in text_elider.h are implemented |
8 // in this file using helper classes in an unnamed namespace. | 8 // in this file using helper classes in an unnamed namespace. |
9 | 9 |
10 #include "ui/base/text/text_elider.h" | 10 #include "ui/base/text/text_elider.h" |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/i18n/break_iterator.h" | 16 #include "base/i18n/break_iterator.h" |
17 #include "base/i18n/char_iterator.h" | 17 #include "base/i18n/char_iterator.h" |
18 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "net/base/escape.h" | 24 #include "net/base/escape.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
26 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 26 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
27 #include "third_party/icu/public/common/unicode/rbbi.h" | 27 #include "third_party/icu/source/common/unicode/rbbi.h" |
28 #include "third_party/icu/public/common/unicode/uloc.h" | 28 #include "third_party/icu/source/common/unicode/uloc.h" |
29 #include "ui/gfx/font.h" | 29 #include "ui/gfx/font.h" |
30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
31 | 31 |
32 namespace ui { | 32 namespace ui { |
33 | 33 |
34 // U+2026 in utf8 | 34 // U+2026 in utf8 |
35 const char kEllipsis[] = "\xE2\x80\xA6"; | 35 const char kEllipsis[] = "\xE2\x80\xA6"; |
36 const char16 kEllipsisUTF16[] = { 0x2026, 0 }; | 36 const char16 kEllipsisUTF16[] = { 0x2026, 0 }; |
37 const char16 kForwardSlash = '/'; | 37 const char16 kForwardSlash = '/'; |
38 | 38 |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 index = char_iterator.getIndex(); | 1120 index = char_iterator.getIndex(); |
1121 } else { | 1121 } else { |
1122 // String has leading whitespace, return the elide string. | 1122 // String has leading whitespace, return the elide string. |
1123 return kElideString; | 1123 return kElideString; |
1124 } | 1124 } |
1125 } | 1125 } |
1126 return string.substr(0, index) + kElideString; | 1126 return string.substr(0, index) + kElideString; |
1127 } | 1127 } |
1128 | 1128 |
1129 } // namespace ui | 1129 } // namespace ui |
OLD | NEW |