| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 void InvalidatorStorage::SetBootstrapData(const std::string& data) { | 276 void InvalidatorStorage::SetBootstrapData(const std::string& data) { |
| 277 DCHECK(thread_checker_.CalledOnValidThread()); | 277 DCHECK(thread_checker_.CalledOnValidThread()); |
| 278 std::string base64_data; | 278 std::string base64_data; |
| 279 base::Base64Encode(data, &base64_data); | 279 base::Base64Encode(data, &base64_data); |
| 280 pref_service_->SetString(prefs::kInvalidatorInvalidationState, | 280 pref_service_->SetString(prefs::kInvalidatorInvalidationState, |
| 281 base64_data); | 281 base64_data); |
| 282 } | 282 } |
| 283 | 283 |
| 284 std::string InvalidatorStorage::GetBootstrapData() const { | 284 std::string InvalidatorStorage::GetBootstrapData() const { |
| 285 std::string base64_data(pref_service_ ? | 285 std::string base64_data( |
| 286 pref_service_->GetString(prefs::kInvalidatorInvalidationState) : ""); | 286 pref_service_ |
| 287 ? pref_service_->GetString(prefs::kInvalidatorInvalidationState) |
| 288 : std::string()); |
| 287 std::string data; | 289 std::string data; |
| 288 base::Base64Decode(base64_data, &data); | 290 base::Base64Decode(base64_data, &data); |
| 289 return data; | 291 return data; |
| 290 } | 292 } |
| 291 | 293 |
| 292 void InvalidatorStorage::Clear() { | 294 void InvalidatorStorage::Clear() { |
| 293 DCHECK(thread_checker_.CalledOnValidThread()); | 295 DCHECK(thread_checker_.CalledOnValidThread()); |
| 294 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions); | 296 pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions); |
| 295 pref_service_->ClearPref(prefs::kInvalidatorClientId); | 297 pref_service_->ClearPref(prefs::kInvalidatorClientId); |
| 296 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); | 298 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return; | 335 return; |
| 334 it->second.current = ack_handle; | 336 it->second.current = ack_handle; |
| 335 | 337 |
| 336 base::ListValue state_map_list; | 338 base::ListValue state_map_list; |
| 337 SerializeToList(state_map, &state_map_list); | 339 SerializeToList(state_map, &state_map_list); |
| 338 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, | 340 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, |
| 339 state_map_list); | 341 state_map_list); |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace browser_sync | 344 } // namespace browser_sync |
| OLD | NEW |