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() { |
msw
2013/08/09 18:01:09
Should HandleBlur call GetInputMethod()->OnBlur(),
kochi
2013/08/12 04:50:13
Done.
| |
693 GetRenderText()->set_focused(false); | 694 GetRenderText()->set_focused(false); |
694 // Stop blinking cursor. | 695 // Stop blinking cursor. |
695 cursor_timer_.InvalidateWeakPtrs(); | 696 cursor_timer_.InvalidateWeakPtrs(); |
696 if (is_cursor_visible_) { | 697 if (is_cursor_visible_) { |
697 is_cursor_visible_ = false; | 698 is_cursor_visible_ = false; |
698 RepaintCursor(); | 699 RepaintCursor(); |
699 } | 700 } |
700 | 701 |
701 touch_selection_controller_.reset(); | 702 touch_selection_controller_.reset(); |
702 | 703 |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1494 if (index != -1) { | 1495 if (index != -1) { |
1495 obscured_reveal_timer_.Start( | 1496 obscured_reveal_timer_.Start( |
1496 FROM_HERE, | 1497 FROM_HERE, |
1497 duration, | 1498 duration, |
1498 base::Bind(&NativeTextfieldViews::RevealObscuredChar, | 1499 base::Bind(&NativeTextfieldViews::RevealObscuredChar, |
1499 base::Unretained(this), -1, base::TimeDelta())); | 1500 base::Unretained(this), -1, base::TimeDelta())); |
1500 } | 1501 } |
1501 } | 1502 } |
1502 | 1503 |
1503 } // namespace views | 1504 } // namespace views |
OLD | NEW |