| 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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 drag_start_display_offset_(0), | 252 drag_start_display_offset_(0), |
| 253 touch_handles_hidden_due_to_scroll_(false), | 253 touch_handles_hidden_due_to_scroll_(false), |
| 254 use_focus_ring_(ui::MaterialDesignController::IsSecondaryUiMaterial()), | 254 use_focus_ring_(ui::MaterialDesignController::IsSecondaryUiMaterial()), |
| 255 weak_ptr_factory_(this) { | 255 weak_ptr_factory_(this) { |
| 256 set_context_menu_controller(this); | 256 set_context_menu_controller(this); |
| 257 set_drag_controller(this); | 257 set_drag_controller(this); |
| 258 GetRenderText()->SetFontList(GetDefaultFontList()); | 258 GetRenderText()->SetFontList(GetDefaultFontList()); |
| 259 View::SetBorder(std::unique_ptr<Border>(new FocusableBorder())); | 259 View::SetBorder(std::unique_ptr<Border>(new FocusableBorder())); |
| 260 SetFocusBehavior(FocusBehavior::ALWAYS); | 260 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 261 | 261 |
| 262 // On Linux, middle click should update or paste the selection clipboard. | |
| 263 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
| 264 selection_controller_.set_handles_selection_clipboard(true); | |
| 265 #endif | |
| 266 | |
| 267 // These allow BrowserView to pass edit commands from the Chrome menu to us | 262 // These allow BrowserView to pass edit commands from the Chrome menu to us |
| 268 // when we're focused by simply asking the FocusManager to | 263 // when we're focused by simply asking the FocusManager to |
| 269 // ProcessAccelerator() with the relevant accelerators. | 264 // ProcessAccelerator() with the relevant accelerators. |
| 270 AddAccelerator(ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN)); | 265 AddAccelerator(ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN)); |
| 271 AddAccelerator(ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN)); | 266 AddAccelerator(ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN)); |
| 272 AddAccelerator(ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN)); | 267 AddAccelerator(ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN)); |
| 273 } | 268 } |
| 274 | 269 |
| 275 Textfield::~Textfield() { | 270 Textfield::~Textfield() { |
| 276 if (GetInputMethod()) { | 271 if (GetInputMethod()) { |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 // Textfield, SelectionControllerDelegate overrides: | 1764 // Textfield, SelectionControllerDelegate overrides: |
| 1770 | 1765 |
| 1771 gfx::RenderText* Textfield::GetRenderTextForSelectionController() { | 1766 gfx::RenderText* Textfield::GetRenderTextForSelectionController() { |
| 1772 return GetRenderText(); | 1767 return GetRenderText(); |
| 1773 } | 1768 } |
| 1774 | 1769 |
| 1775 bool Textfield::IsReadOnly() const { | 1770 bool Textfield::IsReadOnly() const { |
| 1776 return read_only(); | 1771 return read_only(); |
| 1777 } | 1772 } |
| 1778 | 1773 |
| 1774 bool Textfield::SupportsDrag() const { |
| 1775 return true; |
| 1776 } |
| 1777 |
| 1779 void Textfield::SetTextBeingDragged(bool value) { | 1778 void Textfield::SetTextBeingDragged(bool value) { |
| 1780 initiating_drag_ = value; | 1779 initiating_drag_ = value; |
| 1781 } | 1780 } |
| 1782 | 1781 |
| 1783 int Textfield::GetViewHeight() const { | 1782 int Textfield::GetViewHeight() const { |
| 1784 return height(); | 1783 return height(); |
| 1785 } | 1784 } |
| 1786 | 1785 |
| 1787 int Textfield::GetViewWidth() const { | 1786 int Textfield::GetViewWidth() const { |
| 1788 return width(); | 1787 return width(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 } | 2047 } |
| 2049 | 2048 |
| 2050 void Textfield::OnCursorBlinkTimerFired() { | 2049 void Textfield::OnCursorBlinkTimerFired() { |
| 2051 DCHECK(ShouldBlinkCursor()); | 2050 DCHECK(ShouldBlinkCursor()); |
| 2052 gfx::RenderText* render_text = GetRenderText(); | 2051 gfx::RenderText* render_text = GetRenderText(); |
| 2053 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2052 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2054 RepaintCursor(); | 2053 RepaintCursor(); |
| 2055 } | 2054 } |
| 2056 | 2055 |
| 2057 } // namespace views | 2056 } // namespace views |
| OLD | NEW |