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, |