| OLD | NEW |
| 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 CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class WebContents; | 26 class WebContents; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace url { | 29 namespace url { |
| 30 class Origin; | 30 class Origin; |
| 31 } // namespace url | 31 } // namespace url |
| 32 | 32 |
| 33 namespace media_router { | 33 namespace media_router { |
| 34 | 34 |
| 35 class IssuesObserver; | 35 class IssuesObserver; |
| 36 class MediaRouteController; |
| 36 class MediaRoutesObserver; | 37 class MediaRoutesObserver; |
| 37 class MediaSinksObserver; | 38 class MediaSinksObserver; |
| 38 class PresentationConnectionStateObserver; | 39 class PresentationConnectionStateObserver; |
| 39 class RouteRequestResult; | 40 class RouteRequestResult; |
| 40 | 41 |
| 41 // Type of callback used in |CreateRoute()|, |JoinRoute()|, and | 42 // Type of callback used in |CreateRoute()|, |JoinRoute()|, and |
| 42 // |ConnectRouteByRouteId()|. Callback is invoked when the route request either | 43 // |ConnectRouteByRouteId()|. Callback is invoked when the route request either |
| 43 // succeeded or failed. | 44 // succeeded or failed. |
| 44 using MediaRouteResponseCallback = | 45 using MediaRouteResponseCallback = |
| 45 base::Callback<void(const RouteRequestResult& result)>; | 46 base::Callback<void(const RouteRequestResult& result)>; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 const content::PresentationConnectionStateChangedCallback& callback) = 0; | 190 const content::PresentationConnectionStateChangedCallback& callback) = 0; |
| 190 | 191 |
| 191 // Called when the incognito profile for this instance is being shut down. | 192 // Called when the incognito profile for this instance is being shut down. |
| 192 // This will terminate all incognito media routes. | 193 // This will terminate all incognito media routes. |
| 193 virtual void OnIncognitoProfileShutdown() = 0; | 194 virtual void OnIncognitoProfileShutdown() = 0; |
| 194 | 195 |
| 195 // Returns the media routes that currently exist. To get notified whenever | 196 // Returns the media routes that currently exist. To get notified whenever |
| 196 // there is a change to the media routes, subclass MediaRoutesObserver. | 197 // there is a change to the media routes, subclass MediaRoutesObserver. |
| 197 virtual std::vector<MediaRoute> GetCurrentRoutes() const = 0; | 198 virtual std::vector<MediaRoute> GetCurrentRoutes() const = 0; |
| 198 | 199 |
| 200 // Returns a controller for sending media commands to a route. Returns a |
| 201 // nullptr if no MediaRoute exists for the given |route_id|. |
| 202 virtual scoped_refptr<MediaRouteController> GetRouteController( |
| 203 const MediaRoute::Id& route_id) = 0; |
| 204 |
| 199 private: | 205 private: |
| 200 friend class IssuesObserver; | 206 friend class IssuesObserver; |
| 201 friend class MediaSinksObserver; | 207 friend class MediaSinksObserver; |
| 208 friend class MediaRouteController; |
| 202 friend class MediaRoutesObserver; | 209 friend class MediaRoutesObserver; |
| 203 friend class PresentationConnectionStateObserver; | 210 friend class PresentationConnectionStateObserver; |
| 204 friend class RouteMessageObserver; | 211 friend class RouteMessageObserver; |
| 205 | 212 |
| 206 // The following functions are called by friend Observer classes above. | 213 // The following functions are called by friend Observer classes above. |
| 207 | 214 |
| 208 // Registers |observer| with this MediaRouter. |observer| specifies a media | 215 // Registers |observer| with this MediaRouter. |observer| specifies a media |
| 209 // source and will receive updates with media sinks that are compatible with | 216 // source and will receive updates with media sinks that are compatible with |
| 210 // that source. The initial update may happen synchronously. | 217 // that source. The initial update may happen synchronously. |
| 211 // NOTE: This class does not assume ownership of |observer|. Callers must | 218 // NOTE: This class does not assume ownership of |observer|. Callers must |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // route and will receive messages from the MediaSink connected to the | 254 // route and will receive messages from the MediaSink connected to the |
| 248 // route. Note that MediaRouter does not own |observer|. |observer| should be | 255 // route. Note that MediaRouter does not own |observer|. |observer| should be |
| 249 // unregistered before it is destroyed. Registering the same observer more | 256 // unregistered before it is destroyed. Registering the same observer more |
| 250 // than once will result in undefined behavior. | 257 // than once will result in undefined behavior. |
| 251 virtual void RegisterRouteMessageObserver(RouteMessageObserver* observer) = 0; | 258 virtual void RegisterRouteMessageObserver(RouteMessageObserver* observer) = 0; |
| 252 | 259 |
| 253 // Unregisters a previously registered RouteMessagesObserver. |observer| will | 260 // Unregisters a previously registered RouteMessagesObserver. |observer| will |
| 254 // stop receiving further updates. | 261 // stop receiving further updates. |
| 255 virtual void UnregisterRouteMessageObserver( | 262 virtual void UnregisterRouteMessageObserver( |
| 256 RouteMessageObserver* observer) = 0; | 263 RouteMessageObserver* observer) = 0; |
| 264 |
| 265 // Removes the MediaRouteController for |route_id| from the list of |
| 266 // controllers held by |this|. Called by MediaRouteController when it is |
| 267 // invalidated. |
| 268 virtual void DetachRouteController(const MediaRoute::Id& route_id, |
| 269 MediaRouteController* controller) = 0; |
| 257 }; | 270 }; |
| 258 | 271 |
| 259 } // namespace media_router | 272 } // namespace media_router |
| 260 | 273 |
| 261 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 274 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| OLD | NEW |