blob: 00303f85ec6c470d4bd2142bf41d7a43fb38e97a [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"
James Cook1c21be92023-01-09 20:49:2313#include "base/memory/weak_ptr.h"
Avery Musbach2041a092021-11-19 00:03:5714
15namespace ash {
16
James Cook1c21be92023-01-09 20:49:2317class FeaturePodButton;
18class FeatureTile;
19
Avery Musbach2041a092021-11-19 00:03:5720// Controller of a feature pod button that toggles shelf party mode.
21class ASH_EXPORT ShelfPartyFeaturePodController
22 : public FeaturePodControllerBase,
23 public SessionObserver,
24 public ShelfModelObserver {
25 public:
26 ShelfPartyFeaturePodController();
27 ShelfPartyFeaturePodController(const ShelfPartyFeaturePodController&) =
28 delete;
29 ShelfPartyFeaturePodController& operator=(
30 const ShelfPartyFeaturePodController&) = delete;
31 ~ShelfPartyFeaturePodController() override;
32
33 // FeaturePodControllerBase:
34 FeaturePodButton* CreateButton() override;
James Cook1c21be92023-01-09 20:49:2335 std::unique_ptr<FeatureTile> CreateTile() override;
Jiaming Chengf6be60fb2022-09-21 23:42:5936 QsFeatureCatalogName GetCatalogName() override;
Avery Musbach2041a092021-11-19 00:03:5737 void OnIconPressed() override;
Avery Musbach2041a092021-11-19 00:03:5738
39 // SessionObserver:
40 void OnSessionStateChanged(session_manager::SessionState state) override;
41
42 // ShelfModelObserver:
43 void ShelfPartyToggled(bool in_shelf_party) override;
44
45 private:
James Cook1c21be92023-01-09 20:49:2346 void Update();
Avery Musbach2041a092021-11-19 00:03:5747 void UpdateButton();
James Cook1c21be92023-01-09 20:49:2348 void UpdateTile();
Avery Musbach2041a092021-11-19 00:03:5749
James Cook1c21be92023-01-09 20:49:2350 // Owned by the views hierarchy.
Avery Musbach2041a092021-11-19 00:03:5751 FeaturePodButton* button_ = nullptr;
James Cook1c21be92023-01-09 20:49:2352 FeatureTile* tile_ = nullptr;
53
54 base::WeakPtrFactory<ShelfPartyFeaturePodController> weak_factory_{this};
Avery Musbach2041a092021-11-19 00:03:5755};
56
57} // namespace ash
58
59#endif // ASH_SHELF_SHELF_PARTY_FEATURE_POD_CONTROLLER_H_