Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: ui/views/controls/menu/menu_pre_target_handler.h

Issue 2155243007: Turn Bookmark Menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge the pretarget handlers Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/menu/menu_message_loop_mac.cc ('k') | ui/views/controls/menu/menu_pre_target_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_pre_target_handler.h
diff --git a/ui/views/controls/menu/menu_pre_target_handler.h b/ui/views/controls/menu/menu_pre_target_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..56bdd3596c7b7c47b79f00c8fffa45eefc70a9e5
--- /dev/null
+++ b/ui/views/controls/menu/menu_pre_target_handler.h
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_
+#define UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_
+
+#include "ui/aura/window_observer.h"
+#include "ui/events/event_handler.h"
+#include "ui/views/views_export.h"
+#include "ui/wm/public/activation_change_observer.h"
+
+namespace aura {
+class Window;
+} // namespace aura
+
+namespace views {
+
+class MenuController;
+class Widget;
+
+// MenuPreTargetHandler is used to observe activation changes, cancel events,
+// and root window destruction, to shutdown the menu.
+//
+// Additionally handles key events to provide accelerator support to menus.
+class VIEWS_EXPORT MenuPreTargetHandler
+ : public aura::client::ActivationChangeObserver,
+ public aura::WindowObserver,
+ public ui::EventHandler {
+ public:
+ MenuPreTargetHandler(MenuController* controller, Widget* owner);
+ ~MenuPreTargetHandler() override;
+
+ // aura::client:ActivationChangeObserver:
+ void OnWindowActivated(
+ aura::client::ActivationChangeObserver::ActivationReason reason,
+ aura::Window* gained_active,
+ aura::Window* lost_active) override;
+
+ // aura::WindowObserver:
+ void OnWindowDestroying(aura::Window* window) override;
+
+ // ui::EventHandler:
+ void OnCancelMode(ui::CancelModeEvent* event) override;
+ void OnKeyEvent(ui::KeyEvent* event) override;
+
+ private:
+ void Cleanup();
+
+ MenuController* controller_;
+ aura::Window* root_;
+
+ DISALLOW_COPY_AND_ASSIGN(MenuPreTargetHandler);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_MENU_PRE_TARGET_HANDLER_H_
« no previous file with comments | « ui/views/controls/menu/menu_message_loop_mac.cc ('k') | ui/views/controls/menu/menu_pre_target_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698