Chromium Code Reviews| Index: ash/common/cast_config_delegate.h |
| diff --git a/ash/common/cast_config_delegate.h b/ash/common/cast_config_delegate.h |
| index 89cd85e547612edff257f744e576bb45e4448c8f..a480df874da689d3f12b9e5911bd16ba8af871b0 100644 |
| --- a/ash/common/cast_config_delegate.h |
| +++ b/ash/common/cast_config_delegate.h |
| @@ -20,61 +20,46 @@ namespace ash { |
| // to access the cast extension. |
| class CastConfigDelegate { |
| public: |
| - struct ASH_EXPORT Receiver { |
| - Receiver(); |
| - ~Receiver(); |
| + struct ASH_EXPORT Sink { |
| + Sink(); |
| + ~Sink(); |
| std::string id; |
| base::string16 name; |
| + base::string16 domain; |
| }; |
| - struct ASH_EXPORT Activity { |
| - // The tab identifier that we are casting. These are the special tab values |
| - // taken from the chromecast extension itself. If an actual tab is being |
| - // casted, then the TabId will be >= 0. |
| - enum TabId { |
| - EXTENSION = -1, |
| - DESKTOP = -2, |
| - DISCOVERED_ACTIVITY = -3, |
| - EXTERNAL_EXTENSION_CLIENT = -4, |
| + struct ASH_EXPORT Route { |
| + enum class ContentSource { UNKNOWN, TAB, DESKTOP }; |
| - // Not in the extension. Used when the extension does not give us a tabId |
| - // (ie, the cast is running from another device). |
| - UNKNOWN = -5 |
| - }; |
| - |
| - Activity(); |
| - ~Activity(); |
| + Route(); |
| + ~Route(); |
| std::string id; |
| base::string16 title; |
| - // Is the activity source this computer? ie, are we mirroring the display? |
| + // Is the activity originating from this computer? |
| bool is_local_source = false; |
| - // The id for the tab we are casting. Could be one of the TabId values, |
| - // or a value >= 0 that represents that tab index of the tab we are |
| - // casting. We default to casting the desktop, as a tab may not |
| - // necessarily exist. |
| - // TODO(jdufault): Remove tab_id once the CastConfigDelegateChromeos is |
| - // gone. See crbug.com/551132. |
| - int tab_id = TabId::DESKTOP; |
| + // What is source of the content? For example, we could be DIAL casting a |
| + // tab or mirroring the entire desktop. |
| + ContentSource content_source = ContentSource::UNKNOWN; |
| }; |
| - struct ASH_EXPORT ReceiverAndActivity { |
| - ReceiverAndActivity(); |
| - ~ReceiverAndActivity(); |
| + struct ASH_EXPORT SinkAndRoute { |
| + SinkAndRoute(); |
| + ~SinkAndRoute(); |
| - Receiver receiver; |
| - Activity activity; |
| + Sink sink; |
| + Route route; |
| }; |
| - using ReceiversAndActivities = std::vector<ReceiverAndActivity>; |
| + using SinksAndRoutes = std::vector<SinkAndRoute>; |
| class ASH_EXPORT Observer { |
| public: |
| // Invoked whenever there is new receiver or activity information available. |
| - virtual void OnDevicesUpdated(const ReceiversAndActivities& devices) = 0; |
| + virtual void OnDevicesUpdated(const SinksAndRoutes& devices) = 0; |
| protected: |
| virtual ~Observer() {} |
| @@ -85,31 +70,15 @@ class CastConfigDelegate { |
| virtual ~CastConfigDelegate() {} |
| - // Returns true if cast extension is installed. |
| - // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is |
| - // gone. See crbug.com/551132. |
| - virtual bool HasCastExtension() const = 0; |
| - |
| // Request fresh data from the backend. When the data is available, all |
| // registered observers will get called. |
| virtual void RequestDeviceRefresh() = 0; |
| - // Cast to a receiver specified by |receiver_id|. |
| - virtual void CastToReceiver(const std::string& receiver_id) = 0; |
| - |
| - // Stop an ongoing cast (this should be a user initiated stop). |activity_id| |
| - // is the identifier of the activity/route that should be stopped. |
| - virtual void StopCasting(const std::string& activity_id) = 0; |
| - |
| - // Does the device have a settings page? |
| - // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is |
| - // gone. See crbug.com/551132. |
| - virtual bool HasOptions() const = 0; |
| + // Initiate a casting session to |sink|. |
| + virtual void CastToReceiver(const Sink& sink) = 0; |
|
achuithb
2016/10/27 19:38:59
Should this be CastToSink, or is this name still o
jdufault
2016/10/31 21:12:07
Done.
|
| - // Opens Options page for cast. |
| - // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is |
| - // gone. See crbug.com/551132. |
| - virtual void LaunchCastOptions() = 0; |
| + // A user-initiated request to stop the given cast session. |
| + virtual void StopCasting(const Route& route) = 0; |
| // Add or remove an observer. |
| virtual void AddObserver(Observer* observer) = 0; |