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

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

Issue 1821823002: [Media Router] Conditionally enable mDNS on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compile and build dependency issues 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.cc
diff --git a/chrome/browser/media/router/media_router_mojo_impl.cc b/chrome/browser/media/router/media_router_mojo_impl.cc
index 54c50ee20c89b837ddffe385d4c6fe37d90b0fdd..0ce838d45fb3ac42e39550d8e59be850cba67a47 100644
--- a/chrome/browser/media/router/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/media_router_mojo_impl.cc
@@ -14,7 +14,9 @@
#include "base/observer_list.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
+#include "build/build_config.h"
#include "chrome/browser/media/router/issues_observer.h"
+#include "chrome/browser/media/router/media_route_provider_util.h"
#include "chrome/browser/media/router/media_router_factory.h"
#include "chrome/browser/media/router/media_router_metrics.h"
#include "chrome/browser/media/router/media_router_type_converters.h"
@@ -81,6 +83,10 @@ MediaRouterMojoImpl::MediaRouterMojoImpl(
current_wake_reason_(MediaRouteProviderWakeReason::TOTAL_COUNT),
weak_factory_(this) {
DCHECK(event_page_tracker_);
+#if defined(OS_WIN)
+ should_enable_mdns_discovery_ = false;
+ CanFirewallUseLocalPorts(this);
+#endif
}
MediaRouterMojoImpl::~MediaRouterMojoImpl() {
@@ -157,6 +163,11 @@ void MediaRouterMojoImpl::RegisterMediaRouteProvider(
callback.Run(instance_id_);
ExecutePendingRequests();
wakeup_attempt_count_ = 0;
+#if defined(OS_WIN)
+ if (should_enable_mdns_discovery_) {
+ media_route_provider_->EnableMdnsDiscovery();
+ }
+#endif
}
void MediaRouterMojoImpl::OnIssue(const interfaces::IssuePtr issue) {
@@ -402,6 +413,17 @@ void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) {
issue_manager_.ClearIssue(issue_id);
}
+bool MediaRouterMojoImpl::should_enable_mdns_discovery() const {
+ return should_enable_mdns_discovery_;
mark a. foltz 2016/03/24 22:59:33 This can be inlined into the .h
btolsch 2016/03/25 04:40:50 This is a virtual and can't be defined inline.
+}
+
+void MediaRouterMojoImpl::EnableMdnsDiscovery() {
+ if (media_route_provider_) {
+ media_route_provider_->EnableMdnsDiscovery();
+ }
+ should_enable_mdns_discovery_ = true;
+}
+
bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
MediaSinksObserver* observer) {
DCHECK(thread_checker_.CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698