Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: ash/system/cast/tray_cast.h

Issue 2109613005: mash: Move system tray cast code into //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward decl Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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
5 #ifndef ASH_SYSTEM_CAST_TRAY_CAST_H_
6 #define ASH_SYSTEM_CAST_TRAY_CAST_H_
7
8 #include "ash/cast_config_delegate.h"
9 #include "ash/common/shell_observer.h"
10 #include "ash/common/system/tray/system_tray_item.h"
11 #include "base/macros.h"
12
13 namespace ash {
14 namespace tray {
15 class CastTrayView;
16 class CastSelectDefaultView;
17 class CastDetailedView;
18 class CastDuplexView;
19 } // namespace tray
20
21 class ASH_EXPORT TrayCast : public SystemTrayItem,
22 public ShellObserver,
23 public CastConfigDelegate::Observer {
24 public:
25 explicit TrayCast(SystemTray* system_tray);
26 ~TrayCast() override;
27
28 private:
29 // Helper/utility methods for testing.
30 friend class TrayCastTestAPI;
31 void StartCastForTest(const std::string& receiver_id);
32 void StopCastForTest();
33 // Returns the id of the item we are currently displaying in the cast view.
34 // This assumes that the cast view is active.
35 const std::string& GetDisplayedCastId();
36 const views::View* GetDefaultView() const;
37 enum ChildViewId { TRAY_VIEW = 1, SELECT_VIEW, CAST_VIEW };
38
39 // Overridden from SystemTrayItem.
40 views::View* CreateTrayView(LoginStatus status) override;
41 views::View* CreateDefaultView(LoginStatus status) override;
42 views::View* CreateDetailedView(LoginStatus status) override;
43 void DestroyTrayView() override;
44 void DestroyDefaultView() override;
45 void DestroyDetailedView() override;
46 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
47
48 // Overridden from ShellObserver.
49 void OnCastingSessionStartedOrStopped(bool started) override;
50
51 // Overridden from CastConfigDelegate::Observer.
52 void OnDevicesUpdated(
53 const CastConfigDelegate::ReceiversAndActivities& devices) override;
54
55 // Returns true if the cast extension was detected.
56 bool HasCastExtension();
57
58 // This makes sure that the current view displayed in the tray is the correct
59 // one, depending on if we are currently casting. If we're casting, then a
60 // view with a stop button is displayed; otherwise, a view that links to a
61 // detail view is displayed instead that allows the user to easily begin a
62 // casting session.
63 void UpdatePrimaryView();
64
65 CastConfigDelegate::ReceiversAndActivities receivers_and_activities_;
66 bool is_casting_ = false;
67
68 bool added_observer_ = false;
69
70 // Not owned.
71 tray::CastTrayView* tray_ = nullptr;
72 tray::CastDuplexView* default_ = nullptr;
73 tray::CastDetailedView* detailed_ = nullptr;
74
75 DISALLOW_COPY_AND_ASSIGN(TrayCast);
76 };
77
78 } // namespace ash
79
80 #endif // ASH_SYSTEM_CAST_TRAY_CAST_H_
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc ('k') | ash/system/cast/tray_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698