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

Side by Side Diff: chrome/browser/extensions/api/mdns/dns_sd_registry.cc

Issue 2407483002: Make enable_service_discovery a chrome/ feature. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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/extensions/api/mdns/dns_sd_registry.h" 5 #include "chrome/browser/extensions/api/mdns/dns_sd_registry.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/api/mdns/dns_sd_device_lister.h" 10 #include "chrome/browser/extensions/api/mdns/dns_sd_device_lister.h"
11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" 11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
12 #include "chrome/common/features.h"
12 13
13 using local_discovery::ServiceDiscoveryClient; 14 using local_discovery::ServiceDiscoveryClient;
14 using local_discovery::ServiceDiscoverySharedClient; 15 using local_discovery::ServiceDiscoverySharedClient;
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 namespace { 19 namespace {
19 // Predicate to test if two discovered services have the same service_name. 20 // Predicate to test if two discovered services have the same service_name.
20 class IsSameServiceName { 21 class IsSameServiceName {
21 public: 22 public:
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 service_list_.clear(); 101 service_list_.clear();
101 return true; 102 return true;
102 } 103 }
103 104
104 const DnsSdRegistry::DnsSdServiceList& 105 const DnsSdRegistry::DnsSdServiceList&
105 DnsSdRegistry::ServiceTypeData::GetServiceList() { 106 DnsSdRegistry::ServiceTypeData::GetServiceList() {
106 return service_list_; 107 return service_list_;
107 } 108 }
108 109
109 DnsSdRegistry::DnsSdRegistry() { 110 DnsSdRegistry::DnsSdRegistry() {
110 #if defined(ENABLE_SERVICE_DISCOVERY) 111 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
111 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance(); 112 service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance();
112 #endif 113 #endif
113 } 114 }
114 115
115 DnsSdRegistry::DnsSdRegistry(ServiceDiscoverySharedClient* client) { 116 DnsSdRegistry::DnsSdRegistry(ServiceDiscoverySharedClient* client) {
116 service_discovery_client_ = client; 117 service_discovery_client_ = client;
117 } 118 }
118 119
119 DnsSdRegistry::~DnsSdRegistry() {} 120 DnsSdRegistry::~DnsSdRegistry() {}
120 121
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 VLOG(1) << "DispatchApiEvent: service_type: " << service_type; 232 VLOG(1) << "DispatchApiEvent: service_type: " << service_type;
232 FOR_EACH_OBSERVER(DnsSdObserver, observers_, OnDnsSdEvent( 233 FOR_EACH_OBSERVER(DnsSdObserver, observers_, OnDnsSdEvent(
233 service_type, service_data_map_[service_type]->GetServiceList())); 234 service_type, service_data_map_[service_type]->GetServiceList()));
234 } 235 }
235 236
236 bool DnsSdRegistry::IsRegistered(const std::string& service_type) { 237 bool DnsSdRegistry::IsRegistered(const std::string& service_type) {
237 return service_data_map_.find(service_type) != service_data_map_.end(); 238 return service_data_map_.find(service_type) != service_data_map_.end();
238 } 239 }
239 240
240 } // namespace extensions 241 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698