| 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/focus/focus_manager.h" | 5 #include "ui/views/focus/focus_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 return; | 453 return; |
| 454 | 454 |
| 455 // If the widget is not active, do not steal the text input focus. | 455 // If the widget is not active, do not steal the text input focus. |
| 456 if (!widget_->IsActive()) | 456 if (!widget_->IsActive()) |
| 457 return; | 457 return; |
| 458 | 458 |
| 459 ui::TextInputClient* text_input_client = | 459 ui::TextInputClient* text_input_client = |
| 460 view ? view->GetTextInputClient() : NULL; | 460 view ? view->GetTextInputClient() : NULL; |
| 461 ui::TextInputFocusManager::GetInstance()-> | 461 ui::TextInputFocusManager::GetInstance()-> |
| 462 FocusTextInputClient(text_input_client); | 462 FocusTextInputClient(text_input_client); |
| 463 ui::InputMethod* input_method = widget_->GetHostInputMethod(); | 463 ui::InputMethod* input_method = widget_->GetInputMethod(); |
| 464 if (input_method) { | 464 if (input_method) { |
| 465 input_method->OnTextInputTypeChanged(text_input_client); | 465 input_method->OnTextInputTypeChanged(text_input_client); |
| 466 input_method->OnCaretBoundsChanged(text_input_client); | 466 input_method->OnCaretBoundsChanged(text_input_client); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 void FocusManager::BlurTextInputClient(View* view) { | 470 void FocusManager::BlurTextInputClient(View* view) { |
| 471 if (!switches::IsTextInputFocusManagerEnabled()) | 471 if (!switches::IsTextInputFocusManagerEnabled()) |
| 472 return; | 472 return; |
| 473 | 473 |
| 474 ui::TextInputClient* text_input_client = | 474 ui::TextInputClient* text_input_client = |
| 475 view ? view->GetTextInputClient() : NULL; | 475 view ? view->GetTextInputClient() : NULL; |
| 476 if (text_input_client && text_input_client->HasCompositionText()) { | 476 if (text_input_client && text_input_client->HasCompositionText()) { |
| 477 text_input_client->ConfirmCompositionText(); | 477 text_input_client->ConfirmCompositionText(); |
| 478 ui::InputMethod* input_method = widget_->GetHostInputMethod(); | 478 ui::InputMethod* input_method = widget_->GetInputMethod(); |
| 479 if (input_method && input_method->GetTextInputClient() == text_input_client) | 479 if (input_method && input_method->GetTextInputClient() == text_input_client) |
| 480 input_method->CancelComposition(text_input_client); | 480 input_method->CancelComposition(text_input_client); |
| 481 } | 481 } |
| 482 ui::TextInputFocusManager::GetInstance()-> | 482 ui::TextInputFocusManager::GetInstance()-> |
| 483 BlurTextInputClient(text_input_client); | 483 BlurTextInputClient(text_input_client); |
| 484 } | 484 } |
| 485 | 485 |
| 486 // Find the next (previous if reverse is true) focusable view for the specified | 486 // Find the next (previous if reverse is true) focusable view for the specified |
| 487 // FocusTraversable, starting at the specified view, traversing down the | 487 // FocusTraversable, starting at the specified view, traversing down the |
| 488 // FocusTraversable hierarchy. | 488 // FocusTraversable hierarchy. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 587 } |
| 588 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 588 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
| 589 AdvanceFocus(false); | 589 AdvanceFocus(false); |
| 590 return true; | 590 return true; |
| 591 } | 591 } |
| 592 | 592 |
| 593 return false; | 593 return false; |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace views | 596 } // namespace views |
| OLD | NEW |