// Copyright 2012 The Chromium Authors // 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_MENU_HOST_H_ #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ #include <memory> #include <string> #include "base/memory/raw_ptr.h" #include "base/scoped_observation.h" #include "build/build_config.h" #include "ui/base/owned_window_anchor.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_observer.h" namespace gfx { class Insets; class Rect; } // namespace gfx namespace views { class MenuControllerTest; class SubmenuView; class View; class Widget; namespace internal { #if defined(USE_AURA) // This class is internal to views. class PreMenuEventDispatchHandler; #endif // defined(USE_AURA) } // namespace internal // `SubmenuView` uses a `MenuHost` to house the `SubmenuView`. // // As a `Widget`, `MenuHost` is owned by the widget system. `SubmenuView` // creates `MenuHost` and when `SubmenuView` is done with the `MenuHost` // `DestroyMenuHost` is invoked, which leads to the destruction of the // `MenuHost`. Alternatively, the OS may destroy the widget. In this case // `MenuHost` invokes `MenuHostDestroyed` on the `SubmenuView` and the // `SubmenuView` then drops references to the `MenuHost`. class MenuHost : public Widget, public WidgetObserver { … }; } // namespace views #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_