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_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override; | 241 bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override; |
242 void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override; | 242 void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override; |
243 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 243 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
244 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 244 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
245 void RegisterIssuesObserver(IssuesObserver* observer) override; | 245 void RegisterIssuesObserver(IssuesObserver* observer) override; |
246 void UnregisterIssuesObserver(IssuesObserver* observer) override; | 246 void UnregisterIssuesObserver(IssuesObserver* observer) override; |
247 void RegisterRouteMessageObserver(RouteMessageObserver* observer) override; | 247 void RegisterRouteMessageObserver(RouteMessageObserver* observer) override; |
248 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override; | 248 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override; |
249 void DetachRouteController(const MediaRoute::Id& route_id, | 249 void DetachRouteController(const MediaRoute::Id& route_id, |
250 MediaRouteController* controller) override; | 250 MediaRouteController* controller) override; |
| 251 void RegisterRemotingSource(int32_t tab_id, |
| 252 CastRemotingConnector* connector) override; |
| 253 void UnRegisterRemotingSource(int32_t tab_id, |
| 254 CastRemotingConnector* connector) override; |
251 | 255 |
252 // Notifies |observer| of any existing cached routes, if it is still | 256 // Notifies |observer| of any existing cached routes, if it is still |
253 // registered. | 257 // registered. |
254 void NotifyOfExistingRoutesIfRegistered(const MediaSource::Id& source_id, | 258 void NotifyOfExistingRoutesIfRegistered(const MediaSource::Id& source_id, |
255 MediaRoutesObserver* observer) const; | 259 MediaRoutesObserver* observer) const; |
256 | 260 |
257 // These calls invoke methods in the component extension via Mojo. | 261 // These calls invoke methods in the component extension via Mojo. |
258 void DoCreateRoute(const MediaSource::Id& source_id, | 262 void DoCreateRoute(const MediaSource::Id& source_id, |
259 const MediaSink::Id& sink_id, | 263 const MediaSink::Id& sink_id, |
260 const url::Origin& origin, | 264 const url::Origin& origin, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 void OnPresentationConnectionStateChanged( | 339 void OnPresentationConnectionStateChanged( |
336 const std::string& route_id, | 340 const std::string& route_id, |
337 content::PresentationConnectionState state) override; | 341 content::PresentationConnectionState state) override; |
338 void OnPresentationConnectionClosed( | 342 void OnPresentationConnectionClosed( |
339 const std::string& route_id, | 343 const std::string& route_id, |
340 content::PresentationConnectionCloseReason reason, | 344 content::PresentationConnectionCloseReason reason, |
341 const std::string& message) override; | 345 const std::string& message) override; |
342 void OnRouteMessagesReceived( | 346 void OnRouteMessagesReceived( |
343 const std::string& route_id, | 347 const std::string& route_id, |
344 const std::vector<RouteMessage>& messages) override; | 348 const std::vector<RouteMessage>& messages) override; |
| 349 void OnMediaRemoterCreated( |
| 350 int32_t tab_id, |
| 351 media::mojom::MirrorServiceRemoterPtr remoter, |
| 352 media::mojom::MirrorServiceRemotingSourceRequest source_request) override; |
345 | 353 |
346 // Result callback when Mojo terminateRoute is invoked. |route_id| is bound | 354 // Result callback when Mojo terminateRoute is invoked. |route_id| is bound |
347 // to the ID of the route that was terminated. | 355 // to the ID of the route that was terminated. |
348 void OnTerminateRouteResult(const MediaRoute::Id& route_id, | 356 void OnTerminateRouteResult(const MediaRoute::Id& route_id, |
349 const base::Optional<std::string>& error_text, | 357 const base::Optional<std::string>& error_text, |
350 RouteRequestResult::ResultCode result_code); | 358 RouteRequestResult::ResultCode result_code); |
351 | 359 |
352 // Converts the callback result of calling Mojo CreateRoute()/JoinRoute() | 360 // Converts the callback result of calling Mojo CreateRoute()/JoinRoute() |
353 // into a local callback. | 361 // into a local callback. |
354 void RouteResponseReceived(const std::string& presentation_id, | 362 void RouteResponseReceived(const std::string& presentation_id, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // A pair of flags to ensure that mDNS discovery is only enabled on Windows | 486 // A pair of flags to ensure that mDNS discovery is only enabled on Windows |
479 // when there will be appropriate context for the user to associate a firewall | 487 // when there will be appropriate context for the user to associate a firewall |
480 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from | 488 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from |
481 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in | 489 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in |
482 // RegisterMediaRouteProvider and only set to |true| when we successfully call | 490 // RegisterMediaRouteProvider and only set to |true| when we successfully call |
483 // the extension to enable mDNS. | 491 // the extension to enable mDNS. |
484 bool is_mdns_enabled_ = false; | 492 bool is_mdns_enabled_ = false; |
485 bool should_enable_mdns_discovery_ = false; | 493 bool should_enable_mdns_discovery_ = false; |
486 #endif | 494 #endif |
487 | 495 |
| 496 // Stores CastRemotingConnectors that can be connected to the MediaRemoter |
| 497 // for media remoting when OnMediaRemoterCreated() is called. The map uses the |
| 498 // tab ID as the key. |
| 499 std::unordered_map<int32_t, CastRemotingConnector*> remoting_sources_; |
| 500 |
488 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 501 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
489 | 502 |
490 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 503 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
491 }; | 504 }; |
492 | 505 |
493 } // namespace media_router | 506 } // namespace media_router |
494 | 507 |
495 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 508 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
OLD | NEW |