| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_ |
| 7 |
| 8 #include "ui/aura/window_observer.h" |
| 9 #include "ui/events/event_handler.h" |
| 10 #include "ui/views/views_export.h" |
| 11 #include "ui/wm/public/activation_change_observer.h" |
| 12 |
| 13 namespace aura { |
| 14 class Window; |
| 15 } // namespace aura |
| 16 |
| 17 namespace views { |
| 18 |
| 19 class MenuController; |
| 20 class Widget; |
| 21 |
| 22 // MenuPreTargetHandler is used to observe activation changes, cancel events, |
| 23 // and root window destruction, to shutdown the menu. |
| 24 // |
| 25 // Additionally handles key events to provide accelerator support to menus. |
| 26 class VIEWS_EXPORT MenuPreTargetHandler |
| 27 : public aura::client::ActivationChangeObserver, |
| 28 public aura::WindowObserver, |
| 29 public ui::EventHandler { |
| 30 public: |
| 31 MenuPreTargetHandler(MenuController* controller, Widget* owner); |
| 32 ~MenuPreTargetHandler() override; |
| 33 |
| 34 // aura::client:ActivationChangeObserver: |
| 35 void OnWindowActivated( |
| 36 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 37 aura::Window* gained_active, |
| 38 aura::Window* lost_active) override; |
| 39 |
| 40 // aura::WindowObserver: |
| 41 void OnWindowDestroying(aura::Window* window) override; |
| 42 |
| 43 // ui::EventHandler: |
| 44 void OnCancelMode(ui::CancelModeEvent* event) override; |
| 45 void OnKeyEvent(ui::KeyEvent* event) override; |
| 46 |
| 47 private: |
| 48 void Cleanup(); |
| 49 |
| 50 MenuController* controller_; |
| 51 aura::Window* root_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(MenuPreTargetHandler); |
| 54 }; |
| 55 |
| 56 } // namespace views |
| 57 |
| 58 #endif // UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_ |
| OLD | NEW |