| 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_CAST_CONFIG_DELEGATE_H_ | |
| 6 #define ASH_COMMON_CAST_CONFIG_DELEGATE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "ash/ash_export.h" | |
| 13 #include "base/macros.h" | |
| 14 #include "base/strings/string16.h" | |
| 15 #include "url/gurl.h" | |
| 16 | |
| 17 namespace ash { | |
| 18 | |
| 19 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|, | |
| 20 // to access the cast extension. | |
| 21 class CastConfigDelegate { | |
| 22 public: | |
| 23 struct ASH_EXPORT Sink { | |
| 24 Sink(); | |
| 25 ~Sink(); | |
| 26 | |
| 27 std::string id; | |
| 28 base::string16 name; | |
| 29 base::string16 domain; | |
| 30 }; | |
| 31 | |
| 32 struct ASH_EXPORT Route { | |
| 33 enum class ContentSource { UNKNOWN, TAB, DESKTOP }; | |
| 34 | |
| 35 Route(); | |
| 36 ~Route(); | |
| 37 | |
| 38 std::string id; | |
| 39 base::string16 title; | |
| 40 | |
| 41 // Is the activity originating from this computer? | |
| 42 bool is_local_source = false; | |
| 43 | |
| 44 // What is source of the content? For example, we could be DIAL casting a | |
| 45 // tab or mirroring the entire desktop. | |
| 46 ContentSource content_source = ContentSource::UNKNOWN; | |
| 47 }; | |
| 48 | |
| 49 struct ASH_EXPORT SinkAndRoute { | |
| 50 SinkAndRoute(); | |
| 51 ~SinkAndRoute(); | |
| 52 | |
| 53 Sink sink; | |
| 54 Route route; | |
| 55 }; | |
| 56 | |
| 57 using SinksAndRoutes = std::vector<SinkAndRoute>; | |
| 58 | |
| 59 class ASH_EXPORT Observer { | |
| 60 public: | |
| 61 // Invoked whenever there is new sink or route information available. | |
| 62 virtual void OnDevicesUpdated(const SinksAndRoutes& devices) = 0; | |
| 63 | |
| 64 protected: | |
| 65 virtual ~Observer() {} | |
| 66 | |
| 67 private: | |
| 68 DISALLOW_ASSIGN(Observer); | |
| 69 }; | |
| 70 | |
| 71 virtual ~CastConfigDelegate() {} | |
| 72 | |
| 73 // Request fresh data from the backend. When the data is available, all | |
| 74 // registered observers will get called. | |
| 75 virtual void RequestDeviceRefresh() = 0; | |
| 76 | |
| 77 // Initiate a casting session to |sink|. | |
| 78 virtual void CastToSink(const Sink& sink) = 0; | |
| 79 | |
| 80 // A user-initiated request to stop the given cast session. | |
| 81 virtual void StopCasting(const Route& route) = 0; | |
| 82 | |
| 83 // Add or remove an observer. | |
| 84 virtual void AddObserver(Observer* observer) = 0; | |
| 85 virtual void RemoveObserver(Observer* observer) = 0; | |
| 86 | |
| 87 private: | |
| 88 DISALLOW_ASSIGN(CastConfigDelegate); | |
| 89 }; | |
| 90 | |
| 91 } // namespace ash | |
| 92 | |
| 93 #endif // ASH_COMMON_CAST_CONFIG_DELEGATE_H_ | |
| OLD | NEW |