| 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(); | |
| 684 OnCaretBoundsChanged(); | 683 OnCaretBoundsChanged(); |
| 685 // Start blinking cursor. | 684 // Start blinking cursor. |
| 686 base::MessageLoop::current()->PostDelayedTask( | 685 base::MessageLoop::current()->PostDelayedTask( |
| 687 FROM_HERE, | 686 FROM_HERE, |
| 688 base::Bind(&NativeTextfieldViews::UpdateCursor, | 687 base::Bind(&NativeTextfieldViews::UpdateCursor, |
| 689 cursor_timer_.GetWeakPtr()), | 688 cursor_timer_.GetWeakPtr()), |
| 690 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); | 689 base::TimeDelta::FromMilliseconds(kCursorBlinkCycleMs / 2)); |
| 691 } | 690 } |
| 692 | 691 |
| 693 void NativeTextfieldViews::HandleBlur() { | 692 void NativeTextfieldViews::HandleBlur() { |
| 694 GetRenderText()->set_focused(false); | 693 GetRenderText()->set_focused(false); |
| 695 GetInputMethod()->OnBlur(); | |
| 696 // Stop blinking cursor. | 694 // Stop blinking cursor. |
| 697 cursor_timer_.InvalidateWeakPtrs(); | 695 cursor_timer_.InvalidateWeakPtrs(); |
| 698 if (is_cursor_visible_) { | 696 if (is_cursor_visible_) { |
| 699 is_cursor_visible_ = false; | 697 is_cursor_visible_ = false; |
| 700 RepaintCursor(); | 698 RepaintCursor(); |
| 701 } | 699 } |
| 702 | 700 |
| 703 touch_selection_controller_.reset(); | 701 touch_selection_controller_.reset(); |
| 704 | 702 |
| 705 ClearSelection(); | 703 ClearSelection(); |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 if (index != -1) { | 1501 if (index != -1) { |
| 1504 obscured_reveal_timer_.Start( | 1502 obscured_reveal_timer_.Start( |
| 1505 FROM_HERE, | 1503 FROM_HERE, |
| 1506 duration, | 1504 duration, |
| 1507 base::Bind(&NativeTextfieldViews::RevealObscuredChar, | 1505 base::Bind(&NativeTextfieldViews::RevealObscuredChar, |
| 1508 base::Unretained(this), -1, base::TimeDelta())); | 1506 base::Unretained(this), -1, base::TimeDelta())); |
| 1509 } | 1507 } |
| 1510 } | 1508 } |
| 1511 | 1509 |
| 1512 } // namespace views | 1510 } // namespace views |
| OLD | NEW |