OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/invalidations/invalidator_storage.h" | 5 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (!syncer::RealModelTypeToObjectId(model_type, &id)) { | 256 if (!syncer::RealModelTypeToObjectId(model_type, &id)) { |
257 DLOG(WARNING) << "Invalid model type: " << model_type; | 257 DLOG(WARNING) << "Invalid model type: " << model_type; |
258 continue; | 258 continue; |
259 } | 259 } |
260 (*map)[id].version = max_version; | 260 (*map)[id].version = max_version; |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 void InvalidatorStorage::SetInvalidatorClientId(const std::string& client_id) { | 264 void InvalidatorStorage::SetInvalidatorClientId(const std::string& client_id) { |
265 DCHECK(thread_checker_.CalledOnValidThread()); | 265 DCHECK(thread_checker_.CalledOnValidThread()); |
| 266 Clear(); // We can't reuse our old invalidation state if the ID changes. |
266 pref_service_->SetString(prefs::kInvalidatorClientId, client_id); | 267 pref_service_->SetString(prefs::kInvalidatorClientId, client_id); |
267 } | 268 } |
268 | 269 |
269 std::string InvalidatorStorage::GetInvalidatorClientId() const { | 270 std::string InvalidatorStorage::GetInvalidatorClientId() const { |
270 return pref_service_ ? | 271 return pref_service_ ? |
271 pref_service_->GetString(prefs::kInvalidatorClientId) : | 272 pref_service_->GetString(prefs::kInvalidatorClientId) : |
272 std::string(); | 273 std::string(); |
273 } | 274 } |
274 | 275 |
275 void InvalidatorStorage::SetBootstrapData(const std::string& data) { | 276 void InvalidatorStorage::SetBootstrapData(const std::string& data) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return; | 333 return; |
333 it->second.current = ack_handle; | 334 it->second.current = ack_handle; |
334 | 335 |
335 base::ListValue state_map_list; | 336 base::ListValue state_map_list; |
336 SerializeToList(state_map, &state_map_list); | 337 SerializeToList(state_map, &state_map_list); |
337 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, | 338 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, |
338 state_map_list); | 339 state_map_list); |
339 } | 340 } |
340 | 341 |
341 } // namespace browser_sync | 342 } // namespace browser_sync |
OLD | NEW |