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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 SchedulePaint(); | 1746 SchedulePaint(); |
1747 | 1747 |
1748 if (index != -1) { | 1748 if (index != -1) { |
1749 password_reveal_timer_.Start(FROM_HERE, password_reveal_duration_, | 1749 password_reveal_timer_.Start(FROM_HERE, password_reveal_duration_, |
1750 base::Bind(&Textfield::RevealPasswordChar, | 1750 base::Bind(&Textfield::RevealPasswordChar, |
1751 weak_ptr_factory_.GetWeakPtr(), -1)); | 1751 weak_ptr_factory_.GetWeakPtr(), -1)); |
1752 } | 1752 } |
1753 } | 1753 } |
1754 | 1754 |
1755 void Textfield::CreateTouchSelectionControllerAndNotifyIt() { | 1755 void Textfield::CreateTouchSelectionControllerAndNotifyIt() { |
| 1756 if (!HasFocus()) |
| 1757 return; |
| 1758 |
1756 if (!touch_selection_controller_) { | 1759 if (!touch_selection_controller_) { |
1757 touch_selection_controller_.reset( | 1760 touch_selection_controller_.reset( |
1758 ui::TouchSelectionController::create(this)); | 1761 ui::TouchSelectionController::create(this)); |
1759 } | 1762 } |
1760 if (touch_selection_controller_) | 1763 if (touch_selection_controller_) |
1761 touch_selection_controller_->SelectionChanged(); | 1764 touch_selection_controller_->SelectionChanged(); |
1762 } | 1765 } |
1763 | 1766 |
1764 void Textfield::UpdateSelectionClipboard() const { | 1767 void Textfield::UpdateSelectionClipboard() const { |
1765 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1768 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
(...skipping 24 matching lines...) Expand all Loading... |
1790 const size_t length = selection_clipboard_text.length(); | 1793 const size_t length = selection_clipboard_text.length(); |
1791 range = gfx::Range(range.start() + length, range.end() + length); | 1794 range = gfx::Range(range.start() + length, range.end() + length); |
1792 } | 1795 } |
1793 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1796 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1794 UpdateAfterChange(true, true); | 1797 UpdateAfterChange(true, true); |
1795 OnAfterUserAction(); | 1798 OnAfterUserAction(); |
1796 } | 1799 } |
1797 } | 1800 } |
1798 | 1801 |
1799 } // namespace views | 1802 } // namespace views |
OLD | NEW |