Chromium Code Reviews| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 drop_cursor_visible_(false), | 287 drop_cursor_visible_(false), |
| 288 initiating_drag_(false), | 288 initiating_drag_(false), |
| 289 aggregated_clicks_(0), | 289 aggregated_clicks_(0), |
| 290 drag_start_display_offset_(0), | 290 drag_start_display_offset_(0), |
| 291 touch_handles_hidden_due_to_scroll_(false), | 291 touch_handles_hidden_due_to_scroll_(false), |
| 292 weak_ptr_factory_(this) { | 292 weak_ptr_factory_(this) { |
| 293 set_context_menu_controller(this); | 293 set_context_menu_controller(this); |
| 294 set_drag_controller(this); | 294 set_drag_controller(this); |
| 295 GetRenderText()->SetFontList(GetDefaultFontList()); | 295 GetRenderText()->SetFontList(GetDefaultFontList()); |
| 296 SetBorder(std::unique_ptr<Border>(new FocusableBorder())); | 296 SetBorder(std::unique_ptr<Border>(new FocusableBorder())); |
| 297 | |
| 298 // On Mac, only textfields and list controls are focusable by default. Hence | |
|
tapted
2016/04/20 06:05:58
Same here. E.g. saying "only <foo>" suggests we're
karandeepb
2016/05/03 02:54:13
Done.
| |
| 299 // use ALWAYS focus behavior. | |
| 297 SetFocusBehavior(FocusBehavior::ALWAYS); | 300 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 298 | 301 |
| 299 if (ViewsDelegate::GetInstance()) { | 302 if (ViewsDelegate::GetInstance()) { |
| 300 password_reveal_duration_ = | 303 password_reveal_duration_ = |
| 301 ViewsDelegate::GetInstance() | 304 ViewsDelegate::GetInstance() |
| 302 ->GetDefaultTextfieldObscuredRevealDuration(); | 305 ->GetDefaultTextfieldObscuredRevealDuration(); |
| 303 } | 306 } |
| 304 | 307 |
| 305 // These allow BrowserView to pass edit commands from the Chrome menu to us | 308 // These allow BrowserView to pass edit commands from the Chrome menu to us |
| 306 // when we're focused by simply asking the FocusManager to | 309 // when we're focused by simply asking the FocusManager to |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1913 RequestFocus(); | 1916 RequestFocus(); |
| 1914 model_->MoveCursorTo(mouse); | 1917 model_->MoveCursorTo(mouse); |
| 1915 if (!selection_clipboard_text.empty()) { | 1918 if (!selection_clipboard_text.empty()) { |
| 1916 model_->InsertText(selection_clipboard_text); | 1919 model_->InsertText(selection_clipboard_text); |
| 1917 UpdateAfterChange(true, true); | 1920 UpdateAfterChange(true, true); |
| 1918 } | 1921 } |
| 1919 OnAfterUserAction(); | 1922 OnAfterUserAction(); |
| 1920 } | 1923 } |
| 1921 | 1924 |
| 1922 } // namespace views | 1925 } // namespace views |
| OLD | NEW |