Chromium Code Reviews| 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(const base::Callback<void(bool)>& callback) { | |
| 19 base::FilePath exe_path; | |
|
mark a. foltz
2016/03/29 00:48:20
Add a DCHECK_CURRENTLY_ON(content::BrowserThread::
| |
| 20 bool can_use_local_ports = false; | |
| 21 if (base::PathService::Get(base::FILE_EXE, &exe_path)) { | |
|
mark a. foltz
2016/03/29 00:48:20
If the firewall check fails to run at all, it migh
| |
| 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(callback, can_use_local_ports)); | |
| 30 } | |
| 31 | |
| 32 } // namespace | |
| 33 | |
| 34 void CanFirewallUseLocalPorts(const base::Callback<void(bool)>& callback) { | |
| 35 content::BrowserThread::PostTask( | |
| 36 content::BrowserThread::FILE, FROM_HERE, | |
| 37 base::Bind(&DoCanFirewallUseLocalPorts, callback)); | |
| 38 } | |
| 39 | |
| 40 } // namespace media_router | |
| OLD | NEW |