OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 CreateTouchSelectionControllerAndNotifyIt(); | 802 CreateTouchSelectionControllerAndNotifyIt(); |
803 touch_handles_hidden_due_to_scroll_ = false; | 803 touch_handles_hidden_due_to_scroll_ = false; |
804 } | 804 } |
805 event->SetHandled(); | 805 event->SetHandled(); |
806 break; | 806 break; |
807 default: | 807 default: |
808 return; | 808 return; |
809 } | 809 } |
810 } | 810 } |
811 | 811 |
| 812 // This function is called by BrowserView to execute clipboard commands. |
| 813 bool Textfield::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 814 ui::KeyEvent event(accelerator.type(), accelerator.key_code(), |
| 815 accelerator.modifiers()); |
| 816 ExecuteCommand(GetCommandForKeyEvent(event, HasSelection())); |
| 817 return true; |
| 818 } |
| 819 |
812 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 820 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
813 SelectAll(false); | 821 SelectAll(false); |
814 } | 822 } |
815 | 823 |
816 bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { | 824 bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { |
817 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 825 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
818 // Skip any accelerator handling that conflicts with custom keybindings. | 826 // Skip any accelerator handling that conflicts with custom keybindings. |
819 ui::TextEditKeyBindingsDelegateAuraLinux* delegate = | 827 ui::TextEditKeyBindingsDelegateAuraLinux* delegate = |
820 ui::GetTextEditKeyBindingsDelegate(); | 828 ui::GetTextEditKeyBindingsDelegate(); |
821 std::vector<ui::TextEditCommandAuraLinux> commands; | 829 std::vector<ui::TextEditCommandAuraLinux> commands; |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 RequestFocus(); | 1898 RequestFocus(); |
1891 model_->MoveCursorTo(mouse); | 1899 model_->MoveCursorTo(mouse); |
1892 if (!selection_clipboard_text.empty()) { | 1900 if (!selection_clipboard_text.empty()) { |
1893 model_->InsertText(selection_clipboard_text); | 1901 model_->InsertText(selection_clipboard_text); |
1894 UpdateAfterChange(true, true); | 1902 UpdateAfterChange(true, true); |
1895 } | 1903 } |
1896 OnAfterUserAction(); | 1904 OnAfterUserAction(); |
1897 } | 1905 } |
1898 | 1906 |
1899 } // namespace views | 1907 } // namespace views |
OLD | NEW |