diff options
author | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2015-07-14 23:01:47 -0400 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2015-07-15 03:02:39 +0000 |
commit | 9726b4870f366e8d54768e02da38291fee3a7982 (patch) | |
tree | 552493037300dc7c75ceb2a50d695e9e116e370b /mandoline | |
parent | f4c2c445c7fead62b9c82d8155d5fb6f0ddc87f4 (diff) | |
download | chromium_src-9726b4870f366e8d54768e02da38291fee3a7982.zip chromium_src-9726b4870f366e8d54768e02da38291fee3a7982.tar.gz chromium_src-9726b4870f366e8d54768e02da38291fee3a7982.tar.bz2 |
mandoline: Focus/Blur InputMethod correctly.
When a mojo::View gains (or loses) focus, make sure the corresponding InputMethod's
OnFocus/OnBlur is called correctly.
BUG=none
R=fsamuel@chromium.org, jam@chromium.org
Review URL: https://codereview.chromium.org/1237453003 .
Cr-Commit-Position: refs/heads/master@{#338808}
Diffstat (limited to 'mandoline')
-rw-r--r-- | mandoline/ui/aura/native_widget_view_manager.cc | 8 | ||||
-rw-r--r-- | mandoline/ui/aura/native_widget_view_manager.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/mandoline/ui/aura/native_widget_view_manager.cc b/mandoline/ui/aura/native_widget_view_manager.cc index 4c74102..0af2b37 100644 --- a/mandoline/ui/aura/native_widget_view_manager.cc +++ b/mandoline/ui/aura/native_widget_view_manager.cc @@ -92,6 +92,14 @@ void NativeWidgetViewManager::OnViewBoundsChanged( GetWidget()->SetBounds(gfx::Rect(view_rect.size())); } +void NativeWidgetViewManager::OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) { + if (gained_focus == view_) + window_tree_host_->GetInputMethod()->OnFocus(); + else if (lost_focus == view_) + window_tree_host_->GetInputMethod()->OnBlur(); +} + void NativeWidgetViewManager::OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) { scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); diff --git a/mandoline/ui/aura/native_widget_view_manager.h b/mandoline/ui/aura/native_widget_view_manager.h index a92c36e..8042b08 100644 --- a/mandoline/ui/aura/native_widget_view_manager.h +++ b/mandoline/ui/aura/native_widget_view_manager.h @@ -50,6 +50,8 @@ class NativeWidgetViewManager : public views::NativeWidgetAura, void OnViewBoundsChanged(mojo::View* view, const mojo::Rect& old_bounds, const mojo::Rect& new_bounds) override; + void OnViewFocusChanged(mojo::View* gained_focus, + mojo::View* lost_focus) override; void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; scoped_ptr<WindowTreeHostMojo> window_tree_host_; |