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

Side by Side Diff: app/text_elider.h

Issue 6017001: Move ElideString() from base/string_util.cc to app/text_elider.cc to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | « no previous file | app/text_elider.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 APP_TEXT_ELIDER_H_
6 #define APP_TEXT_ELIDER_H_ 6 #define APP_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>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Host name minus 'www.'. Used by Compare. 82 // Host name minus 'www.'. Used by Compare.
83 string16 sort_host_; 83 string16 sort_host_;
84 84
85 // End of the prefix (spec and separator) in display_url_. 85 // End of the prefix (spec and separator) in display_url_.
86 size_t prefix_end_; 86 size_t prefix_end_;
87 87
88 string16 display_url_; 88 string16 display_url_;
89 }; 89 };
90 90
91 // Function to elide strings when the font information is unknown. As
92 // opposed to the above functions, the ElideString() function operates
93 // in terms of character units, not pixels.
94 // If the size of |input| is more than |max_len|, this function returns
95 // true and |input| is shortened into |output| by removing chars in the
96 // middle (they are replaced with up to 3 dots, as size permits).
97 // Ex: ElideString(L"Hello", 10, &str) puts Hello in str and returns false.
98 // ElideString(L"Hello my name is Tom", 10, &str) puts "Hell...Tom" in str
99 // and returns true.
100 // TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly.
101 // TODO(tsepez): Doesn't handle bidi properly
102 bool ElideString(const std::wstring& input, int max_len, std::wstring* output);
103
91 } // namespace gfx. 104 } // namespace gfx.
92 105
93 #endif // APP_TEXT_ELIDER_H_ 106 #endif // APP_TEXT_ELIDER_H_
OLDNEW
« no previous file with comments | « no previous file | app/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698