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

Unified Diff: chrome/browser/local_discovery/service_discovery_shared_client.cc

Issue 260283002: Use mDns in browser process, without sandboxed utility process/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tue 04/29/2014 10:18:35.18 Created 6 years, 8 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/service_discovery_shared_client.cc
diff --git a/chrome/browser/local_discovery/service_discovery_shared_client.cc b/chrome/browser/local_discovery/service_discovery_shared_client.cc
index a18481216c5f4c719c78edf680dc4beffcc52627..2ffbc09e335599ab6eb25bb27869db0b3d5aaf22 100644
--- a/chrome/browser/local_discovery/service_discovery_shared_client.cc
+++ b/chrome/browser/local_discovery/service_discovery_shared_client.cc
@@ -6,14 +6,44 @@
#include "content/public/browser/browser_thread.h"
+#if defined(OS_WIN)
+#include "base/files/file_path.h"
+#include "base/metrics/histogram.h"
+#include "base/path_service.h"
+#include "chrome/browser/local_discovery/service_discovery_client_utility.h"
+#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/firewall_manager_win.h"
+#endif // OS_WIN
+
#if defined(OS_MACOSX)
#include "chrome/browser/local_discovery/service_discovery_client_mac_factory.h"
#endif
#if defined(ENABLE_MDNS)
-#include "chrome/browser/local_discovery/service_discovery_client_utility.h"
+#include "chrome/browser/local_discovery/service_discovery_client_mdns.h"
#endif // ENABLE_MDNS
+namespace {
+
+#if defined(OS_WIN)
+bool IsFirewallReady() {
+ base::FilePath exe_path;
+ if (PathService::Get(base::FILE_EXE, &exe_path))
+ return false;
+ scoped_ptr<installer::FirewallManager> manager =
+ installer::FirewallManager::Create(BrowserDistribution::GetDistribution(),
+ exe_path);
+ if (!manager)
+ return false;
+ bool is_ready = manager->CanUseLocalPorts();
+ UMA_HISTOGRAM_BOOLEAN("LocalDiscovery.IsFirewallReady", is_ready);
+ return is_ready;
+}
+#endif // OS_WIN
+
+} // namespace
+
+
namespace local_discovery {
using content::BrowserThread;
@@ -44,7 +74,16 @@ scoped_refptr<ServiceDiscoverySharedClient>
#if defined(OS_MACOSX)
return ServiceDiscoveryClientMacFactory::CreateInstance();
#else
- return new ServiceDiscoveryClientUtility();
+
+#if defined(OS_WIN)
+ static bool is_firewall_ready = IsFirewallReady();
+ if (!is_firewall_ready) {
+ // TODO(vitalybuka): Remove after we find what to do with firewall for
+ // user-level installs. crbug.com/366408
+ return new ServiceDiscoveryClientUtility();
+ }
+#endif // OS_WIN
+ return new ServiceDiscoveryClientMdns();
#endif
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698