| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class WebContents; | 26 class WebContents; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace media_router { | 29 namespace media_router { |
| 30 | 30 |
| 31 class IssuesObserver; | 31 class IssuesObserver; |
| 32 class MediaRoutesObserver; | 32 class MediaRoutesObserver; |
| 33 class MediaSinksObserver; | 33 class MediaSinksObserver; |
| 34 class MediaSinksSearchRequest; |
| 34 class PresentationConnectionStateObserver; | 35 class PresentationConnectionStateObserver; |
| 35 class PresentationSessionMessagesObserver; | 36 class PresentationSessionMessagesObserver; |
| 37 class QueryResultManager; |
| 36 class RouteRequestResult; | 38 class RouteRequestResult; |
| 37 | 39 |
| 38 // Type of callback used in |CreateRoute()|, |JoinRoute()|, and | 40 // Type of callback used in |CreateRoute()|, |JoinRoute()|, and |
| 39 // |ConnectRouteByRouteId()|. Callback is invoked when the route request either | 41 // |ConnectRouteByRouteId()|. Callback is invoked when the route request either |
| 40 // succeeded or failed. | 42 // succeeded or failed. |
| 41 using MediaRouteResponseCallback = | 43 using MediaRouteResponseCallback = |
| 42 base::Callback<void(const RouteRequestResult& result)>; | 44 base::Callback<void(const RouteRequestResult& result)>; |
| 43 | 45 |
| 44 // Subscription object returned by calling | 46 // Subscription object returned by calling |
| 45 // |AddPresentationConnectionStateChangedCallback|. See the method comments for | 47 // |AddPresentationConnectionStateChangedCallback|. See the method comments for |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 AddPresentationConnectionStateChangedCallback( | 159 AddPresentationConnectionStateChangedCallback( |
| 158 const MediaRoute::Id& route_id, | 160 const MediaRoute::Id& route_id, |
| 159 const content::PresentationConnectionStateChangedCallback& callback) = 0; | 161 const content::PresentationConnectionStateChangedCallback& callback) = 0; |
| 160 | 162 |
| 161 private: | 163 private: |
| 162 friend class IssuesObserver; | 164 friend class IssuesObserver; |
| 163 friend class MediaSinksObserver; | 165 friend class MediaSinksObserver; |
| 164 friend class MediaRoutesObserver; | 166 friend class MediaRoutesObserver; |
| 165 friend class PresentationConnectionStateObserver; | 167 friend class PresentationConnectionStateObserver; |
| 166 friend class PresentationSessionMessagesObserver; | 168 friend class PresentationSessionMessagesObserver; |
| 169 friend class QueryResultManager; |
| 167 | 170 |
| 168 // The following functions are called by friend Observer classes above. | 171 // The following functions are called by friend Observer classes above. |
| 169 | 172 |
| 170 // Registers |observer| with this MediaRouter. |observer| specifies a media | 173 // Registers |observer| with this MediaRouter. |observer| specifies a media |
| 171 // source and will receive updates with media sinks that are compatible with | 174 // source and will receive updates with media sinks that are compatible with |
| 172 // that source. The initial update may happen synchronously. | 175 // that source. The initial update may happen synchronously. |
| 173 // NOTE: This class does not assume ownership of |observer|. Callers must | 176 // NOTE: This class does not assume ownership of |observer|. Callers must |
| 174 // manage |observer| and make sure |UnregisterObserver()| is called | 177 // manage |observer| and make sure |UnregisterObserver()| is called |
| 175 // before the observer is destroyed. | 178 // before the observer is destroyed. |
| 176 // It is invalid to register the same observer more than once and will result | 179 // It is invalid to register the same observer more than once and will result |
| 177 // in undefined behavior. | 180 // in undefined behavior. |
| 178 // If the MRPM Host is not available, the registration request will fail | 181 // If the MRPM Host is not available, the registration request will fail |
| 179 // immediately. | 182 // immediately. |
| 180 // The implementation can reject the request to observe in which case it will | 183 // The implementation can reject the request to observe in which case it will |
| 181 // notify the caller by returning |false|. | 184 // notify the caller by returning |false|. |
| 182 virtual bool RegisterMediaSinksObserver(MediaSinksObserver* observer) = 0; | 185 virtual bool RegisterMediaSinksObserver(MediaSinksObserver* observer) = 0; |
| 183 | 186 |
| 184 // Removes a previously added MediaSinksObserver. |observer| will stop | 187 // Removes a previously added MediaSinksObserver. |observer| will stop |
| 185 // receiving further updates. | 188 // receiving further updates. |
| 186 virtual void UnregisterMediaSinksObserver(MediaSinksObserver* observer) = 0; | 189 virtual void UnregisterMediaSinksObserver(MediaSinksObserver* observer) = 0; |
| 187 | 190 |
| 191 // Registers |request| with this MediaRouter. |request| specifies a media |
| 192 // source and a sink ID. The MediaRouter will ask the Media Router Provider |
| 193 // Manager to search for sinks matching the sink ID that also support the |
| 194 // media source. |request| will be notified when the MRPM responds and then it |
| 195 // will be destroyed. |
| 196 // Multiple requests can be registered for the same sink ID. Only one query |
| 197 // per sink ID will be pending at one time. |
| 198 // The implementation can reject the request to search in which case it will |
| 199 // notify the caller by returning |false|. |
| 200 virtual bool RegisterMediaSinksSearchRequest( |
| 201 scoped_ptr<MediaSinksSearchRequest> request) = 0; |
| 202 |
| 188 // Adds a MediaRoutesObserver to listen for updates on MediaRoutes. | 203 // Adds a MediaRoutesObserver to listen for updates on MediaRoutes. |
| 189 // The initial update may happen synchronously. | 204 // The initial update may happen synchronously. |
| 190 // MediaRouter does not own |observer|. |UnregisterMediaRoutesObserver| should | 205 // MediaRouter does not own |observer|. |UnregisterMediaRoutesObserver| should |
| 191 // be called before |observer| is destroyed. | 206 // be called before |observer| is destroyed. |
| 192 // It is invalid to register the same observer more than once and will result | 207 // It is invalid to register the same observer more than once and will result |
| 193 // in undefined behavior. | 208 // in undefined behavior. |
| 194 virtual void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) = 0; | 209 virtual void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) = 0; |
| 195 | 210 |
| 196 // Removes a previously added MediaRoutesObserver. |observer| will stop | 211 // Removes a previously added MediaRoutesObserver. |observer| will stop |
| 197 // receiving further updates. | 212 // receiving further updates. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 216 | 231 |
| 217 // Unregisters a previously registered PresentationSessionMessagesObserver. | 232 // Unregisters a previously registered PresentationSessionMessagesObserver. |
| 218 // |observer| will stop receiving further updates. | 233 // |observer| will stop receiving further updates. |
| 219 virtual void UnregisterPresentationSessionMessagesObserver( | 234 virtual void UnregisterPresentationSessionMessagesObserver( |
| 220 PresentationSessionMessagesObserver* observer) = 0; | 235 PresentationSessionMessagesObserver* observer) = 0; |
| 221 }; | 236 }; |
| 222 | 237 |
| 223 } // namespace media_router | 238 } // namespace media_router |
| 224 | 239 |
| 225 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 240 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| OLD | NEW |