| 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_MOJO_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 public: | 144 public: |
| 145 MediaSinksQuery(); | 145 MediaSinksQuery(); |
| 146 ~MediaSinksQuery(); | 146 ~MediaSinksQuery(); |
| 147 | 147 |
| 148 // True if the query has been sent to the MRPM. | 148 // True if the query has been sent to the MRPM. |
| 149 bool is_active = false; | 149 bool is_active = false; |
| 150 | 150 |
| 151 // True if cached result is available. | 151 // True if cached result is available. |
| 152 bool has_cached_result = false; | 152 bool has_cached_result = false; |
| 153 | 153 |
| 154 GURL origin; |
| 155 |
| 154 // Cached list of sinks for the query, if |has_cached_result| is true. | 156 // Cached list of sinks for the query, if |has_cached_result| is true. |
| 155 // Empty otherwise. | 157 // Empty otherwise. |
| 156 std::vector<MediaSink> cached_sink_list; | 158 std::vector<MediaSink> cached_sink_list; |
| 157 base::ObserverList<MediaSinksObserver> observers; | 159 base::ObserverList<MediaSinksObserver> observers; |
| 158 | 160 |
| 159 private: | 161 private: |
| 160 DISALLOW_COPY_AND_ASSIGN(MediaSinksQuery); | 162 DISALLOW_COPY_AND_ASSIGN(MediaSinksQuery); |
| 161 }; | 163 }; |
| 162 | 164 |
| 163 struct MediaRoutesQuery { | 165 struct MediaRoutesQuery { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 void DoTerminateRoute(const MediaRoute::Id& route_id); | 238 void DoTerminateRoute(const MediaRoute::Id& route_id); |
| 237 void DoDetachRoute(const MediaRoute::Id& route_id); | 239 void DoDetachRoute(const MediaRoute::Id& route_id); |
| 238 void DoSendSessionMessage(const MediaRoute::Id& route_id, | 240 void DoSendSessionMessage(const MediaRoute::Id& route_id, |
| 239 const std::string& message, | 241 const std::string& message, |
| 240 const SendRouteMessageCallback& callback); | 242 const SendRouteMessageCallback& callback); |
| 241 void DoSendSessionBinaryMessage(const MediaRoute::Id& route_id, | 243 void DoSendSessionBinaryMessage(const MediaRoute::Id& route_id, |
| 242 scoped_ptr<std::vector<uint8_t>> data, | 244 scoped_ptr<std::vector<uint8_t>> data, |
| 243 const SendRouteMessageCallback& callback); | 245 const SendRouteMessageCallback& callback); |
| 244 void DoListenForRouteMessages(const MediaRoute::Id& route_id); | 246 void DoListenForRouteMessages(const MediaRoute::Id& route_id); |
| 245 void DoStopListeningForRouteMessages(const MediaRoute::Id& route_id); | 247 void DoStopListeningForRouteMessages(const MediaRoute::Id& route_id); |
| 246 void DoStartObservingMediaSinks(const MediaSource::Id& source_id); | 248 void DoStartObservingMediaSinks(const MediaSource& source); |
| 247 void DoStopObservingMediaSinks(const MediaSource::Id& source_id); | 249 void DoStopObservingMediaSinks(const MediaSource& source); |
| 248 void DoStartObservingMediaRoutes(const MediaSource::Id& source_id); | 250 void DoStartObservingMediaRoutes(const MediaSource::Id& source_id); |
| 249 void DoStopObservingMediaRoutes(const MediaSource::Id& source_id); | 251 void DoStopObservingMediaRoutes(const MediaSource::Id& source_id); |
| 250 | 252 |
| 251 // Invoked when the next batch of messages arrives. | 253 // Invoked when the next batch of messages arrives. |
| 252 // |route_id|: ID of route of the messages. | 254 // |route_id|: ID of route of the messages. |
| 253 // |messages|: A list of messages received. | 255 // |messages|: A list of messages received. |
| 254 // |error|: true if an error occurred. | 256 // |error|: true if an error occurred. |
| 255 void OnRouteMessagesReceived( | 257 void OnRouteMessagesReceived( |
| 256 const MediaRoute::Id& route_id, | 258 const MediaRoute::Id& route_id, |
| 257 mojo::Array<interfaces::RouteMessagePtr> messages, | 259 mojo::Array<interfaces::RouteMessagePtr> messages, |
| 258 bool error); | 260 bool error); |
| 259 | 261 |
| 260 // Error handler callback for |binding_| and |media_route_provider_|. | 262 // Error handler callback for |binding_| and |media_route_provider_|. |
| 261 void OnConnectionError(); | 263 void OnConnectionError(); |
| 262 | 264 |
| 263 // interfaces::MediaRouter implementation. | 265 // interfaces::MediaRouter implementation. |
| 264 void RegisterMediaRouteProvider( | 266 void RegisterMediaRouteProvider( |
| 265 interfaces::MediaRouteProviderPtr media_route_provider_ptr, | 267 interfaces::MediaRouteProviderPtr media_route_provider_ptr, |
| 266 const interfaces::MediaRouter::RegisterMediaRouteProviderCallback& | 268 const interfaces::MediaRouter::RegisterMediaRouteProviderCallback& |
| 267 callback) override; | 269 callback) override; |
| 268 void OnIssue(interfaces::IssuePtr issue) override; | 270 void OnIssue(interfaces::IssuePtr issue) override; |
| 269 void OnSinksReceived(const mojo::String& media_source, | 271 void OnSinksReceived(const mojo::String& media_source, |
| 272 const mojo::String& origin, |
| 270 mojo::Array<interfaces::MediaSinkPtr> sinks) override; | 273 mojo::Array<interfaces::MediaSinkPtr> sinks) override; |
| 271 void OnRoutesUpdated(mojo::Array<interfaces::MediaRoutePtr> routes, | 274 void OnRoutesUpdated(mojo::Array<interfaces::MediaRoutePtr> routes, |
| 272 const mojo::String& media_source, | 275 const mojo::String& media_source, |
| 273 mojo::Array<mojo::String> joinable_route_ids) override; | 276 mojo::Array<mojo::String> joinable_route_ids) override; |
| 274 void OnSinkAvailabilityUpdated( | 277 void OnSinkAvailabilityUpdated( |
| 275 interfaces::MediaRouter::SinkAvailability availability) override; | 278 interfaces::MediaRouter::SinkAvailability availability) override; |
| 276 void OnPresentationConnectionStateChanged( | 279 void OnPresentationConnectionStateChanged( |
| 277 const mojo::String& route_id, | 280 const mojo::String& route_id, |
| 278 interfaces::MediaRouter::PresentationConnectionState state) override; | 281 interfaces::MediaRouter::PresentationConnectionState state) override; |
| 279 void OnPresentationConnectionClosed( | 282 void OnPresentationConnectionClosed( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // we record the first such reason. | 314 // we record the first such reason. |
| 312 void SetWakeReason(MediaRouteProviderWakeReason reason); | 315 void SetWakeReason(MediaRouteProviderWakeReason reason); |
| 313 | 316 |
| 314 // Clears the wake reason after the extension has been awoken. | 317 // Clears the wake reason after the extension has been awoken. |
| 315 void ClearWakeReason(); | 318 void ClearWakeReason(); |
| 316 | 319 |
| 317 // Pending requests queued to be executed once component extension | 320 // Pending requests queued to be executed once component extension |
| 318 // becomes ready. | 321 // becomes ready. |
| 319 std::deque<base::Closure> pending_requests_; | 322 std::deque<base::Closure> pending_requests_; |
| 320 | 323 |
| 321 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaSinksQuery>> | 324 base::ScopedPtrHashMap<MediaSource, scoped_ptr<MediaSinksQuery>> |
| 322 sinks_queries_; | 325 sinks_queries_; |
| 323 | 326 |
| 324 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaRoutesQuery>> | 327 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaRoutesQuery>> |
| 325 routes_queries_; | 328 routes_queries_; |
| 326 | 329 |
| 327 using PresentationSessionMessagesObserverList = | 330 using PresentationSessionMessagesObserverList = |
| 328 base::ObserverList<PresentationSessionMessagesObserver>; | 331 base::ObserverList<PresentationSessionMessagesObserver>; |
| 329 base::ScopedPtrHashMap<MediaRoute::Id, | 332 base::ScopedPtrHashMap<MediaRoute::Id, |
| 330 scoped_ptr<PresentationSessionMessagesObserverList>> | 333 scoped_ptr<PresentationSessionMessagesObserverList>> |
| 331 messages_observers_; | 334 messages_observers_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 MediaRouteProviderWakeReason current_wake_reason_; | 375 MediaRouteProviderWakeReason current_wake_reason_; |
| 373 | 376 |
| 374 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 377 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
| 375 | 378 |
| 376 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 379 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 377 }; | 380 }; |
| 378 | 381 |
| 379 } // namespace media_router | 382 } // namespace media_router |
| 380 | 383 |
| 381 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 384 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |