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

Unified Diff: ui/base/text/text_elider.h

Issue 9489011: Elide long emails in the wrench and profile menus. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rev2 Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/text/text_elider.h
diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h
index b2ec600c2016d2f3b300c7b8e2fac0311b0aad00..3c7d878b9d969b16e6c9bf9781c09a90ba622e0d 100644
--- a/ui/base/text/text_elider.h
+++ b/ui/base/text/text_elider.h
@@ -24,6 +24,22 @@ class GURL;
namespace ui {
UI_EXPORT extern const char kEllipsis[];
+UI_EXPORT extern const size_t kMaxProfileUsernameLength;
+
+// Elides only the username portion of the |email|, if possible, so that the
+// returned email is at most |max_email_length| characters (e.g.
+// longusername@host.com --> longuser...@host.com for |max_email_length| == 20).
+// If the domain name by itself already has more characters than available:
+// it is elided in the middle so that only |max_email_length| / 2 characters
+// remain; the username is then elided following the regular process described
+// above.
+// In any scenario: the string returned will never be longer than
+// |max_email_length| including the inserted ellipses; and the elided strings
+// will have at least one character remaining on either side of the '@'(other
+// than the ellipsis-es).
+// This function assumes |max_email_length| is >= 5.
+UI_EXPORT string16 ElideEmail(const string16& email,
+ size_t max_email_length);
gab 2012/02/28 19:23:01 I moved this here as ElideEmail is above ElideUrl
// This function takes a GURL object and elides it. It returns a string
// which composed of parts from subdomain, domain, path, filename and query.
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698