date_tray.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2022 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_SYSTEM_UNIFIED_DATE_TRAY_H_
  5. #define ASH_SYSTEM_UNIFIED_DATE_TRAY_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/system/tray/tray_background_view.h"
  9. #include "ash/system/unified/unified_system_tray.h"
  10. #include "ui/base/metadata/metadata_header_macros.h"
  11. namespace ash {
  12. class TimeTrayItemView;
  13. // This date tray is next to the `UnifidedSystemTray`. Activating this tray
  14. // results in the CalendarView showing in the UnifiedSystemTray's bubble. This
  15. // tray doesn't not have its own bubble.
  16. class ASH_EXPORT DateTray : public TrayBackgroundView,
  17. public UnifiedSystemTray::Observer {
  18. public:
  19. METADATA_HEADER(DateTray);
  20. DateTray(Shelf* shelf, UnifiedSystemTray* tray);
  21. DateTray(const DateTray&) = delete;
  22. DateTray& operator=(const DateTray&) = delete;
  23. ~DateTray() override;
  24. // TrayBackgroundView:
  25. bool PerformAction(const ui::Event& event) override;
  26. std::u16string GetAccessibleNameForBubble() override;
  27. std::u16string GetAccessibleNameForTray() override;
  28. void HandleLocaleChange() override;
  29. void UpdateLayout() override;
  30. void UpdateAfterLoginStatusChange() override;
  31. void ShowBubble() override {}
  32. void HideBubbleWithView(const TrayBubbleView* bubble_view) override {}
  33. void ClickedOutsideBubble() override {}
  34. // UnifiedSystemTray::Observer:
  35. void OnOpeningCalendarView() override;
  36. void OnLeavingCalendarView() override;
  37. private:
  38. friend class DateTrayTest;
  39. // Owned.
  40. TimeTrayItemView* time_view_ = nullptr;
  41. // Owned by `StatusAreaWidget`.
  42. UnifiedSystemTray* unified_system_tray_ = nullptr;
  43. base::ScopedObservation<UnifiedSystemTray, UnifiedSystemTray::Observer>
  44. scoped_unified_system_tray_observer_{this};
  45. };
  46. } // namespace ash
  47. #endif // ASH_SYSTEM_UNIFIED_DATE_TRAY_H_