OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 5 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "net/net_features.h" |
8 | 9 |
9 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/timer/elapsed_timer.h" | 14 #include "base/timer/elapsed_timer.h" |
14 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
15 #include "chrome/installer/util/firewall_manager_win.h" | 16 #include "chrome/installer/util/firewall_manager_win.h" |
16 #endif // OS_WIN | 17 #endif // OS_WIN |
17 | 18 |
18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
19 #include "chrome/browser/local_discovery/service_discovery_client_mac_factory.h" | 20 #include "chrome/browser/local_discovery/service_discovery_client_mac_factory.h" |
20 #endif | 21 #endif |
21 | 22 |
22 #if defined(ENABLE_MDNS) | 23 #if BUILDFLAG(ENABLE_MDNS) |
23 #include "chrome/browser/local_discovery/service_discovery_client_mdns.h" | 24 #include "chrome/browser/local_discovery/service_discovery_client_mdns.h" |
24 #endif // ENABLE_MDNS | 25 #endif // ENABLE_MDNS |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
29 | 30 |
30 bool g_is_firewall_ready = false; | 31 bool g_is_firewall_ready = false; |
31 bool g_is_firewall_state_reported = false; | 32 bool g_is_firewall_state_reported = false; |
32 | 33 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 DCHECK(!g_service_discovery_client); | 66 DCHECK(!g_service_discovery_client); |
66 g_service_discovery_client = this; | 67 g_service_discovery_client = this; |
67 } | 68 } |
68 | 69 |
69 ServiceDiscoverySharedClient::~ServiceDiscoverySharedClient() { | 70 ServiceDiscoverySharedClient::~ServiceDiscoverySharedClient() { |
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 71 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
71 DCHECK_EQ(g_service_discovery_client, this); | 72 DCHECK_EQ(g_service_discovery_client, this); |
72 g_service_discovery_client = NULL; | 73 g_service_discovery_client = NULL; |
73 } | 74 } |
74 | 75 |
75 #if defined(ENABLE_MDNS) || defined(OS_MACOSX) | 76 #if BUILDFLAG(ENABLE_MDNS) || defined(OS_MACOSX) |
76 | 77 |
77 scoped_refptr<ServiceDiscoverySharedClient> | 78 scoped_refptr<ServiceDiscoverySharedClient> |
78 ServiceDiscoverySharedClient::GetInstance() { | 79 ServiceDiscoverySharedClient::GetInstance() { |
79 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 80 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
80 | 81 |
81 if (g_service_discovery_client) | 82 if (g_service_discovery_client) |
82 return g_service_discovery_client; | 83 return g_service_discovery_client; |
83 | 84 |
84 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
85 if (!g_is_firewall_state_reported) { | 86 if (!g_is_firewall_state_reported) { |
(...skipping 15 matching lines...) Expand all Loading... |
101 scoped_refptr<ServiceDiscoverySharedClient> | 102 scoped_refptr<ServiceDiscoverySharedClient> |
102 ServiceDiscoverySharedClient::GetInstance() { | 103 ServiceDiscoverySharedClient::GetInstance() { |
103 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 104 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
104 NOTIMPLEMENTED(); | 105 NOTIMPLEMENTED(); |
105 return NULL; | 106 return NULL; |
106 } | 107 } |
107 | 108 |
108 #endif // ENABLE_MDNS | 109 #endif // ENABLE_MDNS |
109 | 110 |
110 } // namespace local_discovery | 111 } // namespace local_discovery |
OLD | NEW |