OLD | NEW |
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/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/activation_client.h" | 8 #include "ui/aura/client/activation_client.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 859 } |
860 } | 860 } |
861 } | 861 } |
862 | 862 |
863 //////////////////////////////////////////////////////////////////////////////// | 863 //////////////////////////////////////////////////////////////////////////////// |
864 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: | 864 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: |
865 | 865 |
866 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, | 866 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, |
867 aura::Window* lost_focus) { | 867 aura::Window* lost_focus) { |
868 if (window_ == gained_focus) { | 868 if (window_ == gained_focus) { |
| 869 desktop_root_window_host_->OnNativeWidgetFocus(); |
869 native_widget_delegate_->OnNativeFocus(lost_focus); | 870 native_widget_delegate_->OnNativeFocus(lost_focus); |
| 871 |
| 872 // If focus is moving from a descendant Window to |window_| then native |
| 873 // activation hasn't changed. We still need to inform the InputMethod we've |
| 874 // been focused though. |
| 875 InputMethod* input_method = GetWidget()->GetInputMethod(); |
| 876 if (input_method) |
| 877 input_method->OnFocus(); |
870 } else if (window_ == lost_focus) { | 878 } else if (window_ == lost_focus) { |
| 879 desktop_root_window_host_->OnNativeWidgetBlur(); |
871 native_widget_delegate_->OnNativeBlur( | 880 native_widget_delegate_->OnNativeBlur( |
872 aura::client::GetFocusClient(window_)->GetFocusedWindow()); | 881 aura::client::GetFocusClient(window_)->GetFocusedWindow()); |
873 } | 882 } |
874 } | 883 } |
875 | 884 |
876 //////////////////////////////////////////////////////////////////////////////// | 885 //////////////////////////////////////////////////////////////////////////////// |
877 // DesktopNativeWidgetAura, views::internal::InputMethodDelegate: | 886 // DesktopNativeWidgetAura, views::internal::InputMethodDelegate: |
878 | 887 |
879 void DesktopNativeWidgetAura::DispatchKeyEventPostIME(const ui::KeyEvent& key) { | 888 void DesktopNativeWidgetAura::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
880 FocusManager* focus_manager = | 889 FocusManager* focus_manager = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 930 } |
922 | 931 |
923 //////////////////////////////////////////////////////////////////////////////// | 932 //////////////////////////////////////////////////////////////////////////////// |
924 // DesktopNativeWidgetAura, NativeWidget implementation: | 933 // DesktopNativeWidgetAura, NativeWidget implementation: |
925 | 934 |
926 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { | 935 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { |
927 return this; | 936 return this; |
928 } | 937 } |
929 | 938 |
930 } // namespace views | 939 } // namespace views |
OLD | NEW |