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

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

Issue 2155243007: Turn Bookmark Menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove nested flag Created 4 years, 5 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
Index: ui/views/controls/menu/activation_change_observer_impl.h
diff --git a/ui/views/controls/menu/activation_change_observer_impl.h b/ui/views/controls/menu/activation_change_observer_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..06938934915dd48f334d802803dee588d51ad46d
--- /dev/null
+++ b/ui/views/controls/menu/activation_change_observer_impl.h
@@ -0,0 +1,55 @@
+// 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_ACTIVATION_CHANGE_OBSERVER_IMPL_H_
+#define UI_VIEWS_CONTROLS_MENU_ACTIVATION_CHANGE_OBSERVER_IMPL_H_
+
+#include "ui/aura/window_observer.h"
+#include "ui/events/event_handler.h"
+#include "ui/wm/public/activation_change_observer.h"
+
+namespace aura {
+class Window;
+} // namespace aura
+
+namespace views {
+
+class MenuController;
+class Widget;
+
+// ActivationChangeObserverImpl is used to observe activation changes and close
+// the menu. Additionally it listens for the root window to be destroyed and
+// cancel the menu as well.
+class ActivationChangeObserverImpl
sky 2016/08/01 21:39:45 This name makes sense as an inner class, but for a
jonross 2016/08/02 15:03:25 I've merged them. The differences in how they wer
+ : public aura::client::ActivationChangeObserver,
+ public aura::WindowObserver,
+ public ui::EventHandler {
+ public:
+ ActivationChangeObserverImpl(MenuController* controller, Widget* owner);
+ ~ActivationChangeObserverImpl() 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;
+
+ private:
+ void Cleanup();
+
+ MenuController* controller_;
+ aura::Window* root_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActivationChangeObserverImpl);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_MENU_ACTIVATION_CHANGE_OBSERVER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698