| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 764 } |
| 765 event->SetHandled(); | 765 event->SetHandled(); |
| 766 break; | 766 break; |
| 767 default: | 767 default: |
| 768 return; | 768 return; |
| 769 } | 769 } |
| 770 } | 770 } |
| 771 | 771 |
| 772 // This function is called by BrowserView to execute clipboard commands. | 772 // This function is called by BrowserView to execute clipboard commands. |
| 773 bool Textfield::AcceleratorPressed(const ui::Accelerator& accelerator) { | 773 bool Textfield::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 774 ui::KeyEvent event(accelerator.type(), accelerator.key_code(), | 774 ui::KeyEvent event( |
| 775 accelerator.modifiers()); | 775 accelerator.key_state() == ui::Accelerator::KeyState::PRESSED |
| 776 ? ui::ET_KEY_PRESSED |
| 777 : ui::ET_KEY_RELEASED, |
| 778 accelerator.key_code(), accelerator.modifiers()); |
| 776 ExecuteTextEditCommand(GetCommandForKeyEvent(event)); | 779 ExecuteTextEditCommand(GetCommandForKeyEvent(event)); |
| 777 return true; | 780 return true; |
| 778 } | 781 } |
| 779 | 782 |
| 780 bool Textfield::CanHandleAccelerators() const { | 783 bool Textfield::CanHandleAccelerators() const { |
| 781 return GetRenderText()->focused() && View::CanHandleAccelerators(); | 784 return GetRenderText()->focused() && View::CanHandleAccelerators(); |
| 782 } | 785 } |
| 783 | 786 |
| 784 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 787 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
| 785 SelectAll(false); | 788 SelectAll(false); |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 cursor_blink_timer_.Stop(); | 2098 cursor_blink_timer_.Stop(); |
| 2096 } | 2099 } |
| 2097 | 2100 |
| 2098 void Textfield::OnCursorBlinkTimerFired() { | 2101 void Textfield::OnCursorBlinkTimerFired() { |
| 2099 DCHECK(ShouldBlinkCursor()); | 2102 DCHECK(ShouldBlinkCursor()); |
| 2100 cursor_view_.SetVisible(!cursor_view_.visible()); | 2103 cursor_view_.SetVisible(!cursor_view_.visible()); |
| 2101 UpdateCursorViewPosition(); | 2104 UpdateCursorViewPosition(); |
| 2102 } | 2105 } |
| 2103 | 2106 |
| 2104 } // namespace views | 2107 } // namespace views |
| OLD | NEW |