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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const SendRouteMessageCallback& callback) override; | 101 const SendRouteMessageCallback& callback) override; |
102 void AddIssue(const IssueInfo& issue_info) override; | 102 void AddIssue(const IssueInfo& issue_info) override; |
103 void ClearIssue(const Issue::Id& issue_id) override; | 103 void ClearIssue(const Issue::Id& issue_id) override; |
104 void OnUserGesture() override; | 104 void OnUserGesture() override; |
105 void SearchSinks( | 105 void SearchSinks( |
106 const MediaSink::Id& sink_id, | 106 const MediaSink::Id& sink_id, |
107 const MediaSource::Id& source_id, | 107 const MediaSource::Id& source_id, |
108 const std::string& search_input, | 108 const std::string& search_input, |
109 const std::string& domain, | 109 const std::string& domain, |
110 const MediaSinkSearchResponseCallback& sink_callback) override; | 110 const MediaSinkSearchResponseCallback& sink_callback) override; |
| 111 MediaRouteController* GetControllerForRoute( |
| 112 const MediaRoute::Id& route_id) override; |
| 113 |
| 114 bool GetMediaRouteController(const MediaRoute::Id& route_id, |
| 115 mojom::MediaControllerRequest controller); |
| 116 void DestroyMediaRouteController(const MediaRoute::Id& route_id); |
111 | 117 |
112 const std::string& media_route_provider_extension_id() const { | 118 const std::string& media_route_provider_extension_id() const { |
113 return media_route_provider_extension_id_; | 119 return media_route_provider_extension_id_; |
114 } | 120 } |
115 | 121 |
116 void set_instance_id_for_test(const std::string& instance_id) { | 122 void set_instance_id_for_test(const std::string& instance_id) { |
117 instance_id_ = instance_id; | 123 instance_id_ = instance_id; |
118 } | 124 } |
119 | 125 |
120 private: | 126 private: |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // happen until the user is clearly interacting with MR. | 364 // happen until the user is clearly interacting with MR. |
359 void OnFirewallCheckComplete(bool firewall_can_use_local_ports); | 365 void OnFirewallCheckComplete(bool firewall_can_use_local_ports); |
360 #endif | 366 #endif |
361 | 367 |
362 // Requests MRPM to update media sinks. This allows MRPs that only do | 368 // Requests MRPM to update media sinks. This allows MRPs that only do |
363 // discovery on sink queries an opportunity to update discovery results | 369 // discovery on sink queries an opportunity to update discovery results |
364 // even if the MRP SinkAvailability is marked UNAVAILABLE. | 370 // even if the MRP SinkAvailability is marked UNAVAILABLE. |
365 void UpdateMediaSinks(const MediaSource::Id& source_id); | 371 void UpdateMediaSinks(const MediaSource::Id& source_id); |
366 void DoUpdateMediaSinks(const MediaSource::Id& source_id); | 372 void DoUpdateMediaSinks(const MediaSource::Id& source_id); |
367 | 373 |
| 374 // Removes controllers from |route_controllers_| whose media routes do not |
| 375 // appear in |routes|. |
| 376 void RemoveInvalidMediaRouteControllers( |
| 377 const std::vector<MediaRoute>& routes); |
| 378 |
368 // Pending requests queued to be executed once component extension | 379 // Pending requests queued to be executed once component extension |
369 // becomes ready. | 380 // becomes ready. |
370 std::deque<base::Closure> pending_requests_; | 381 std::deque<base::Closure> pending_requests_; |
371 | 382 |
372 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaSinksQuery>> | 383 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaSinksQuery>> |
373 sinks_queries_; | 384 sinks_queries_; |
374 | 385 |
375 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaRoutesQuery>> | 386 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaRoutesQuery>> |
376 routes_queries_; | 387 routes_queries_; |
377 | 388 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 int wakeup_attempt_count_ = 0; | 422 int wakeup_attempt_count_ = 0; |
412 | 423 |
413 // Records the current reason the extension is being woken up. Is set to | 424 // Records the current reason the extension is being woken up. Is set to |
414 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. | 425 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. |
415 MediaRouteProviderWakeReason current_wake_reason_; | 426 MediaRouteProviderWakeReason current_wake_reason_; |
416 | 427 |
417 // A flag to ensure that we record the provider version once, during the | 428 // A flag to ensure that we record the provider version once, during the |
418 // initial event page wakeup attempt. | 429 // initial event page wakeup attempt. |
419 bool provider_version_was_recorded_ = false; | 430 bool provider_version_was_recorded_ = false; |
420 | 431 |
| 432 std::unordered_map<MediaRoute::Id, std::unique_ptr<MediaRouteController>> |
| 433 route_controllers_; |
| 434 |
421 #if defined(OS_WIN) | 435 #if defined(OS_WIN) |
422 // A pair of flags to ensure that mDNS discovery is only enabled on Windows | 436 // A pair of flags to ensure that mDNS discovery is only enabled on Windows |
423 // when there will be appropriate context for the user to associate a firewall | 437 // when there will be appropriate context for the user to associate a firewall |
424 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from | 438 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from |
425 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in | 439 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in |
426 // RegisterMediaRouteProvider and only set to |true| when we successfully call | 440 // RegisterMediaRouteProvider and only set to |true| when we successfully call |
427 // the extension to enable mDNS. | 441 // the extension to enable mDNS. |
428 bool is_mdns_enabled_ = false; | 442 bool is_mdns_enabled_ = false; |
429 bool should_enable_mdns_discovery_ = false; | 443 bool should_enable_mdns_discovery_ = false; |
430 #endif | 444 #endif |
431 | 445 |
432 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 446 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
433 | 447 |
434 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 448 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
435 }; | 449 }; |
436 | 450 |
437 } // namespace media_router | 451 } // namespace media_router |
438 | 452 |
439 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 453 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
OLD | NEW |