Index: chrome/browser/local_discovery/privet_device_lister_impl.cc |
diff --git a/chrome/browser/local_discovery/privet_device_lister_impl.cc b/chrome/browser/local_discovery/privet_device_lister_impl.cc |
index 1d4e4d706f4b856ae6f895bf00c02a26532c5b9a..cf153a41bfba1151785936979cb4ed5df93f9cce 100644 |
--- a/chrome/browser/local_discovery/privet_device_lister_impl.cc |
+++ b/chrome/browser/local_discovery/privet_device_lister_impl.cc |
@@ -37,12 +37,7 @@ PrivetDeviceListerImpl::~PrivetDeviceListerImpl() { |
} |
void PrivetDeviceListerImpl::Start() { |
- service_watcher_ = |
- service_discovery_client_->CreateServiceWatcher( |
- service_type_, |
- base::Bind(&PrivetDeviceListerImpl::OnServiceUpdated, |
- base::Unretained(this))); |
- service_watcher_->Start(); |
+ CreateServiceWatcher(); |
} |
void PrivetDeviceListerImpl::DiscoverNewDevices(bool force_update) { |
@@ -52,6 +47,14 @@ void PrivetDeviceListerImpl::DiscoverNewDevices(bool force_update) { |
void PrivetDeviceListerImpl::OnServiceUpdated( |
ServiceWatcher::UpdateType update, |
const std::string& service_name) { |
+ if (update == ServiceWatcher::UPDATE_INVALIDATED) { |
+ resolvers_.clear(); |
+ CreateServiceWatcher(); |
+ |
+ delegate_->DeviceCacheFlushed(); |
+ return; |
+ } |
+ |
if (update != ServiceWatcher::UPDATE_REMOVED) { |
bool added = (update == ServiceWatcher::UPDATE_ADDED); |
std::pair<ServiceResolverMap::iterator, bool> insert_result = |
@@ -143,4 +146,14 @@ PrivetDeviceListerImpl::ConnectionStateFromString(const std::string& str) { |
return DeviceDescription::UNKNOWN; |
} |
+void PrivetDeviceListerImpl::CreateServiceWatcher() { |
+ service_watcher_ = |
+ service_discovery_client_->CreateServiceWatcher( |
+ service_type_, |
+ base::Bind(&PrivetDeviceListerImpl::OnServiceUpdated, |
+ base::Unretained(this))); |
+ service_watcher_->Start(); |
+ |
+} |
+ |
} // namespace local_discovery |