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