| 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_CAST_TRAY_CAST_H_ | |
| 6 #define ASH_COMMON_SYSTEM_CAST_TRAY_CAST_H_ | |
| 7 | |
| 8 #include "ash/common/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 | |
| 47 // Overridden from ShellObserver. | |
| 48 void OnCastingSessionStartedOrStopped(bool started) override; | |
| 49 | |
| 50 // Overridden from CastConfigDelegate::Observer. | |
| 51 void OnDevicesUpdated( | |
| 52 const CastConfigDelegate::ReceiversAndActivities& devices) override; | |
| 53 | |
| 54 // Returns true if the cast extension was detected. | |
| 55 bool HasCastExtension(); | |
| 56 | |
| 57 // This makes sure that the current view displayed in the tray is the correct | |
| 58 // one, depending on if we are currently casting. If we're casting, then a | |
| 59 // view with a stop button is displayed; otherwise, a view that links to a | |
| 60 // detail view is displayed instead that allows the user to easily begin a | |
| 61 // casting session. | |
| 62 void UpdatePrimaryView(); | |
| 63 | |
| 64 CastConfigDelegate::ReceiversAndActivities receivers_and_activities_; | |
| 65 bool is_casting_ = false; | |
| 66 | |
| 67 bool added_observer_ = false; | |
| 68 | |
| 69 // Not owned. | |
| 70 tray::CastTrayView* tray_ = nullptr; | |
| 71 tray::CastDuplexView* default_ = nullptr; | |
| 72 tray::CastDetailedView* detailed_ = nullptr; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(TrayCast); | |
| 75 }; | |
| 76 | |
| 77 } // namespace ash | |
| 78 | |
| 79 #endif // ASH_COMMON_SYSTEM_CAST_TRAY_CAST_H_ | |
| OLD | NEW |