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

Unified Diff: ui/views/controls/textfield/native_textfield_win.cc

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/native_textfield_win.cc
diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc
index fcc782b4a212b57ef1cbfe1a10c7c8ad59a89615..fdc347b925adc406ef263155cc472a7a87b2f8b8 100644
--- a/ui/views/controls/textfield/native_textfield_win.cc
+++ b/ui/views/controls/textfield/native_textfield_win.cc
@@ -100,7 +100,7 @@ NativeTextfieldWin::NativeTextfieldWin(Textfield* textfield)
did_load_library_ = !!LoadLibrary(L"riched20.dll");
DWORD style = kDefaultEditStyle | ES_AUTOHSCROLL;
- if (textfield_->style() & Textfield::STYLE_PASSWORD)
+ if (textfield_->IsObscured())
style |= ES_PASSWORD;
if (textfield_->read_only())
@@ -113,7 +113,7 @@ NativeTextfieldWin::NativeTextfieldWin(Textfield* textfield)
Create(textfield_->GetWidget()->GetNativeView(), r, NULL, style, ex_style);
if (textfield_->style() & Textfield::STYLE_LOWERCASE) {
- DCHECK((textfield_->style() & Textfield::STYLE_PASSWORD) == 0);
+ DCHECK(!textfield_->IsObscured());
SetEditStyle(SES_LOWERCASE, SES_LOWERCASE);
}
@@ -260,9 +260,9 @@ void NativeTextfieldWin::UpdateFont() {
UpdateTextColor();
}
-void NativeTextfieldWin::UpdateIsPassword() {
+void NativeTextfieldWin::UpdateIsObscured() {
// TODO: Need to implement for Windows.
- UpdateAccessibleState(STATE_SYSTEM_PROTECTED, textfield_->IsPassword());
+ UpdateAccessibleState(STATE_SYSTEM_PROTECTED, textfield_->IsObscured());
}
void NativeTextfieldWin::UpdateEnabled() {
@@ -395,8 +395,8 @@ bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const {
switch (command_id) {
case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo();
case IDS_APP_CUT: return !textfield_->read_only() &&
- !textfield_->IsPassword() && !!CanCut();
- case IDS_APP_COPY: return !!CanCopy() && !textfield_->IsPassword();
+ !textfield_->IsObscured() && !!CanCut();
+ case IDS_APP_COPY: return !!CanCopy() && !textfield_->IsObscured();
case IDS_APP_PASTE: return !textfield_->read_only() && !!CanPaste();
case IDS_APP_SELECT_ALL: return !!CanSelectAll();
default: NOTREACHED();
@@ -522,7 +522,7 @@ void NativeTextfieldWin::OnContextMenu(HWND window, const POINT& point) {
}
void NativeTextfieldWin::OnCopy() {
- if (textfield_->IsPassword())
+ if (textfield_->IsObscured())
return;
const string16 text(GetSelectedText());
@@ -534,7 +534,7 @@ void NativeTextfieldWin::OnCopy() {
}
void NativeTextfieldWin::OnCut() {
- if (textfield_->read_only() || textfield_->IsPassword())
+ if (textfield_->read_only() || textfield_->IsObscured())
return;
OnCopy();

Powered by Google App Engine
This is Rietveld 408576698