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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 drop_cursor_visible_(false), | 286 drop_cursor_visible_(false), |
287 initiating_drag_(false), | 287 initiating_drag_(false), |
288 aggregated_clicks_(0), | 288 aggregated_clicks_(0), |
289 drag_start_display_offset_(0), | 289 drag_start_display_offset_(0), |
290 touch_handles_hidden_due_to_scroll_(false), | 290 touch_handles_hidden_due_to_scroll_(false), |
291 weak_ptr_factory_(this) { | 291 weak_ptr_factory_(this) { |
292 set_context_menu_controller(this); | 292 set_context_menu_controller(this); |
293 set_drag_controller(this); | 293 set_drag_controller(this); |
294 GetRenderText()->SetFontList(GetDefaultFontList()); | 294 GetRenderText()->SetFontList(GetDefaultFontList()); |
295 SetBorder(scoped_ptr<Border>(new FocusableBorder())); | 295 SetBorder(scoped_ptr<Border>(new FocusableBorder())); |
296 SetFocusable(true); | 296 |
| 297 // On Mac, only textfields and lists are focusable by default. Hence use |
| 298 // ALWAYS instead of CONTROL focus behavior. |
| 299 SetFocusBehavior(ALWAYS); |
297 | 300 |
298 if (ViewsDelegate::GetInstance()) { | 301 if (ViewsDelegate::GetInstance()) { |
299 password_reveal_duration_ = | 302 password_reveal_duration_ = |
300 ViewsDelegate::GetInstance() | 303 ViewsDelegate::GetInstance() |
301 ->GetDefaultTextfieldObscuredRevealDuration(); | 304 ->GetDefaultTextfieldObscuredRevealDuration(); |
302 } | 305 } |
303 | 306 |
304 // These allow BrowserView to pass edit commands from the Chrome menu to us | 307 // These allow BrowserView to pass edit commands from the Chrome menu to us |
305 // when we're focused by simply asking the FocusManager to | 308 // when we're focused by simply asking the FocusManager to |
306 // ProcessAccelerator() with the relevant accelerators. | 309 // ProcessAccelerator() with the relevant accelerators. |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 RequestFocus(); | 1904 RequestFocus(); |
1902 model_->MoveCursorTo(mouse); | 1905 model_->MoveCursorTo(mouse); |
1903 if (!selection_clipboard_text.empty()) { | 1906 if (!selection_clipboard_text.empty()) { |
1904 model_->InsertText(selection_clipboard_text); | 1907 model_->InsertText(selection_clipboard_text); |
1905 UpdateAfterChange(true, true); | 1908 UpdateAfterChange(true, true); |
1906 } | 1909 } |
1907 OnAfterUserAction(); | 1910 OnAfterUserAction(); |
1908 } | 1911 } |
1909 | 1912 |
1910 } // namespace views | 1913 } // namespace views |
OLD | NEW |