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_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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 void DetachRoute(const MediaRoute::Id& route_id) override; | 91 void DetachRoute(const MediaRoute::Id& route_id) override; |
| 92 void SendRouteMessage(const MediaRoute::Id& route_id, | 92 void SendRouteMessage(const MediaRoute::Id& route_id, |
| 93 const std::string& message, | 93 const std::string& message, |
| 94 const SendRouteMessageCallback& callback) override; | 94 const SendRouteMessageCallback& callback) override; |
| 95 void SendRouteBinaryMessage( | 95 void SendRouteBinaryMessage( |
| 96 const MediaRoute::Id& route_id, | 96 const MediaRoute::Id& route_id, |
| 97 scoped_ptr<std::vector<uint8_t>> data, | 97 scoped_ptr<std::vector<uint8_t>> data, |
| 98 const SendRouteMessageCallback& callback) override; | 98 const SendRouteMessageCallback& callback) override; |
| 99 void AddIssue(const Issue& issue) override; | 99 void AddIssue(const Issue& issue) override; |
| 100 void ClearIssue(const Issue::Id& issue_id) override; | 100 void ClearIssue(const Issue::Id& issue_id) override; |
| 101 bool should_enable_mdns_discovery() const override; | |
| 102 void EnsureMdnsDiscoveryEnabled() override; | |
| 101 | 103 |
| 102 const std::string& media_route_provider_extension_id() const { | 104 const std::string& media_route_provider_extension_id() const { |
| 103 return media_route_provider_extension_id_; | 105 return media_route_provider_extension_id_; |
| 104 } | 106 } |
| 105 | 107 |
| 106 void set_instance_id_for_test(const std::string& instance_id) { | 108 void set_instance_id_for_test(const std::string& instance_id) { |
| 107 instance_id_ = instance_id; | 109 instance_id_ = instance_id; |
| 108 } | 110 } |
| 109 | 111 |
| 110 private: | 112 private: |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 void AttemptWakeEventPage(); | 315 void AttemptWakeEventPage(); |
| 314 | 316 |
| 315 // Sets the reason why we are attempting to wake the extension. Since | 317 // Sets the reason why we are attempting to wake the extension. Since |
| 316 // multiple tasks may be enqueued for execution each time the extension runs, | 318 // multiple tasks may be enqueued for execution each time the extension runs, |
| 317 // we record the first such reason. | 319 // we record the first such reason. |
| 318 void SetWakeReason(MediaRouteProviderWakeReason reason); | 320 void SetWakeReason(MediaRouteProviderWakeReason reason); |
| 319 | 321 |
| 320 // Clears the wake reason after the extension has been awoken. | 322 // Clears the wake reason after the extension has been awoken. |
| 321 void ClearWakeReason(); | 323 void ClearWakeReason(); |
| 322 | 324 |
| 325 void EnableMdnsFromFirewallCheck(bool firewall_can_use_local_ports); | |
| 326 | |
| 323 // Pending requests queued to be executed once component extension | 327 // Pending requests queued to be executed once component extension |
| 324 // becomes ready. | 328 // becomes ready. |
| 325 std::deque<base::Closure> pending_requests_; | 329 std::deque<base::Closure> pending_requests_; |
| 326 | 330 |
| 327 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaSinksQuery>> | 331 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaSinksQuery>> |
| 328 sinks_queries_; | 332 sinks_queries_; |
| 329 | 333 |
| 330 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaRoutesQuery>> | 334 base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaRoutesQuery>> |
| 331 routes_queries_; | 335 routes_queries_; |
| 332 | 336 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 int wakeup_attempt_count_ = 0; | 378 int wakeup_attempt_count_ = 0; |
| 375 | 379 |
| 376 // Records the current reason the extension is being woken up. Is set to | 380 // Records the current reason the extension is being woken up. Is set to |
| 377 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. | 381 // MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason. |
| 378 MediaRouteProviderWakeReason current_wake_reason_; | 382 MediaRouteProviderWakeReason current_wake_reason_; |
| 379 | 383 |
| 380 // A flag to ensure that we record the provider version once, during the | 384 // A flag to ensure that we record the provider version once, during the |
| 381 // initial event page wakeup attempt. | 385 // initial event page wakeup attempt. |
| 382 bool provider_version_was_recorded_ = false; | 386 bool provider_version_was_recorded_ = false; |
| 383 | 387 |
| 388 // A flag to ensure that mDNS discovery is only enabled on Windows when there | |
| 389 // will be appropriate context for the user to associate a firewall prompt | |
| 390 // with Media Router. This can be set to |true| earlier if we know that a | |
| 391 // prompt will not occur. | |
| 392 bool should_enable_mdns_discovery_ = true; | |
|
imcheng
2016/03/25 06:26:30
I would prefer that we define this value to be fal
btolsch
2016/03/25 18:57:04
Done.
| |
| 393 | |
| 384 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 394 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
| 385 | 395 |
| 386 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 396 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 387 }; | 397 }; |
| 388 | 398 |
| 389 } // namespace media_router | 399 } // namespace media_router |
| 390 | 400 |
| 391 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 401 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |