| 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/invalidation/invalidator_storage.h" | 5 #include "chrome/browser/invalidation/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) | 76 InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) |
| 77 : pref_service_(pref_service) { | 77 : pref_service_(pref_service) { |
| 78 DCHECK(pref_service); | 78 DCHECK(pref_service); |
| 79 pref_service_->ClearPref(kInvalidatorMaxInvalidationVersions); | 79 pref_service_->ClearPref(kInvalidatorMaxInvalidationVersions); |
| 80 } | 80 } |
| 81 | 81 |
| 82 InvalidatorStorage::~InvalidatorStorage() { | 82 InvalidatorStorage::~InvalidatorStorage() { |
| 83 } | 83 } |
| 84 | 84 |
| 85 void InvalidatorStorage::SetInvalidatorClientId(const std::string& client_id) { | 85 void InvalidatorStorage::ClearAndSetNewClientId(const std::string& client_id) { |
| 86 DCHECK(thread_checker_.CalledOnValidThread()); | 86 DCHECK(thread_checker_.CalledOnValidThread()); |
| 87 Clear(); // We can't reuse our old invalidation state if the ID changes. | 87 Clear(); // We can't reuse our old invalidation state if the ID changes. |
| 88 pref_service_->SetString(prefs::kInvalidatorClientId, client_id); | 88 pref_service_->SetString(prefs::kInvalidatorClientId, client_id); |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string InvalidatorStorage::GetInvalidatorClientId() const { | 91 std::string InvalidatorStorage::GetInvalidatorClientId() const { |
| 92 return pref_service_->GetString(prefs::kInvalidatorClientId); | 92 return pref_service_->GetString(prefs::kInvalidatorClientId); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void InvalidatorStorage::SetBootstrapData(const std::string& data) { | 95 void InvalidatorStorage::SetBootstrapData(const std::string& data) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 void InvalidatorStorage::Clear() { | 129 void InvalidatorStorage::Clear() { |
| 130 DCHECK(thread_checker_.CalledOnValidThread()); | 130 DCHECK(thread_checker_.CalledOnValidThread()); |
| 131 pref_service_->ClearPref(prefs::kInvalidatorSavedInvalidations); | 131 pref_service_->ClearPref(prefs::kInvalidatorSavedInvalidations); |
| 132 pref_service_->ClearPref(prefs::kInvalidatorClientId); | 132 pref_service_->ClearPref(prefs::kInvalidatorClientId); |
| 133 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); | 133 pref_service_->ClearPref(prefs::kInvalidatorInvalidationState); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace invalidation | 136 } // namespace invalidation |
| OLD | NEW |