Index: chrome/browser/media/router/media_router_mojo_impl.h |
diff --git a/chrome/browser/media/router/media_router_mojo_impl.h b/chrome/browser/media/router/media_router_mojo_impl.h |
index 35ca51e2c872408614870b106f10dcdf9677ca10..4c2c9d4fc17655fc98dfda10254fd81ba92d53e4 100644 |
--- a/chrome/browser/media/router/media_router_mojo_impl.h |
+++ b/chrome/browser/media/router/media_router_mojo_impl.h |
@@ -21,6 +21,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
#include "base/thread_task_runner_handle.h" |
+#include "build/build_config.h" |
#include "chrome/browser/media/router/issue.h" |
#include "chrome/browser/media/router/issue_manager.h" |
#include "chrome/browser/media/router/media_router.mojom.h" |
@@ -98,6 +99,7 @@ class MediaRouterMojoImpl : public MediaRouterBase, |
const SendRouteMessageCallback& callback) override; |
void AddIssue(const Issue& issue) override; |
void ClearIssue(const Issue::Id& issue_id) override; |
+ void OnUserInteraction() override; |
const std::string& media_route_provider_extension_id() const { |
return media_route_provider_extension_id_; |
@@ -251,6 +253,7 @@ class MediaRouterMojoImpl : public MediaRouterBase, |
void DoStopObservingMediaSinks(const MediaSource::Id& source_id); |
void DoStartObservingMediaRoutes(const MediaSource::Id& source_id); |
void DoStopObservingMediaRoutes(const MediaSource::Id& source_id); |
+ void DoEnsureMdnsDiscoveryEnabled(); |
// Invoked when the next batch of messages arrives. |
// |route_id|: ID of route of the messages. |
@@ -320,6 +323,16 @@ class MediaRouterMojoImpl : public MediaRouterBase, |
// Clears the wake reason after the extension has been awoken. |
void ClearWakeReason(); |
+ // Ensures that mDNS discovery is enabled in the MRPM extension. This can be |
mark a. foltz
2016/03/29 00:48:20
Surround the mDNS functions with #if defined(OS_WI
|
+ // called many times but the MRPM will only be called once per registration |
+ // period. |
+ void EnsureMdnsDiscoveryEnabled(); |
+ |
+ // Callback used to enabled mDNS in the MRPM if a firewall prompt will not be |
+ // triggered. If a firewall prompt would be triggered, enabling mDNS won't |
+ // happen until the user is clearly interacting with MR. |
+ void EnableMdnsFromFirewallCheck(bool firewall_can_use_local_ports); |
mark a. foltz
2016/03/29 00:48:20
Perhaps name it OnFirewallCheckComplete?
|
+ |
// Pending requests queued to be executed once component extension |
// becomes ready. |
std::deque<base::Closure> pending_requests_; |
@@ -381,6 +394,20 @@ class MediaRouterMojoImpl : public MediaRouterBase, |
// initial event page wakeup attempt. |
bool provider_version_was_recorded_ = false; |
+ // A pair of flags to ensure that mDNS discovery is only enabled on Windows |
+ // when there will be appropriate context for the user to associate a firewall |
+ // prompt with Media Router. |should_enable_mdns_discovery_| can only go from |
+ // |false| to |true|. |is_mdns_enabled_| is set to |false| in |
mark a. foltz
2016/03/29 00:48:20
Maybe qualify the last sentence with "On Windows,
|
+ // RegisterMediaRouteProvider and only set to |true| when we successfully call |
+ // the extension to enable mDNS. |
+#if defined(OS_WIN) |
+ bool is_mdns_enabled_ = false; |
+ bool should_enable_mdns_discovery_ = false; |
+#else |
+ bool is_mdns_enabled_ = true; |
mark a. foltz
2016/03/29 00:48:20
Do these need to be defined at all if !OS_WIN?
|
+ bool should_enable_mdns_discovery_ = true; |
+#endif |
+ |
base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |