Index: chrome/browser/media/router/media_route_provider_util_win.cc |
diff --git a/chrome/browser/media/router/media_route_provider_util_win.cc b/chrome/browser/media/router/media_route_provider_util_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4a08a69a86c1f43e06293f5376662a4827f9745c |
--- /dev/null |
+++ b/chrome/browser/media/router/media_route_provider_util_win.cc |
@@ -0,0 +1,40 @@ |
+// 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_win.h" |
+ |
+#include "base/files/file_path.h" |
+#include "base/location.h" |
+#include "base/path_service.h" |
+#include "chrome/installer/util/browser_distribution.h" |
+#include "chrome/installer/util/firewall_manager_win.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+namespace media_router { |
+ |
+namespace { |
+ |
+void DoCanFirewallUseLocalPorts(base::Callback<void(bool)> callback) { |
imcheng
2016/03/25 06:26:30
const ref input
btolsch
2016/03/25 18:57:04
Done.
|
+ base::FilePath exe_path; |
+ bool can_use_local_ports = false; |
+ if (base::PathService::Get(base::FILE_EXE, &exe_path)) { |
+ auto firewall_manager = installer::FirewallManager::Create( |
+ BrowserDistribution::GetDistribution(), exe_path); |
+ can_use_local_ports = |
+ firewall_manager && firewall_manager->CanUseLocalPorts(); |
+ } |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::UI, FROM_HERE, |
+ base::Bind(std::move(callback), can_use_local_ports)); |
imcheng
2016/03/25 06:26:30
is the std::move necessary?
btolsch
2016/03/25 18:57:04
A base::Callback is basically a pointer and a shar
|
+} |
+ |
+} // namespace |
+ |
+void CanFirewallUseLocalPorts(base::Callback<void(bool)> callback) { |
imcheng
2016/03/25 06:26:30
const ref input
btolsch
2016/03/25 18:57:04
Done.
|
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::FILE, FROM_HERE, |
+ base::Bind(&DoCanFirewallUseLocalPorts, std::move(callback))); |
imcheng
2016/03/25 06:26:30
is std::move necessary?
btolsch
2016/03/25 18:57:04
See other comment.
|
+} |
+ |
+} // namespace media_router |