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