Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9110)

Unified Diff: chrome/browser/media/router/media_router_mojo_impl.h

Issue 1846673002: [Media Router] Conditionally enable mDNS on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Patch-up newly-added test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0cc2eafb186a527d76bc271afdaeaef5203c3513..cf44b91a721e432aee94d7ec62c444c0371db0a7 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"
@@ -96,6 +97,7 @@ class MediaRouterMojoImpl : public MediaRouterBase,
const SendRouteMessageCallback& callback) override;
void AddIssue(const Issue& issue) override;
void ClearIssue(const Issue::Id& issue_id) override;
+ void OnUserGesture() override;
const std::string& media_route_provider_extension_id() const {
return media_route_provider_extension_id_;
@@ -316,6 +318,19 @@ class MediaRouterMojoImpl : public MediaRouterBase,
// Clears the wake reason after the extension has been awoken.
void ClearWakeReason();
+#if defined(OS_WIN)
+ // Ensures that mDNS discovery is enabled in the MRPM extension. This can be
+ // called many times but the MRPM will only be called once per registration
+ // period.
+ void EnsureMdnsDiscoveryEnabled();
+ void DoEnsureMdnsDiscoveryEnabled();
+
+ // 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 OnFirewallCheckComplete(bool firewall_can_use_local_ports);
+#endif
+
// Pending requests queued to be executed once component extension
// becomes ready.
std::deque<base::Closure> pending_requests_;
@@ -373,6 +388,17 @@ class MediaRouterMojoImpl : public MediaRouterBase,
// MediaRouteProviderWakeReason::TOTAL_COUNT if there is no pending reason.
MediaRouteProviderWakeReason current_wake_reason_;
+#if defined(OS_WIN)
+ // 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|. On Windows, |is_mdns_enabled_| is set to |false| in
+ // RegisterMediaRouteProvider and only set to |true| when we successfully call
+ // the extension to enable mDNS.
+ bool is_mdns_enabled_ = false;
+ bool should_enable_mdns_discovery_ = false;
+#endif
+
base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl);
« no previous file with comments | « chrome/browser/media/router/media_router_metrics.h ('k') | chrome/browser/media/router/media_router_mojo_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698