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