hud_display.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2020 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. #ifndef ASH_HUD_DISPLAY_HUD_DISPLAY_H_
  5. #define ASH_HUD_DISPLAY_HUD_DISPLAY_H_
  6. #include "ash/ash_export.h"
  7. #include "base/sequence_checker.h"
  8. #include "ui/views/view.h"
  9. namespace ash {
  10. namespace hud_display {
  11. enum class HUDDisplayMode;
  12. class GraphsContainerView;
  13. class HUDHeaderView;
  14. class HUDSettingsView;
  15. // HUDDisplayView class can be used to display a system monitoring overview.
  16. class HUDDisplayView : public views::View {
  17. public:
  18. METADATA_HEADER(HUDDisplayView);
  19. HUDDisplayView();
  20. HUDDisplayView(const HUDDisplayView&) = delete;
  21. HUDDisplayView& operator=(const HUDDisplayView&) = delete;
  22. ~HUDDisplayView() override;
  23. // Destroys global instance.
  24. static void Destroy();
  25. // Creates/Destroys global singleton.
  26. static void Toggle();
  27. // True when HUD is shown.
  28. static bool ASH_EXPORT IsShown();
  29. // Called from ClientView. Responsible for moving widget when clicked outside
  30. // of the children.
  31. int NonClientHitTest(const gfx::Point& point);
  32. // Changes UI display mode.
  33. void SetDisplayMode(const HUDDisplayMode display_mode);
  34. // Callback from SettingsButton.
  35. void OnSettingsToggle();
  36. // Returns true if HUD is in overlay mode.
  37. bool IsOverlay();
  38. // Changes HUD overlay flag.
  39. void ToggleOverlay();
  40. ASH_EXPORT static HUDDisplayView* GetForTesting();
  41. ASH_EXPORT HUDSettingsView* GetSettingsViewForTesting();
  42. ASH_EXPORT void ToggleSettingsForTesting();
  43. private:
  44. HUDHeaderView* header_view_ = nullptr; // not owned
  45. GraphsContainerView* graphs_container_ = nullptr; // not owned
  46. HUDSettingsView* settings_view_ = nullptr; // not owned
  47. SEQUENCE_CHECKER(ui_sequence_checker_);
  48. };
  49. } // namespace hud_display
  50. } // namespace ash
  51. #endif // ASH_HUD_DISPLAY_HUD_DISPLAY_H_