Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/textfield/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 if (native_wrapper_) | 380 if (native_wrapper_) |
| 381 native_wrapper_->HandleFocus(); | 381 native_wrapper_->HandleFocus(); |
| 382 | 382 |
| 383 // Forward the focus to the wrapper if it exists. | 383 // Forward the focus to the wrapper if it exists. |
| 384 if (!native_wrapper_ || !native_wrapper_->SetFocus()) { | 384 if (!native_wrapper_ || !native_wrapper_->SetFocus()) { |
| 385 // If there is no wrapper or the wrapper didn't take focus, call | 385 // If there is no wrapper or the wrapper didn't take focus, call |
| 386 // View::Focus to clear the native focus so that we still get | 386 // View::Focus to clear the native focus so that we still get |
| 387 // keyboard messages. | 387 // keyboard messages. |
| 388 View::OnFocus(); | 388 View::OnFocus(); |
| 389 } | 389 } |
| 390 | |
| 391 if(select_all_on_focus()) | |
| 392 SelectAll(); | |
|
Ben Goodger (Google)
2011/11/09 17:11:08
unit test?
msw
2011/11/10 06:12:03
Done.
| |
| 390 } | 393 } |
| 391 | 394 |
| 392 void Textfield::OnBlur() { | 395 void Textfield::OnBlur() { |
| 393 if (native_wrapper_) | 396 if (native_wrapper_) |
| 394 native_wrapper_->HandleBlur(); | 397 native_wrapper_->HandleBlur(); |
| 395 } | 398 } |
| 396 | 399 |
| 397 void Textfield::GetAccessibleState(ui::AccessibleViewState* state) { | 400 void Textfield::GetAccessibleState(ui::AccessibleViewState* state) { |
| 398 state->role = ui::AccessibilityTypes::ROLE_TEXT; | 401 state->role = ui::AccessibilityTypes::ROLE_TEXT; |
| 399 state->name = accessible_name_; | 402 state->name = accessible_name_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 } | 447 } |
| 445 #endif | 448 #endif |
| 446 } | 449 } |
| 447 } | 450 } |
| 448 | 451 |
| 449 std::string Textfield::GetClassName() const { | 452 std::string Textfield::GetClassName() const { |
| 450 return kViewClassName; | 453 return kViewClassName; |
| 451 } | 454 } |
| 452 | 455 |
| 453 } // namespace views | 456 } // namespace views |
| OLD | NEW |