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

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: fixed lint 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
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..ff46f9c049be955e4e17a876bad58fa4fd3d178b 100644
--- a/ui/base/text/text_elider.h
+++ b/ui/base/text/text_elider.h
@@ -24,6 +24,7 @@ class GURL;
namespace ui {
UI_EXPORT extern const char kEllipsis[];
+UI_EXPORT extern const size_t kMaxProfileUsernameLength;
Alexei Svitkine (slow) 2012/02/28 15:46:22 This is the wrong place for such a constant. ui/ba
gab 2012/02/28 19:20:11 Right, I didn't know where to put this as the reve
// This function takes a GURL object and elides it. It returns a string
// which composed of parts from subdomain, domain, path, filename and query.
@@ -43,6 +44,20 @@ UI_EXPORT string16 ElideUrl(const GURL& url,
int available_pixel_width,
const std::string& languages);
+// Elides only the username portion of the email, if possible, so that the
+// overall email is at most max_email_length characters (e.g.
Alexei Svitkine (slow) 2012/02/28 15:46:22 Please variables parameter names in comments with
+// longusername@host.com --> longuser...@host.com for max_email_length == 20).
+// If the domain name by itself already has more characters than available,
+// we elide the domain name in the middle so that only max_email_length / 2
Alexei Svitkine (slow) 2012/02/28 15:46:22 Nit: Please rephrase in a way that avoids using "w
+// characters remain. We then proceed with the regular eliding 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);
sail 2012/02/28 18:37:20 Eliding using character length is incorrect. Elidi
+
enum ElideBehavior {
// Add ellipsis at the end of the string.
ELIDE_AT_END,

Powered by Google App Engine
This is Rietveld 408576698