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

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

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: Now for the external apitests as well. Created 4 years 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_ 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_ 6 #define ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_
7 7
8 #include "ash/common/cast_config_delegate.h"
9 #include "ash/common/shell_observer.h" 8 #include "ash/common/shell_observer.h"
10 #include "ash/common/system/tray/system_tray_item.h" 9 #include "ash/common/system/tray/system_tray_item.h"
10 #include "ash/public/interfaces/cast_config.mojom.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "mojo/public/cpp/bindings/associated_binding.h"
12 13
13 namespace ash { 14 namespace ash {
14 namespace tray { 15 namespace tray {
15 class CastTrayView; 16 class CastTrayView;
16 class CastDetailedView; 17 class CastDetailedView;
17 class CastDuplexView; 18 class CastDuplexView;
18 } // namespace tray 19 } // namespace tray
19 20
20 class ASH_EXPORT TrayCast : public SystemTrayItem, 21 class ASH_EXPORT TrayCast : public SystemTrayItem,
21 public ShellObserver, 22 public ShellObserver,
22 public CastConfigDelegate::Observer { 23 public mojom::CastConfigObserver {
23 public: 24 public:
24 explicit TrayCast(SystemTray* system_tray); 25 explicit TrayCast(SystemTray* system_tray);
25 ~TrayCast() override; 26 ~TrayCast() override;
26 27
27 private: 28 private:
28 // Helper/utility methods for testing. 29 // Helper/utility methods for testing.
29 friend class TrayCastTestAPI; 30 friend class TrayCastTestAPI;
30 void StartCastForTest(const std::string& sink_id); 31 void StartCastForTest(const std::string& sink_id);
31 void StopCastForTest(); 32 void StopCastForTest();
32 // Returns the id of the item we are currently displaying in the cast view. 33 // Returns the id of the item we are currently displaying in the cast view.
33 // This assumes that the cast view is active. 34 // This assumes that the cast view is active.
34 const std::string& GetDisplayedCastId(); 35 const std::string& GetDisplayedCastId();
35 const views::View* GetDefaultView() const; 36 const views::View* GetDefaultView() const;
36 enum ChildViewId { TRAY_VIEW = 1, SELECT_VIEW, CAST_VIEW }; 37 enum ChildViewId { TRAY_VIEW = 1, SELECT_VIEW, CAST_VIEW };
37 38
38 // Overridden from SystemTrayItem. 39 // Overridden from SystemTrayItem.
39 views::View* CreateTrayView(LoginStatus status) override; 40 views::View* CreateTrayView(LoginStatus status) override;
40 views::View* CreateDefaultView(LoginStatus status) override; 41 views::View* CreateDefaultView(LoginStatus status) override;
41 views::View* CreateDetailedView(LoginStatus status) override; 42 views::View* CreateDetailedView(LoginStatus status) override;
42 void DestroyTrayView() override; 43 void DestroyTrayView() override;
43 void DestroyDefaultView() override; 44 void DestroyDefaultView() override;
44 void DestroyDetailedView() override; 45 void DestroyDetailedView() override;
45 46
46 // Overridden from ShellObserver. 47 // Overridden from ShellObserver.
47 void OnCastingSessionStartedOrStopped(bool started) override; 48 void OnCastingSessionStartedOrStopped(bool started) override;
48 49
49 // Overridden from CastConfigDelegate::Observer. 50 // Overridden from CastConfigObserver.
50 void OnDevicesUpdated( 51 void OnDevicesUpdated(std::vector<mojom::SinkAndRoutePtr> devices) override;
51 const CastConfigDelegate::SinksAndRoutes& devices) override;
52 52
53 // This makes sure that the current view displayed in the tray is the correct 53 // This makes sure that the current view displayed in the tray is the correct
54 // one, depending on if we are currently casting. If we're casting, then a 54 // one, depending on if we are currently casting. If we're casting, then a
55 // view with a stop button is displayed; otherwise, a view that links to a 55 // view with a stop button is displayed; otherwise, a view that links to a
56 // detail view is displayed instead that allows the user to easily begin a 56 // detail view is displayed instead that allows the user to easily begin a
57 // casting session. 57 // casting session.
58 void UpdatePrimaryView(); 58 void UpdatePrimaryView();
59 59
60 // Returns true if there is an active cast route. The route may be DIAL based, 60 // Returns true if there is an active cast route. The route may be DIAL based,
61 // such as casting YouTube where the cast sink directly streams content from 61 // such as casting YouTube where the cast sink directly streams content from
62 // another server. In that case, is_mirror_casting_ will be false since this 62 // another server. In that case, is_mirror_casting_ will be false since this
63 // device is not actively transmitting information to the cast sink. 63 // device is not actively transmitting information to the cast sink.
64 bool HasActiveRoute(); 64 bool HasActiveRoute();
65 65
66 CastConfigDelegate::SinksAndRoutes sinks_and_routes_; 66 std::vector<mojom::SinkAndRoutePtr> sinks_and_routes_;
67
68 // The binding this instance uses to implement mojom::CastConfigObserver:
69 mojo::AssociatedBinding<mojom::CastConfigObserver> observer_binding_;
67 70
68 // True if there is a mirror-based cast session and the active-cast tray icon 71 // True if there is a mirror-based cast session and the active-cast tray icon
69 // should be shown. 72 // should be shown.
70 bool is_mirror_casting_ = false; 73 bool is_mirror_casting_ = false;
71 74
72 // Not owned. 75 // Not owned.
73 tray::CastTrayView* tray_ = nullptr; 76 tray::CastTrayView* tray_ = nullptr;
74 tray::CastDuplexView* default_ = nullptr; 77 tray::CastDuplexView* default_ = nullptr;
75 tray::CastDetailedView* detailed_ = nullptr; 78 tray::CastDetailedView* detailed_ = nullptr;
76 79
77 DISALLOW_COPY_AND_ASSIGN(TrayCast); 80 DISALLOW_COPY_AND_ASSIGN(TrayCast);
78 }; 81 };
79 82
80 } // namespace ash 83 } // namespace ash
81 84
82 #endif // ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_ 85 #endif // ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698