OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/media/router/media_route_provider_util_win.h" | |
6 | |
7 #include "base/files/file_path.h" | |
8 #include "base/location.h" | |
9 #include "base/path_service.h" | |
10 #include "chrome/installer/util/browser_distribution.h" | |
11 #include "chrome/installer/util/firewall_manager_win.h" | |
12 #include "content/public/browser/browser_thread.h" | |
13 | |
14 namespace media_router { | |
15 | |
16 namespace { | |
17 | |
18 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.
| |
19 base::FilePath exe_path; | |
20 bool can_use_local_ports = false; | |
21 if (base::PathService::Get(base::FILE_EXE, &exe_path)) { | |
22 auto firewall_manager = installer::FirewallManager::Create( | |
23 BrowserDistribution::GetDistribution(), exe_path); | |
24 can_use_local_ports = | |
25 firewall_manager && firewall_manager->CanUseLocalPorts(); | |
26 } | |
27 content::BrowserThread::PostTask( | |
28 content::BrowserThread::UI, FROM_HERE, | |
29 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
| |
30 } | |
31 | |
32 } // namespace | |
33 | |
34 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.
| |
35 content::BrowserThread::PostTask( | |
36 content::BrowserThread::FILE, FROM_HERE, | |
37 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.
| |
38 } | |
39 | |
40 } // namespace media_router | |
OLD | NEW |