Chromium Code Reviews| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 const SendRouteMessageCallback& callback) override; | 102 const SendRouteMessageCallback& callback) override; |
| 103 void AddIssue(const IssueInfo& issue_info) override; | 103 void AddIssue(const IssueInfo& issue_info) override; |
| 104 void ClearIssue(const Issue::Id& issue_id) override; | 104 void ClearIssue(const Issue::Id& issue_id) override; |
| 105 void OnUserGesture() override; | 105 void OnUserGesture() override; |
| 106 void SearchSinks( | 106 void SearchSinks( |
| 107 const MediaSink::Id& sink_id, | 107 const MediaSink::Id& sink_id, |
| 108 const MediaSource::Id& source_id, | 108 const MediaSource::Id& source_id, |
| 109 const std::string& search_input, | 109 const std::string& search_input, |
| 110 const std::string& domain, | 110 const std::string& domain, |
| 111 const MediaSinkSearchResponseCallback& sink_callback) override; | 111 const MediaSinkSearchResponseCallback& sink_callback) override; |
| 112 scoped_refptr<MediaRouteController> GetRouteController( | |
| 113 const MediaRoute::Id& route_id) override; | |
| 114 void OnRouteControllerDestroyed(const MediaRoute::Id& route_id) override; | |
| 112 | 115 |
| 113 const std::string& media_route_provider_extension_id() const { | 116 const std::string& media_route_provider_extension_id() const { |
| 114 return media_route_provider_extension_id_; | 117 return media_route_provider_extension_id_; |
| 115 } | 118 } |
| 116 | 119 |
| 117 void set_instance_id_for_test(const std::string& instance_id) { | 120 void set_instance_id_for_test(const std::string& instance_id) { |
| 118 instance_id_ = instance_id; | 121 instance_id_ = instance_id; |
| 119 } | 122 } |
| 120 | 123 |
| 121 private: | 124 private: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 135 FRIEND_TEST_ALL_PREFIXES( | 138 FRIEND_TEST_ALL_PREFIXES( |
| 136 MediaRouterMojoImplTest, | 139 MediaRouterMojoImplTest, |
| 137 RegisterAndUnregisterMediaSinksObserverWithAvailabilityChange); | 140 RegisterAndUnregisterMediaSinksObserverWithAvailabilityChange); |
| 138 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | 141 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, |
| 139 RegisterAndUnregisterMediaRoutesObserver); | 142 RegisterAndUnregisterMediaRoutesObserver); |
| 140 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | 143 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, |
| 141 RouteMessagesSingleObserver); | 144 RouteMessagesSingleObserver); |
| 142 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | 145 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, |
| 143 RouteMessagesMultipleObservers); | 146 RouteMessagesMultipleObservers); |
| 144 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, HandleIssue); | 147 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, HandleIssue); |
| 148 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, | |
| 149 GetRouteControllerAfterRouteInvalidation); | |
| 145 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 150 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
| 146 DeferredBindingAndSuspension); | 151 DeferredBindingAndSuspension); |
| 147 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 152 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
| 148 DrainPendingRequestQueue); | 153 DrainPendingRequestQueue); |
| 149 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 154 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
| 150 DropOldestPendingRequest); | 155 DropOldestPendingRequest); |
| 151 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 156 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
| 152 AttemptedWakeupTooManyTimes); | 157 AttemptedWakeupTooManyTimes); |
| 153 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, | 158 FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest, |
| 154 WakeupFailedDrainsQueue); | 159 WakeupFailedDrainsQueue); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 // happen until the user is clearly interacting with MR. | 371 // happen until the user is clearly interacting with MR. |
| 367 void OnFirewallCheckComplete(bool firewall_can_use_local_ports); | 372 void OnFirewallCheckComplete(bool firewall_can_use_local_ports); |
| 368 #endif | 373 #endif |
| 369 | 374 |
| 370 // Requests MRPM to update media sinks. This allows MRPs that only do | 375 // Requests MRPM to update media sinks. This allows MRPs that only do |
| 371 // discovery on sink queries an opportunity to update discovery results | 376 // discovery on sink queries an opportunity to update discovery results |
| 372 // even if the MRP SinkAvailability is marked UNAVAILABLE. | 377 // even if the MRP SinkAvailability is marked UNAVAILABLE. |
| 373 void UpdateMediaSinks(const MediaSource::Id& source_id); | 378 void UpdateMediaSinks(const MediaSource::Id& source_id); |
| 374 void DoUpdateMediaSinks(const MediaSource::Id& source_id); | 379 void DoUpdateMediaSinks(const MediaSource::Id& source_id); |
| 375 | 380 |
| 381 // Removes controllers from |route_controllers_| whose media routes do not | |
|
imcheng
2017/03/28 01:18:38
Invalidates and removes
takumif
2017/03/29 02:34:49
Done.
| |
| 382 // appear in |routes|. | |
| 383 void RemoveInvalidRouteControllers(const std::vector<MediaRoute>& routes); | |
| 384 | |
| 385 // Callback called by MRP's CreateMediaRouteController(). | |
| 386 void OnMediaControllerCreated(const MediaRoute::Id& route_id, bool success); | |
| 387 | |
| 376 // Pending requests queued to be executed once component extension | 388 // Pending requests queued to be executed once component extension |
| 377 // becomes ready. | 389 // becomes ready. |
| 378 std::deque<base::Closure> pending_requests_; | 390 std::deque<base::Closure> pending_requests_; |
| 379 | 391 |
| 380 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaSinksQuery>> | 392 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaSinksQuery>> |
| 381 sinks_queries_; | 393 sinks_queries_; |
| 382 | 394 |
| 383 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaRoutesQuery>> | 395 std::unordered_map<MediaSource::Id, std::unique_ptr<MediaRoutesQuery>> |
| 384 routes_queries_; | 396 routes_queries_; |
| 385 | 397 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 int wakeup_attempt_count_ = 0; | 431 int wakeup_attempt_count_ = 0; |
| 420 | 432 |
| 421 // Records the current reason the extension is being woken up. Is set to | 433 // Records the current reason the extension is being woken up. Is set to |
| 422 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. | 434 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. |
| 423 MediaRouteProviderWakeReason current_wake_reason_; | 435 MediaRouteProviderWakeReason current_wake_reason_; |
| 424 | 436 |
| 425 // A flag to ensure that we record the provider version once, during the | 437 // A flag to ensure that we record the provider version once, during the |
| 426 // initial event page wakeup attempt. | 438 // initial event page wakeup attempt. |
| 427 bool provider_version_was_recorded_ = false; | 439 bool provider_version_was_recorded_ = false; |
| 428 | 440 |
| 441 // Stores route controllers that can be used to send media commands to the | |
| 442 // extension. | |
| 443 std::unordered_map<MediaRoute::Id, MediaRouteController*> route_controllers_; | |
| 444 | |
| 429 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
| 430 // A pair of flags to ensure that mDNS discovery is only enabled on Windows | 446 // A pair of flags to ensure that mDNS discovery is only enabled on Windows |
| 431 // when there will be appropriate context for the user to associate a firewall | 447 // when there will be appropriate context for the user to associate a firewall |
| 432 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from | 448 // prompt with Media Router. |should_enable_mdns_discovery_| can only go from |
| 433 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in | 449 // |false| to |true|. On Windows, |is_mdns_enabled_| is set to |false| in |
| 434 // RegisterMediaRouteProvider and only set to |true| when we successfully call | 450 // RegisterMediaRouteProvider and only set to |true| when we successfully call |
| 435 // the extension to enable mDNS. | 451 // the extension to enable mDNS. |
| 436 bool is_mdns_enabled_ = false; | 452 bool is_mdns_enabled_ = false; |
| 437 bool should_enable_mdns_discovery_ = false; | 453 bool should_enable_mdns_discovery_ = false; |
| 438 #endif | 454 #endif |
| 439 | 455 |
| 440 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 456 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
| 441 | 457 |
| 442 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 458 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 443 }; | 459 }; |
| 444 | 460 |
| 445 } // namespace media_router | 461 } // namespace media_router |
| 446 | 462 |
| 447 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 463 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |