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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 173803002: Redesigns the text input focus handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 9 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
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 40b7225da9d3ceb2b8f97589e8a665170712d0d6..577cab1baf1e4130ecb1263b123fde02bb2b10e8 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -18,6 +18,7 @@
#include "ui/aura/window_property.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h"
+#include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/display.h"
@@ -38,8 +39,8 @@
#include "ui/views/corewm/visibility_controller.h"
#include "ui/views/corewm/window_modality_controller.h"
#include "ui/views/drag_utils.h"
-#include "ui/views/ime/input_method.h"
#include "ui/views/ime/input_method_bridge.h"
+#include "ui/views/ime/null_input_method.h"
#include "ui/views/widget/desktop_aura/desktop_capture_client.h"
#include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
@@ -626,6 +627,9 @@ bool DesktopNativeWidgetAura::HasCapture() const {
}
InputMethod* DesktopNativeWidgetAura::CreateInputMethod() {
+ if (switches::IsNewTextInputFocusEnabled())
+ return new NullInputMethod();
msw 2014/03/11 00:58:50 Is there an advantage to using NullInputMethod her
Yuki 2014/03/11 15:27:37 NULL doesn't work. Some of (not few) clients assu
msw 2014/03/11 23:24:37 Okay, then this is fine.
+
ui::InputMethod* host = input_method_event_filter_->input_method();
return new InputMethodBridge(this, host, false);
}
@@ -635,6 +639,10 @@ internal::InputMethodDelegate*
return this;
}
+ui::InputMethod* DesktopNativeWidgetAura::GetHostInputMethod() {
+ return input_method_event_filter_->input_method();
+}
+
void DesktopNativeWidgetAura::CenterWindow(const gfx::Size& size) {
if (content_window_)
desktop_window_tree_host_->CenterWindow(size);
@@ -1076,12 +1084,17 @@ void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
desktop_window_tree_host_->OnNativeWidgetFocus();
native_widget_delegate_->OnNativeFocus(lost_focus);
- // If focus is moving from a descendant Window to |content_window_| then
- // native activation hasn't changed. We still need to inform the InputMethod
- // we've been focused though.
- InputMethod* input_method = GetWidget()->GetInputMethod();
- if (input_method)
- input_method->OnFocus();
+ if (!switches::IsNewTextInputFocusEnabled()) {
+ // If focus is moving from a descendant Window to |content_window_| then
+ // native activation hasn't changed. We still need to inform the
+ // InputMethod we've been focused though.
+ InputMethod* input_method = GetWidget()->GetInputMethod();
+ if (input_method)
+ input_method->OnFocus();
+ }
+
+ views::FocusManager* focus_manager = GetWidget()->GetFocusManager();
msw 2014/03/11 00:58:50 If the View focused before the Widget was deactiva
Yuki 2014/03/11 15:27:37 OnWindowActivated() is called before OnWindowFocus
msw 2014/03/11 23:24:37 Great, thanks for checking. This may not actually
Yuki 2014/03/12 09:13:15 Done.
+ focus_manager->OnTextInputClientChanged(focus_manager->GetFocusedView());
} else if (content_window_ == lost_focus) {
msw 2014/03/11 00:58:50 Should we explicitly clear the TextInputClient in
Yuki 2014/03/11 15:27:37 I think we don't need to do so. Losing the focus
msw 2014/03/11 23:24:37 Hmm, I guess this should be okay; the focused View
Yuki 2014/03/12 09:13:15 This has been a tough question for me. Now I've c
desktop_window_tree_host_->OnNativeWidgetBlur();
native_widget_delegate_->OnNativeBlur(

Powered by Google App Engine
This is Rietveld 408576698