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

Side by Side Diff: ui/base/text/text_elider.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « ui/base/resource/data_pack.h ('k') | ui/base/win/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 defines utility functions for eliding and formatting UI text. 5 // This file defines utility functions for eliding and formatting UI text.
6 6
7 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ 7 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_
8 #define UI_BASE_TEXT_TEXT_ELIDER_H_ 8 #define UI_BASE_TEXT_TEXT_ELIDER_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "third_party/icu/public/common/unicode/uchar.h" 15 #include "third_party/icu/public/common/unicode/uchar.h"
16 #include "third_party/icu/public/i18n/unicode/coll.h" 16 #include "third_party/icu/public/i18n/unicode/coll.h"
17 #include "ui/base/ui_export.h" 17 #include "ui/base/ui_export.h"
18 #include "ui/gfx/font.h" 18 #include "ui/gfx/font.h"
19 19
20 class GURL;
21
22 namespace base {
20 class FilePath; 23 class FilePath;
21 class GURL; 24 }
22 25
23 namespace ui { 26 namespace ui {
24 27
25 UI_EXPORT extern const char kEllipsis[]; 28 UI_EXPORT extern const char kEllipsis[];
26 29
27 // Elides a well-formed email address (e.g. username@domain.com) to fit into 30 // Elides a well-formed email address (e.g. username@domain.com) to fit into
28 // |available_pixel_width| using the specified |font|. 31 // |available_pixel_width| using the specified |font|.
29 // This function guarantees that the string returned will contain at least one 32 // This function guarantees that the string returned will contain at least one
30 // character, other than the ellipses, on either side of the '@'. If it is 33 // character, other than the ellipses, on either side of the '@'. If it is
31 // impossible to achieve these requirements: only an ellipsis will be returned. 34 // impossible to achieve these requirements: only an ellipsis will be returned.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const gfx::Font& font, 75 const gfx::Font& font,
73 int available_pixel_width, 76 int available_pixel_width,
74 ElideBehavior elide_behavior); 77 ElideBehavior elide_behavior);
75 78
76 // Elide a filename to fit a given pixel width, with an emphasis on not hiding 79 // Elide a filename to fit a given pixel width, with an emphasis on not hiding
77 // the extension unless we have to. If filename contains a path, the path will 80 // the extension unless we have to. If filename contains a path, the path will
78 // be removed if filename doesn't fit into available_pixel_width. The elided 81 // be removed if filename doesn't fit into available_pixel_width. The elided
79 // filename is forced to have LTR directionality, which means that in RTL UI 82 // filename is forced to have LTR directionality, which means that in RTL UI
80 // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and 83 // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and
81 // PDF (Pop Directional Formatting) mark. 84 // PDF (Pop Directional Formatting) mark.
82 UI_EXPORT string16 ElideFilename(const FilePath& filename, 85 UI_EXPORT string16 ElideFilename(const base::FilePath& filename,
83 const gfx::Font& font, 86 const gfx::Font& font,
84 int available_pixel_width); 87 int available_pixel_width);
85 88
86 // SortedDisplayURL maintains a string from a URL suitable for display to the 89 // SortedDisplayURL maintains a string from a URL suitable for display to the
87 // use. SortedDisplayURL also provides a function used for comparing two 90 // use. SortedDisplayURL also provides a function used for comparing two
88 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. 91 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs.
89 // 92 //
90 // SortedDisplayURL is relatively cheap and supports value semantics. 93 // SortedDisplayURL is relatively cheap and supports value semantics.
91 class UI_EXPORT SortedDisplayURL { 94 class UI_EXPORT SortedDisplayURL {
92 public: 95 public:
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Truncates the string to length characters. This breaks the string at 196 // Truncates the string to length characters. This breaks the string at
194 // the first word break before length, adding the horizontal ellipsis 197 // the first word break before length, adding the horizontal ellipsis
195 // character (unicode character 0x2026) to render ... 198 // character (unicode character 0x2026) to render ...
196 // The supplied string is returned if the string has length characters or 199 // The supplied string is returned if the string has length characters or
197 // less. 200 // less.
198 UI_EXPORT string16 TruncateString(const string16& string, size_t length); 201 UI_EXPORT string16 TruncateString(const string16& string, size_t length);
199 202
200 } // namespace ui 203 } // namespace ui
201 204
202 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ 205 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_
OLDNEW
« no previous file with comments | « ui/base/resource/data_pack.h ('k') | ui/base/win/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698