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

Unified Diff: ui/views/controls/label.h

Issue 222033002: Add an 'obscured' flag to views::Label. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: *facepalm* Created 6 years, 9 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 | « no previous file | ui/views/controls/label.cc » ('j') | ui/views/controls/label.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.h
diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h
index 463afac9d40d5c6cbe9741b92ecded872de09852..5aac282d0e801710e47f36e27f19dae18293146e 100644
--- a/ui/views/controls/label.h
+++ b/ui/views/controls/label.h
@@ -132,6 +132,15 @@ class VIEWS_EXPORT Label : public View {
bool is_multi_line() const { return is_multi_line_; }
void SetMultiLine(bool multi_line);
+ // Get or set if the label text should be obscured before rendering (e.g.
+ // should "Password!" display as "*********"); default is false.
+ bool is_obscured() const { return is_obscured_; }
+ void SetObscured(bool obscured);
+
+ // Get the label text as displayed to the user, respecting the 'obscured'
msw 2014/04/03 01:38:48 nit: drop the word "label" for a one-line comment.
Mike West 2014/04/03 08:17:25 Done.
+ // flag.
+ const base::string16& display_text() const;
msw 2014/04/03 01:38:48 nit: non-inlined functions should have CamelCaseNa
Mike West 2014/04/03 08:17:25 Done.
+
// Sets whether the label text can be split on words.
// Default is false. This only works when is_multi_line is true.
void SetAllowCharacterBreak(bool allow_character_break);
@@ -239,6 +248,7 @@ class VIEWS_EXPORT Label : public View {
bool ShouldShowDefaultTooltip() const;
base::string16 text_;
+ base::string16 obscured_text_;
msw 2014/04/03 01:38:48 nit: Call this |layout_text| to be consistent with
Mike West 2014/04/03 08:17:25 Done.
gfx::FontList font_list_;
SkColor requested_enabled_color_;
SkColor actual_enabled_color_;
@@ -256,6 +266,7 @@ class VIEWS_EXPORT Label : public View {
mutable bool text_size_valid_;
int line_height_;
bool is_multi_line_;
+ bool is_obscured_;
bool allow_character_break_;
ElideBehavior elide_behavior_;
gfx::HorizontalAlignment horizontal_alignment_;
« no previous file with comments | « no previous file | ui/views/controls/label.cc » ('j') | ui/views/controls/label.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698