blob: a068a3c725ba94baf86658fa299e87b87bac50b1 [file] [log] [blame]
Avi Drissman3a215d1e2022-09-07 19:43:091// Copyright 2021 The Chromium Authors
Avery Musbach2041a092021-11-19 00:03:572// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ASH_SHELF_SHELF_PARTY_FEATURE_POD_CONTROLLER_H_
6#define ASH_SHELF_SHELF_PARTY_FEATURE_POD_CONTROLLER_H_
7
8#include "ash/ash_export.h"
Jiaming Chengf6be60fb2022-09-21 23:42:599#include "ash/constants/quick_settings_catalogs.h"
Avery Musbach2041a092021-11-19 00:03:5710#include "ash/public/cpp/session/session_observer.h"
11#include "ash/public/cpp/shelf_model_observer.h"
12#include "ash/system/unified/feature_pod_controller_base.h"
Arthur Sonzogni834e018f2023-04-22 10:20:0213#include "base/memory/raw_ptr.h"
James Cook1c21be92023-01-09 20:49:2314#include "base/memory/weak_ptr.h"
Avery Musbach2041a092021-11-19 00:03:5715
16namespace ash {
17
James Cook1c21be92023-01-09 20:49:2318class FeaturePodButton;
19class FeatureTile;
20
Avery Musbach2041a092021-11-19 00:03:5721// Controller of a feature pod button that toggles shelf party mode.
22class ASH_EXPORT ShelfPartyFeaturePodController
23 : public FeaturePodControllerBase,
24 public SessionObserver,
25 public ShelfModelObserver {
26 public:
27 ShelfPartyFeaturePodController();
28 ShelfPartyFeaturePodController(const ShelfPartyFeaturePodController&) =
29 delete;
30 ShelfPartyFeaturePodController& operator=(
31 const ShelfPartyFeaturePodController&) = delete;
32 ~ShelfPartyFeaturePodController() override;
33
34 // FeaturePodControllerBase:
35 FeaturePodButton* CreateButton() override;
Kevin Radtkee67e56c2023-01-24 02:39:3436 std::unique_ptr<FeatureTile> CreateTile(bool compact = false) override;
Jiaming Chengf6be60fb2022-09-21 23:42:5937 QsFeatureCatalogName GetCatalogName() override;
Avery Musbach2041a092021-11-19 00:03:5738 void OnIconPressed() override;
Avery Musbach2041a092021-11-19 00:03:5739
40 // SessionObserver:
41 void OnSessionStateChanged(session_manager::SessionState state) override;
42
43 // ShelfModelObserver:
44 void ShelfPartyToggled(bool in_shelf_party) override;
45
46 private:
James Cook1c21be92023-01-09 20:49:2347 void Update();
Avery Musbach2041a092021-11-19 00:03:5748 void UpdateButton();
James Cook1c21be92023-01-09 20:49:2349 void UpdateTile();
Avery Musbach2041a092021-11-19 00:03:5750
James Cook1c21be92023-01-09 20:49:2351 // Owned by the views hierarchy.
Arthur Sonzogni834e018f2023-04-22 10:20:0252 raw_ptr<FeaturePodButton, ExperimentalAsh> button_ = nullptr;
53 raw_ptr<FeatureTile, ExperimentalAsh> tile_ = nullptr;
James Cook1c21be92023-01-09 20:49:2354
55 base::WeakPtrFactory<ShelfPartyFeaturePodController> weak_factory_{this};
Avery Musbach2041a092021-11-19 00:03:5756};
57
58} // namespace ash
59
60#endif // ASH_SHELF_SHELF_PARTY_FEATURE_POD_CONTROLLER_H_