Index: chrome/browser/media/router/media_route_provider_util.cc |
diff --git a/chrome/browser/media/router/media_route_provider_util.cc b/chrome/browser/media/router/media_route_provider_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..974f7325e75b52e5bc1775f70945c40ed1b6b839 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_route_provider_util.cc |
@@ -0,0 +1,43 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/media/router/media_route_provider_util.h" |
+ |
+#include "base/files/file_path.h" |
+#include "base/location.h" |
+#include "base/path_service.h" |
+#include "build/build_config.h" |
+#include "chrome/installer/util/browser_distribution.h" |
mark a. foltz
2016/03/24 22:59:32
Do you need to declare any additional deps= in the
btolsch
2016/03/25 04:40:50
I didn't think so because nothing has been failing
|
+#include "chrome/installer/util/firewall_manager_win.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+namespace media_router { |
+ |
+#if defined(OS_WIN) |
+namespace { |
+ |
+void DoCanFirewallUseLocalPorts(MediaRouterMojoImpl* router) { |
+ base::FilePath exe_path; |
+ if (base::PathService::Get(base::FILE_EXE, &exe_path)) { |
+ auto firewall_manager = installer::FirewallManager::Create( |
+ BrowserDistribution::GetDistribution(), exe_path); |
+ if (firewall_manager && firewall_manager->CanUseLocalPorts()) { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, |
+ base::Bind(&MediaRouterMojoImpl::EnableMdnsDiscovery, |
+ base::Unretained(router))); |
+ } |
+ } |
+} |
+ |
+} // namespace |
+ |
+void CanFirewallUseLocalPorts(MediaRouterMojoImpl* router) { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&DoCanFirewallUseLocalPorts, router)); |
+} |
+#endif |
+ |
+} // namespace media_router |