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_device_lister.h" | 5 #include "chrome/browser/local_discovery/service_discovery_device_lister.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 delegate_->OnDeviceCacheFlushed(); | 58 delegate_->OnDeviceCacheFlushed(); |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 if (update == ServiceWatcher::UPDATE_REMOVED) { | 62 if (update == ServiceWatcher::UPDATE_REMOVED) { |
63 delegate_->OnDeviceRemoved(service_name); | 63 delegate_->OnDeviceRemoved(service_name); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 // If there is already a resolver working on this service, don't add one. | 67 // If there is already a resolver working on this service, don't add one. |
68 if (ContainsKey(resolvers_, service_name)) { | 68 if (base::ContainsKey(resolvers_, service_name)) { |
69 VLOG(1) << "Resolver already exists, service_name: " << service_name; | 69 VLOG(1) << "Resolver already exists, service_name: " << service_name; |
70 return; | 70 return; |
71 } | 71 } |
72 | 72 |
73 VLOG(1) << "Adding resolver for service_name: " << service_name; | 73 VLOG(1) << "Adding resolver for service_name: " << service_name; |
74 bool added = (update == ServiceWatcher::UPDATE_ADDED); | 74 bool added = (update == ServiceWatcher::UPDATE_ADDED); |
75 std::unique_ptr<ServiceResolver> resolver = | 75 std::unique_ptr<ServiceResolver> resolver = |
76 service_discovery_client_->CreateServiceResolver( | 76 service_discovery_client_->CreateServiceResolver( |
77 service_name, | 77 service_name, |
78 base::Bind(&ServiceDiscoveryDeviceLister::OnResolveComplete, | 78 base::Bind(&ServiceDiscoveryDeviceLister::OnResolveComplete, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void ServiceDiscoveryDeviceLister::CreateServiceWatcher() { | 113 void ServiceDiscoveryDeviceLister::CreateServiceWatcher() { |
114 service_watcher_ = | 114 service_watcher_ = |
115 service_discovery_client_->CreateServiceWatcher( | 115 service_discovery_client_->CreateServiceWatcher( |
116 service_type_, | 116 service_type_, |
117 base::Bind(&ServiceDiscoveryDeviceLister::OnServiceUpdated, | 117 base::Bind(&ServiceDiscoveryDeviceLister::OnServiceUpdated, |
118 weak_factory_.GetWeakPtr())); | 118 weak_factory_.GetWeakPtr())); |
119 service_watcher_->Start(); | 119 service_watcher_->Start(); |
120 } | 120 } |
121 | 121 |
122 } // namespace local_discovery | 122 } // namespace local_discovery |
OLD | NEW |