OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 return editable && model_->HasSelection() && !textfield_->IsObscured(); | 715 return editable && model_->HasSelection() && !textfield_->IsObscured(); |
716 case IDS_APP_COPY: | 716 case IDS_APP_COPY: |
717 return model_->HasSelection() && !textfield_->IsObscured(); | 717 return model_->HasSelection() && !textfield_->IsObscured(); |
718 case IDS_APP_PASTE: | 718 case IDS_APP_PASTE: |
719 ui::Clipboard::GetForCurrentThread()->ReadText( | 719 ui::Clipboard::GetForCurrentThread()->ReadText( |
720 ui::Clipboard::BUFFER_STANDARD, &result); | 720 ui::Clipboard::BUFFER_STANDARD, &result); |
721 return editable && !result.empty(); | 721 return editable && !result.empty(); |
722 case IDS_APP_DELETE: | 722 case IDS_APP_DELETE: |
723 return editable && model_->HasSelection(); | 723 return editable && model_->HasSelection(); |
724 case IDS_APP_SELECT_ALL: | 724 case IDS_APP_SELECT_ALL: |
725 return true; | 725 return !model_->GetText().empty(); |
726 default: | 726 default: |
727 return textfield_->GetController()->IsCommandIdEnabled(command_id); | 727 return textfield_->GetController()->IsCommandIdEnabled(command_id); |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id, | 731 bool NativeTextfieldViews::GetAcceleratorForCommandId(int command_id, |
732 ui::Accelerator* accelerator) { | 732 ui::Accelerator* accelerator) { |
733 return false; | 733 return false; |
734 } | 734 } |
735 | 735 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 | 1388 |
1389 void NativeTextfieldViews::PlatformGestureEventHandling( | 1389 void NativeTextfieldViews::PlatformGestureEventHandling( |
1390 const ui::GestureEvent* event) { | 1390 const ui::GestureEvent* event) { |
1391 #if defined(OS_WIN) && defined(USE_AURA) | 1391 #if defined(OS_WIN) && defined(USE_AURA) |
1392 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 1392 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) |
1393 base::win::DisplayVirtualKeyboard(); | 1393 base::win::DisplayVirtualKeyboard(); |
1394 #endif | 1394 #endif |
1395 } | 1395 } |
1396 | 1396 |
1397 } // namespace views | 1397 } // namespace views |
OLD | NEW |