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

Unified Diff: ui/views/widget/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, 7 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/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index f428259e841da0f65f44462004cb82b306ce2bb2..2e564fa5a8adff1bee71a001e83c5405ad073619 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -17,6 +17,7 @@
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_observer.h"
#include "ui/base/dragdrop/os_exchange_data.h"
+#include "ui/base/ui_base_switches_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/events/event.h"
@@ -26,6 +27,7 @@
#include "ui/native_theme/native_theme_aura.h"
#include "ui/views/drag_utils.h"
#include "ui/views/ime/input_method_bridge.h"
+#include "ui/views/ime/null_input_method.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/drop_helper.h"
#include "ui/views/widget/native_widget_delegate.h"
@@ -270,6 +272,10 @@ bool NativeWidgetAura::HasCapture() const {
InputMethod* NativeWidgetAura::CreateInputMethod() {
if (!window_)
return NULL;
+
+ if (switches::IsTextInputFocusManagerEnabled())
+ return new NullInputMethod();
+
aura::Window* root_window = window_->GetRootWindow();
ui::InputMethod* host =
root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
@@ -280,6 +286,11 @@ internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() {
return this;
}
+ui::InputMethod* NativeWidgetAura::GetHostInputMethod() {
+ aura::Window* root_window = window_->GetRootWindow();
+ return root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
+}
+
void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
if (!window_)
return;
@@ -821,6 +832,12 @@ void NativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
if (!window_->IsVisible())
return;
GetWidget()->GetInputMethod()->DispatchKeyEvent(*event);
+ if (switches::IsTextInputFocusManagerEnabled()) {
+ FocusManager* focus_manager = GetWidget()->GetFocusManager();
+ delegate_->OnKeyEvent(event);
+ if (!event->handled() && focus_manager)
+ focus_manager->OnKeyEvent(*event);
+ }
event->SetHandled();
}
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698