OLD | NEW |
1 // Copyright (c) 2011 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 UI_BASE_TEXT_TEXT_ELIDER_H_ | 5 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ |
6 #define UI_BASE_TEXT_TEXT_ELIDER_H_ | 6 #define UI_BASE_TEXT_TEXT_ELIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <unicode/coll.h> | 9 #include <unicode/coll.h> |
10 #include <unicode/uchar.h> | 10 #include <unicode/uchar.h> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
15 | 15 |
16 class FilePath; | 16 class FilePath; |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
| 21 extern const char kEllipsis[]; |
| 22 |
21 // This function takes a GURL object and elides it. It returns a string | 23 // This function takes a GURL object and elides it. It returns a string |
22 // which composed of parts from subdomain, domain, path, filename and query. | 24 // which composed of parts from subdomain, domain, path, filename and query. |
23 // A "..." is added automatically at the end if the elided string is bigger | 25 // A "..." is added automatically at the end if the elided string is bigger |
24 // than the available pixel width. For available pixel width = 0, empty | 26 // than the available pixel width. For available pixel width = 0, empty |
25 // string is returned. |languages| is a comma separted list of ISO 639 | 27 // string is returned. |languages| is a comma separted list of ISO 639 |
26 // language codes and is used to determine what characters are understood | 28 // language codes and is used to determine what characters are understood |
27 // by a user. It should come from |prefs::kAcceptLanguages|. | 29 // by a user. It should come from |prefs::kAcceptLanguages|. |
28 // | 30 // |
29 // Note: in RTL locales, if the URL returned by this function is going to be | 31 // Note: in RTL locales, if the URL returned by this function is going to be |
30 // displayed in the UI, then it is likely that the string needs to be marked | 32 // displayed in the UI, then it is likely that the string needs to be marked |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // surrogate pairs) as necssary. Truncation (indicated by an added 3 dots) | 111 // surrogate pairs) as necssary. Truncation (indicated by an added 3 dots) |
110 // occurs if the result is still too long. Returns true if the input had | 112 // occurs if the result is still too long. Returns true if the input had |
111 // to be truncated (and not just reformatted). | 113 // to be truncated (and not just reformatted). |
112 bool ElideRectangleString(const string16& input, size_t max_rows, | 114 bool ElideRectangleString(const string16& input, size_t max_rows, |
113 size_t max_cols, string16* output); | 115 size_t max_cols, string16* output); |
114 | 116 |
115 | 117 |
116 } // namespace ui | 118 } // namespace ui |
117 | 119 |
118 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ | 120 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ |
OLD | NEW |