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

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

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: move dep to chromeos section 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
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/system/chromeos/cast/tray_cast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 8 #include <string>
9 #include <vector>
10
11 #include "ash/common/cast_config_controller.h"
9 #include "ash/common/shell_observer.h" 12 #include "ash/common/shell_observer.h"
10 #include "ash/common/system/tray/system_tray_item.h" 13 #include "ash/common/system/tray/system_tray_item.h"
11 #include "base/macros.h" 14 #include "base/macros.h"
12 15
13 namespace ash { 16 namespace ash {
14 namespace tray { 17 namespace tray {
15 class CastTrayView; 18 class CastTrayView;
16 class CastDetailedView; 19 class CastDetailedView;
17 class CastDuplexView; 20 class CastDuplexView;
18 } // namespace tray 21 } // namespace tray
19 22
20 class ASH_EXPORT TrayCast : public SystemTrayItem, 23 class ASH_EXPORT TrayCast : public SystemTrayItem,
21 public ShellObserver, 24 public ShellObserver,
22 public CastConfigDelegate::Observer { 25 public CastConfigControllerObserver {
23 public: 26 public:
24 explicit TrayCast(SystemTray* system_tray); 27 explicit TrayCast(SystemTray* system_tray);
25 ~TrayCast() override; 28 ~TrayCast() override;
26 29
27 private: 30 private:
28 // Helper/utility methods for testing. 31 // Helper/utility methods for testing.
29 friend class TrayCastTestAPI; 32 friend class TrayCastTestAPI;
30 void StartCastForTest(const std::string& sink_id); 33 void StartCastForTest(const std::string& sink_id);
31 void StopCastForTest(); 34 void StopCastForTest();
32 // Returns the id of the item we are currently displaying in the cast view. 35 // Returns the id of the item we are currently displaying in the cast view.
33 // This assumes that the cast view is active. 36 // This assumes that the cast view is active.
34 const std::string& GetDisplayedCastId(); 37 const std::string& GetDisplayedCastId();
35 const views::View* GetDefaultView() const; 38 const views::View* GetDefaultView() const;
36 enum ChildViewId { TRAY_VIEW = 1, SELECT_VIEW, CAST_VIEW }; 39 enum ChildViewId { TRAY_VIEW = 1, SELECT_VIEW, CAST_VIEW };
37 40
38 // Overridden from SystemTrayItem. 41 // Overridden from SystemTrayItem.
39 views::View* CreateTrayView(LoginStatus status) override; 42 views::View* CreateTrayView(LoginStatus status) override;
40 views::View* CreateDefaultView(LoginStatus status) override; 43 views::View* CreateDefaultView(LoginStatus status) override;
41 views::View* CreateDetailedView(LoginStatus status) override; 44 views::View* CreateDetailedView(LoginStatus status) override;
42 void DestroyTrayView() override; 45 void DestroyTrayView() override;
43 void DestroyDefaultView() override; 46 void DestroyDefaultView() override;
44 void DestroyDetailedView() override; 47 void DestroyDetailedView() override;
45 48
46 // Overridden from ShellObserver. 49 // Overridden from ShellObserver.
47 void OnCastingSessionStartedOrStopped(bool started) override; 50 void OnCastingSessionStartedOrStopped(bool started) override;
48 51
49 // Overridden from CastConfigDelegate::Observer. 52 // Overridden from CastConfigObserver.
50 void OnDevicesUpdated( 53 void OnDevicesUpdated(std::vector<mojom::SinkAndRoutePtr> devices) override;
51 const CastConfigDelegate::SinksAndRoutes& devices) override;
52 54
53 // This makes sure that the current view displayed in the tray is the correct 55 // 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 56 // 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 57 // 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 58 // detail view is displayed instead that allows the user to easily begin a
57 // casting session. 59 // casting session.
58 void UpdatePrimaryView(); 60 void UpdatePrimaryView();
59 61
60 // Returns true if there is an active cast route. The route may be DIAL based, 62 // 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 63 // 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 64 // another server. In that case, is_mirror_casting_ will be false since this
63 // device is not actively transmitting information to the cast sink. 65 // device is not actively transmitting information to the cast sink.
64 bool HasActiveRoute(); 66 bool HasActiveRoute();
65 67
66 CastConfigDelegate::SinksAndRoutes sinks_and_routes_; 68 std::vector<mojom::SinkAndRoutePtr> sinks_and_routes_;
67 69
68 // True if there is a mirror-based cast session and the active-cast tray icon 70 // True if there is a mirror-based cast session and the active-cast tray icon
69 // should be shown. 71 // should be shown.
70 bool is_mirror_casting_ = false; 72 bool is_mirror_casting_ = false;
71 73
72 // Not owned. 74 // Not owned.
73 tray::CastTrayView* tray_ = nullptr; 75 tray::CastTrayView* tray_ = nullptr;
74 tray::CastDuplexView* default_ = nullptr; 76 tray::CastDuplexView* default_ = nullptr;
75 tray::CastDetailedView* detailed_ = nullptr; 77 tray::CastDetailedView* detailed_ = nullptr;
76 78
77 DISALLOW_COPY_AND_ASSIGN(TrayCast); 79 DISALLOW_COPY_AND_ASSIGN(TrayCast);
78 }; 80 };
79 81
80 } // namespace ash 82 } // namespace ash
81 83
82 #endif // ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_ 84 #endif // ASH_COMMON_SYSTEM_CHROMEOS_CAST_TRAY_CAST_H_
OLDNEW
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/system/chromeos/cast/tray_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698