OLD | NEW |
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 APP_TEXT_ELIDER_H_ | 5 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ |
6 #define APP_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 "gfx/font.h" | 14 #include "gfx/font.h" |
15 | 15 |
16 class FilePath; | 16 class FilePath; |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 // TODO(port): this file should deal in string16s rather than wstrings. | 19 // TODO(port): this file should deal in string16s rather than wstrings. |
20 namespace gfx { | 20 namespace ui { |
21 | 21 |
22 // This function takes a GURL object and elides it. It returns a string | 22 // This function takes a GURL object and elides it. It returns a string |
23 // which composed of parts from subdomain, domain, path, filename and query. | 23 // which composed of parts from subdomain, domain, path, filename and query. |
24 // A "..." is added automatically at the end if the elided string is bigger | 24 // A "..." is added automatically at the end if the elided string is bigger |
25 // than the available pixel width. For available pixel width = 0, empty | 25 // than the available pixel width. For available pixel width = 0, empty |
26 // string is returned. |languages| is a comma separted list of ISO 639 | 26 // string is returned. |languages| is a comma separted list of ISO 639 |
27 // language codes and is used to determine what characters are understood | 27 // language codes and is used to determine what characters are understood |
28 // by a user. It should come from |prefs::kAcceptLanguages|. | 28 // by a user. It should come from |prefs::kAcceptLanguages|. |
29 // | 29 // |
30 // Note: in RTL locales, if the URL returned by this function is going to be | 30 // Note: in RTL locales, if the URL returned by this function is going to be |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // |max_cols| rectangle of characters. Input newlines are respected, but | 107 // |max_cols| rectangle of characters. Input newlines are respected, but |
108 // lines that are too long are broken into pieces, first at naturally | 108 // lines that are too long are broken into pieces, first at naturally |
109 // occuring whitespace boundaries, and then intra-word (respecting UTF-16 | 109 // occuring whitespace boundaries, and then intra-word (respecting UTF-16 |
110 // surrogate pairs) as necssary. Truncation (indicated by an added 3 dots) | 110 // surrogate pairs) as necssary. Truncation (indicated by an added 3 dots) |
111 // occurs if the result is still too long. Returns true if the input had | 111 // occurs if the result is still too long. Returns true if the input had |
112 // to be truncated (and not just reformatted). | 112 // to be truncated (and not just reformatted). |
113 bool ElideRectangleString(const string16& input, size_t max_rows, | 113 bool ElideRectangleString(const string16& input, size_t max_rows, |
114 size_t max_cols, string16* output); | 114 size_t max_cols, string16* output); |
115 | 115 |
116 | 116 |
117 } // namespace gfx. | 117 } // namespace ui |
118 | 118 |
119 #endif // APP_TEXT_ELIDER_H_ | 119 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ |
OLD | NEW |