| 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 f3189ec272653b94cd1c1a0b4bd9dace4a844e84..b525c2c731cd0d7826b3fb5959dc45f04fe5b369 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;
|
| @@ -400,7 +401,7 @@ void NativeTextfieldViews::UpdateFont() {
|
| }
|
|
|
| void NativeTextfieldViews::UpdateIsPassword() {
|
| - model_->set_is_password(textfield_->IsPassword());
|
| + GetRenderText()->SetObscured(textfield_->IsPassword());
|
| OnCaretBoundsChanged();
|
| SchedulePaint();
|
| OnTextInputTypeChanged();
|
| @@ -537,9 +538,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);
|
| @@ -561,23 +562,20 @@ bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id,
|
|
|
| void NativeTextfieldViews::ExecuteCommand(int command_id) {
|
| bool text_changed = false;
|
| - bool editable = !textfield_->read_only();
|
| + DCHECK(IsCommandIdEnabled(command_id));
|
| OnBeforeUserAction();
|
| switch (command_id) {
|
| case IDS_APP_CUT:
|
| - if (editable)
|
| - text_changed = model_->Cut();
|
| + text_changed = model_->Cut();
|
| break;
|
| case IDS_APP_COPY:
|
| model_->Copy();
|
| break;
|
| case IDS_APP_PASTE:
|
| - if (editable)
|
| - text_changed = Paste();
|
| + text_changed = Paste();
|
| break;
|
| case IDS_APP_DELETE:
|
| - if (editable)
|
| - text_changed = model_->Delete();
|
| + text_changed = model_->Delete();
|
| break;
|
| case IDS_APP_SELECT_ALL:
|
| SelectAll();
|
|
|