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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
34 #include "ui/views/controls/focusable_border.h" | 34 #include "ui/views/controls/focusable_border.h" |
35 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
36 #include "ui/views/controls/menu/menu_runner.h" | 36 #include "ui/views/controls/menu/menu_runner.h" |
37 #include "ui/views/controls/native/native_view_host.h" | 37 #include "ui/views/controls/native/native_view_host.h" |
38 #include "ui/views/controls/textfield/textfield_controller.h" | 38 #include "ui/views/controls/textfield/textfield_controller.h" |
39 #include "ui/views/drag_utils.h" | 39 #include "ui/views/drag_utils.h" |
40 #include "ui/views/metrics.h" | 40 #include "ui/views/metrics.h" |
41 #include "ui/views/native_cursor.h" | 41 #include "ui/views/native_cursor.h" |
42 #include "ui/views/painter.h" | 42 #include "ui/views/painter.h" |
| 43 #include "ui/views/style/platform_style.h" |
43 #include "ui/views/views_delegate.h" | 44 #include "ui/views/views_delegate.h" |
44 #include "ui/views/widget/widget.h" | 45 #include "ui/views/widget/widget.h" |
45 | 46 |
46 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
47 #include "base/win/win_util.h" | 48 #include "base/win/win_util.h" |
48 #endif | 49 #endif |
49 | 50 |
50 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
51 #include "base/strings/utf_string_conversions.h" | 52 #include "base/strings/utf_string_conversions.h" |
52 #include "ui/events/linux/text_edit_command_auralinux.h" | 53 #include "ui/events/linux/text_edit_command_auralinux.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 drop_cursor_visible_(false), | 287 drop_cursor_visible_(false), |
287 initiating_drag_(false), | 288 initiating_drag_(false), |
288 aggregated_clicks_(0), | 289 aggregated_clicks_(0), |
289 drag_start_display_offset_(0), | 290 drag_start_display_offset_(0), |
290 touch_handles_hidden_due_to_scroll_(false), | 291 touch_handles_hidden_due_to_scroll_(false), |
291 weak_ptr_factory_(this) { | 292 weak_ptr_factory_(this) { |
292 set_context_menu_controller(this); | 293 set_context_menu_controller(this); |
293 set_drag_controller(this); | 294 set_drag_controller(this); |
294 GetRenderText()->SetFontList(GetDefaultFontList()); | 295 GetRenderText()->SetFontList(GetDefaultFontList()); |
295 SetBorder(scoped_ptr<Border>(new FocusableBorder())); | 296 SetBorder(scoped_ptr<Border>(new FocusableBorder())); |
296 SetFocusable(true); | 297 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::TEXTFIELD, this); |
297 | 298 |
298 if (ViewsDelegate::GetInstance()) { | 299 if (ViewsDelegate::GetInstance()) { |
299 password_reveal_duration_ = | 300 password_reveal_duration_ = |
300 ViewsDelegate::GetInstance() | 301 ViewsDelegate::GetInstance() |
301 ->GetDefaultTextfieldObscuredRevealDuration(); | 302 ->GetDefaultTextfieldObscuredRevealDuration(); |
302 } | 303 } |
303 | 304 |
304 // These allow BrowserView to pass edit commands from the Chrome menu to us | 305 // These allow BrowserView to pass edit commands from the Chrome menu to us |
305 // when we're focused by simply asking the FocusManager to | 306 // when we're focused by simply asking the FocusManager to |
306 // ProcessAccelerator() with the relevant accelerators. | 307 // ProcessAccelerator() with the relevant accelerators. |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 RequestFocus(); | 1902 RequestFocus(); |
1902 model_->MoveCursorTo(mouse); | 1903 model_->MoveCursorTo(mouse); |
1903 if (!selection_clipboard_text.empty()) { | 1904 if (!selection_clipboard_text.empty()) { |
1904 model_->InsertText(selection_clipboard_text); | 1905 model_->InsertText(selection_clipboard_text); |
1905 UpdateAfterChange(true, true); | 1906 UpdateAfterChange(true, true); |
1906 } | 1907 } |
1907 OnAfterUserAction(); | 1908 OnAfterUserAction(); |
1908 } | 1909 } |
1909 | 1910 |
1910 } // namespace views | 1911 } // namespace views |
OLD | NEW |