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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 673 } |
674 | 674 |
675 bool NativeTextfieldViews::HandleKeyReleased(const ui::KeyEvent& e) { | 675 bool NativeTextfieldViews::HandleKeyReleased(const ui::KeyEvent& e) { |
676 return false; // crbug.com/127520 | 676 return false; // crbug.com/127520 |
677 } | 677 } |
678 | 678 |
679 void NativeTextfieldViews::HandleFocus() { | 679 void NativeTextfieldViews::HandleFocus() { |
680 GetRenderText()->set_focused(true); | 680 GetRenderText()->set_focused(true); |
681 is_cursor_visible_ = true; | 681 is_cursor_visible_ = true; |
682 SchedulePaint(); | 682 SchedulePaint(); |
| 683 GetInputMethod()->OnFocus(); |
683 OnCaretBoundsChanged(); | 684 OnCaretBoundsChanged(); |
684 // Start blinking cursor. | 685 // Start blinking cursor. |
685 base::MessageLoop::current()->PostDelayedTask( | 686 base::MessageLoop::current()->PostDelayedTask( |
686 FROM_HERE, | 687 FROM_HERE, |
687 base::Bind(&NativeTextfieldViews::UpdateCursor, | 688 base::Bind(&NativeTextfieldViews::UpdateCursor, |
688 cursor_timer_.GetWeakPtr()), | 689 cursor_timer_.GetWeakPtr()), |
689 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); | 690 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); |
690 } | 691 } |
691 | 692 |
692 void NativeTextfieldViews::HandleBlur() { | 693 void NativeTextfieldViews::HandleBlur() { |
693 GetRenderText()->set_focused(false); | 694 GetRenderText()->set_focused(false); |
| 695 GetInputMethod()->OnBlur(); |
694 // Stop blinking cursor. | 696 // Stop blinking cursor. |
695 cursor_timer_.InvalidateWeakPtrs(); | 697 cursor_timer_.InvalidateWeakPtrs(); |
696 if (is_cursor_visible_) { | 698 if (is_cursor_visible_) { |
697 is_cursor_visible_ = false; | 699 is_cursor_visible_ = false; |
698 RepaintCursor(); | 700 RepaintCursor(); |
699 } | 701 } |
700 | 702 |
701 touch_selection_controller_.reset(); | 703 touch_selection_controller_.reset(); |
702 | 704 |
703 ClearSelection(); | 705 ClearSelection(); |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 if (index != -1) { | 1513 if (index != -1) { |
1512 obscured_reveal_timer_.Start( | 1514 obscured_reveal_timer_.Start( |
1513 FROM_HERE, | 1515 FROM_HERE, |
1514 duration, | 1516 duration, |
1515 base::Bind(&NativeTextfieldViews::RevealObscuredChar, | 1517 base::Bind(&NativeTextfieldViews::RevealObscuredChar, |
1516 base::Unretained(this), -1, base::TimeDelta())); | 1518 base::Unretained(this), -1, base::TimeDelta())); |
1517 } | 1519 } |
1518 } | 1520 } |
1519 | 1521 |
1520 } // namespace views | 1522 } // namespace views |
OLD | NEW |