| 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/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" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 bool is_cleared = service_data_map_[service_type]->ClearServices(); | 224 bool is_cleared = service_data_map_[service_type]->ClearServices(); |
| 225 VLOG(1) << "ServicesFlushed: is_cleared: " << is_cleared; | 225 VLOG(1) << "ServicesFlushed: is_cleared: " << is_cleared; |
| 226 | 226 |
| 227 if (is_cleared) | 227 if (is_cleared) |
| 228 DispatchApiEvent(service_type); | 228 DispatchApiEvent(service_type); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void DnsSdRegistry::DispatchApiEvent(const std::string& service_type) { | 231 void DnsSdRegistry::DispatchApiEvent(const std::string& service_type) { |
| 232 VLOG(1) << "DispatchApiEvent: service_type: " << service_type; | 232 VLOG(1) << "DispatchApiEvent: service_type: " << service_type; |
| 233 FOR_EACH_OBSERVER(DnsSdObserver, observers_, OnDnsSdEvent( | 233 for (auto& observer : observers_) { |
| 234 service_type, service_data_map_[service_type]->GetServiceList())); | 234 observer.OnDnsSdEvent(service_type, |
| 235 service_data_map_[service_type]->GetServiceList()); |
| 236 } |
| 235 } | 237 } |
| 236 | 238 |
| 237 bool DnsSdRegistry::IsRegistered(const std::string& service_type) { | 239 bool DnsSdRegistry::IsRegistered(const std::string& service_type) { |
| 238 return service_data_map_.find(service_type) != service_data_map_.end(); | 240 return service_data_map_.find(service_type) != service_data_map_.end(); |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |