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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 1182523003: Removes TextInputFocusManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit per comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/focus/focus_manager.h ('k') | ui/views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager.cc
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index 86acea3c79c837208580ea6e261e7a84a7a3840b..c84c3152734d2de2994673aee76b89365884d19d 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -13,8 +13,6 @@
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_client.h"
-#include "ui/base/ime/text_input_focus_manager.h"
-#include "ui/base/ui_base_switches_util.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/views/focus/focus_manager_delegate.h"
@@ -301,13 +299,8 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view,
void FocusManager::SetFocusedViewWithReason(
View* view, FocusChangeReason reason) {
- if (focused_view_ == view) {
- // In the case that the widget lost the focus and gained it back without
- // changing the focused view, we have to make the text input client focused.
- // TODO(yukishiino): Remove this hack once we fix http://crbug.com/383236
- FocusTextInputClient(focused_view_);
+ if (focused_view_ == view)
return;
- }
base::AutoReset<bool> auto_changing_focus(&is_changing_focus_, true);
// Update the reason for the focus change (since this is checked by
@@ -318,18 +311,14 @@ void FocusManager::SetFocusedViewWithReason(
View* old_focused_view = focused_view_;
focused_view_ = view;
- if (old_focused_view) {
+ if (old_focused_view)
old_focused_view->Blur();
- BlurTextInputClient(old_focused_view);
- }
// Also make |focused_view_| the stored focus view. This way the stored focus
// view is remembered if focus changes are requested prior to a show or while
// hidden.
SetStoredFocusView(focused_view_);
- if (focused_view_) {
- FocusTextInputClient(focused_view_);
+ if (focused_view_)
focused_view_->Focus();
- }
FOR_EACH_OBSERVER(FocusChangeListener, focus_change_listeners_,
OnDidChangeFocus(old_focused_view, focused_view_));
@@ -443,46 +432,6 @@ void FocusManager::ClearStoredFocusedView() {
SetStoredFocusView(NULL);
}
-void FocusManager::OnTextInputClientChanged(View* view) {
- if (view == focused_view_)
- FocusTextInputClient(view);
-}
-
-void FocusManager::FocusTextInputClient(View* view) {
- if (!switches::IsTextInputFocusManagerEnabled())
- return;
-
- // If the widget is not active, do not steal the text input focus.
- if (!widget_->IsActive())
- return;
-
- ui::TextInputClient* text_input_client =
- view ? view->GetTextInputClient() : NULL;
- ui::TextInputFocusManager::GetInstance()->
- FocusTextInputClient(text_input_client);
- ui::InputMethod* input_method = widget_->GetHostInputMethod();
- if (input_method) {
- input_method->OnTextInputTypeChanged(text_input_client);
- input_method->OnCaretBoundsChanged(text_input_client);
- }
-}
-
-void FocusManager::BlurTextInputClient(View* view) {
- if (!switches::IsTextInputFocusManagerEnabled())
- return;
-
- ui::TextInputClient* text_input_client =
- view ? view->GetTextInputClient() : NULL;
- if (text_input_client && text_input_client->HasCompositionText()) {
- text_input_client->ConfirmCompositionText();
- ui::InputMethod* input_method = widget_->GetHostInputMethod();
- if (input_method && input_method->GetTextInputClient() == text_input_client)
- input_method->CancelComposition(text_input_client);
- }
- ui::TextInputFocusManager::GetInstance()->
- BlurTextInputClient(text_input_client);
-}
-
// Find the next (previous if reverse is true) focusable view for the specified
// FocusTraversable, starting at the specified view, traversing down the
// FocusTraversable hierarchy.
« no previous file with comments | « ui/views/focus/focus_manager.h ('k') | ui/views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698