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

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

Issue 8748001: Make text input type and password visibility bit independent in Textfield (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Textfield(STYLE_OBSCURED) sets TEXT_INPUT_TYPE_PASSWORD Created 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/textfield.h
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index 5ff542d563771b9022b67e6c47d5ae5d57b7068f..455a047b93b540e7235e896fd3efa8a837b9bc9c 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -47,10 +47,13 @@ class VIEWS_EXPORT Textfield : public View {
enum StyleFlags {
STYLE_DEFAULT = 0,
- STYLE_PASSWORD = 1 << 0,
+ STYLE_OBSCURED = 1 << 0,
STYLE_LOWERCASE = 1 << 1
};
+ // The initial text input type is set to TEXT_INPUT_TYPE_PASSWORD
+ // if STYLE_OBSCURED is set in |style|. Otherwise it is set to
+ // TEXT_INPUT_TYPE_TEXT.
Textfield();
explicit Textfield(StyleFlags style);
benrg 2011/12/07 19:17:47 Is it worth adding TextInputType as a second argum
virtual ~Textfield();
@@ -63,14 +66,18 @@ class VIEWS_EXPORT Textfield : public View {
bool read_only() const { return read_only_; }
void SetReadOnly(bool read_only);
- // Gets/Sets whether or not this Textfield is a password field.
- // TODO(bryeung): Currently this is only used in
+ // Gets/sets the STYLE_OBSCURED bit, controlling whether characters in this
+ // Textfield are displayed as asterisks/bullets. This does not affect the
+ // text input type.
+ // TODO(bryeung): Currently SetObscured is only used in
// chrome/browser/chromeos/options/wifi_config_view.cc, which is being
- // converted to WebUI. Please remove this when that happens.
- bool IsPassword() const;
- void SetPassword(bool password);
+ // converted to WebUI. Please remove it when that happens.
+ bool IsObscured() const;
+ void SetObscured(bool obscured);
- // Gets/Sets the input type of this textfield.
+ // Gets/Sets the input type of this textfield. TEXT_INPUT_TYPE_PASSWORD
+ // disables the virtual keyboard and IME, but does not hide the text (use
bryeung 2011/12/07 19:33:15 it does not disable the virtual keyboard, just the
benrg 2011/12/07 21:33:20 Changed. I misinterpreted Peng's comment.
+ // STYLE_OBSCURED for that).
ui::TextInputType GetTextInputType() const;
void SetTextInputType(ui::TextInputType type);

Powered by Google App Engine
This is Rietveld 408576698