| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/keyboard.h" | 5 #include "components/exo/keyboard.h" |
| 6 | 6 |
| 7 #include "components/exo/keyboard_delegate.h" | 7 #include "components/exo/keyboard_delegate.h" |
| 8 #include "components/exo/keyboard_device_configuration_delegate.h" | 8 #include "components/exo/keyboard_device_configuration_delegate.h" |
| 9 #include "components/exo/shell_surface.h" | 9 #include "components/exo/shell_surface.h" |
| 10 #include "components/exo/surface.h" | 10 #include "components/exo/surface.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 device_configuration_delegate_->OnKeyboardDestroying(this); | 107 device_configuration_delegate_->OnKeyboardDestroying(this); |
| 108 if (focus_) | 108 if (focus_) |
| 109 focus_->RemoveSurfaceObserver(this); | 109 focus_->RemoveSurfaceObserver(this); |
| 110 auto* helper = WMHelper::GetInstance(); | 110 auto* helper = WMHelper::GetInstance(); |
| 111 helper->RemoveFocusObserver(this); | 111 helper->RemoveFocusObserver(this); |
| 112 helper->RemovePostTargetHandler(this); | 112 helper->RemovePostTargetHandler(this); |
| 113 helper->RemoveMaximizeModeObserver(this); | 113 helper->RemoveMaximizeModeObserver(this); |
| 114 helper->RemoveInputDeviceEventObserver(this); | 114 helper->RemoveInputDeviceEventObserver(this); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool Keyboard::HasDeviceConfigurationDelegate() const { |
| 118 return !!device_configuration_delegate_; |
| 119 } |
| 120 |
| 117 void Keyboard::SetDeviceConfigurationDelegate( | 121 void Keyboard::SetDeviceConfigurationDelegate( |
| 118 KeyboardDeviceConfigurationDelegate* delegate) { | 122 KeyboardDeviceConfigurationDelegate* delegate) { |
| 119 device_configuration_delegate_ = delegate; | 123 device_configuration_delegate_ = delegate; |
| 120 OnKeyboardDeviceConfigurationChanged(); | 124 OnKeyboardDeviceConfigurationChanged(); |
| 121 } | 125 } |
| 122 | 126 |
| 123 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
| 124 // ui::EventHandler overrides: | 128 // ui::EventHandler overrides: |
| 125 | 129 |
| 126 void Keyboard::OnKeyEvent(ui::KeyEvent* event) { | 130 void Keyboard::OnKeyEvent(ui::KeyEvent* event) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 aura::Window* top_level_window = window->GetToplevelWindow(); | 236 aura::Window* top_level_window = window->GetToplevelWindow(); |
| 233 if (top_level_window) | 237 if (top_level_window) |
| 234 focus = ShellSurface::GetMainSurface(top_level_window); | 238 focus = ShellSurface::GetMainSurface(top_level_window); |
| 235 } | 239 } |
| 236 | 240 |
| 237 return focus && delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus | 241 return focus && delegate_->CanAcceptKeyboardEventsForSurface(focus) ? focus |
| 238 : nullptr; | 242 : nullptr; |
| 239 } | 243 } |
| 240 | 244 |
| 241 } // namespace exo | 245 } // namespace exo |
| OLD | NEW |