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

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

Issue 8747001: Reintroduce password support to NativeTextfieldViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make password in RenderText an instance property and disable cut, copy, D&D, and word skipping 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_views.cc
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 2163dbded451db87a95c4695aca638cc52c1ffb1..92a51e10e192ed3d39ff99305ea0eb9085b8339f 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -299,7 +299,8 @@ void NativeTextfieldViews::WriteDragDataForView(views::View* sender,
int NativeTextfieldViews::GetDragOperationsForView(views::View* sender,
const gfx::Point& p) {
- if (!textfield_->IsEnabled() || !GetRenderText()->IsPointInSelection(p))
+ if (!textfield_->IsEnabled() || textfield_->IsPassword()
+ || !GetRenderText()->IsPointInSelection(p))
return ui::DragDropTypes::DRAG_NONE;
if (sender == this && !textfield_->read_only())
return ui::DragDropTypes::DRAG_MOVE | ui::DragDropTypes::DRAG_COPY;
@@ -398,7 +399,7 @@ void NativeTextfieldViews::UpdateFont() {
}
void NativeTextfieldViews::UpdateIsPassword() {
- model_->set_is_password(textfield_->IsPassword());
+ GetRenderText()->SetIsPassword(textfield_->IsPassword());
OnCaretBoundsChanged();
SchedulePaint();
OnTextInputTypeChanged();
@@ -533,9 +534,9 @@ bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const {
string16 result;
switch (command_id) {
case IDS_APP_CUT:
- return editable && model_->HasSelection();
+ return editable && model_->HasSelection() && !textfield_->IsPassword();
case IDS_APP_COPY:
- return model_->HasSelection();
+ return model_->HasSelection() && !textfield_->IsPassword();
case IDS_APP_PASTE:
ViewsDelegate::views_delegate->GetClipboard()
->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);

Powered by Google App Engine
This is Rietveld 408576698