Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reverted changes for MockInputMethod. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 void FocusManager::ClearStoredFocusedView() { 442 void FocusManager::ClearStoredFocusedView() {
443 SetStoredFocusView(NULL); 443 SetStoredFocusView(NULL);
444 } 444 }
445 445
446 void FocusManager::OnTextInputClientChanged(View* view) { 446 void FocusManager::OnTextInputClientChanged(View* view) {
447 if (view == focused_view_) 447 if (view == focused_view_)
448 FocusTextInputClient(view); 448 FocusTextInputClient(view);
449 } 449 }
450 450
451 void FocusManager::FocusTextInputClient(View* view) { 451 void FocusManager::FocusTextInputClient(View* view) {
James Su 2015/06/12 07:58:50 IMHO, everything related to TextInputClient in thi
Shu Chen 2015/06/12 08:51:31 Removing GetTextInputClient stuff should be done i
452 if (!switches::IsTextInputFocusManagerEnabled()) 452 if (!switches::IsTextInputFocusManagerEnabled())
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698