| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (state.current.IsValid()) | 88 if (state.current.IsValid()) |
| 89 value->Set(kCurrentAckHandleKey, state.current.ToValue().release()); | 89 value->Set(kCurrentAckHandleKey, state.current.ToValue().release()); |
| 90 if (state.expected.IsValid()) | 90 if (state.expected.IsValid()) |
| 91 value->Set(kExpectedAckHandleKey, state.expected.ToValue().release()); | 91 value->Set(kExpectedAckHandleKey, state.expected.ToValue().release()); |
| 92 return value; | 92 return value; |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace | 95 } // namespace |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 void InvalidatorStorage::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 98 void InvalidatorStorage::RegisterUserPrefs( |
| 99 user_prefs::PrefRegistrySyncable* registry) { |
| 99 registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions, | 100 registry->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions, |
| 100 PrefRegistrySyncable::UNSYNCABLE_PREF); | 101 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 101 registry->RegisterStringPref(prefs::kInvalidatorInvalidationState, | 102 registry->RegisterStringPref( |
| 102 std::string(), | 103 prefs::kInvalidatorInvalidationState, |
| 103 PrefRegistrySyncable::UNSYNCABLE_PREF); | 104 std::string(), |
| 104 registry->RegisterStringPref(prefs::kInvalidatorClientId, | 105 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 105 std::string(), | 106 registry->RegisterStringPref( |
| 106 PrefRegistrySyncable::UNSYNCABLE_PREF); | 107 prefs::kInvalidatorClientId, |
| 107 registry->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions, | 108 std::string(), |
| 108 PrefRegistrySyncable::UNSYNCABLE_PREF); | 109 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 110 registry->RegisterDictionaryPref( |
| 111 prefs::kSyncMaxInvalidationVersions, |
| 112 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 109 } | 113 } |
| 110 | 114 |
| 111 InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) | 115 InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) |
| 112 : pref_service_(pref_service) { | 116 : pref_service_(pref_service) { |
| 113 // TODO(tim): Create a Mock instead of maintaining the if(!pref_service_) case | 117 // TODO(tim): Create a Mock instead of maintaining the if(!pref_service_) case |
| 114 // throughout this file. This is a problem now due to lack of injection at | 118 // throughout this file. This is a problem now due to lack of injection at |
| 115 // ProfileSyncService. Bug 130176. | 119 // ProfileSyncService. Bug 130176. |
| 116 if (pref_service_) | 120 if (pref_service_) |
| 117 MigrateMaxInvalidationVersionsPref(); | 121 MigrateMaxInvalidationVersionsPref(); |
| 118 } | 122 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 return; | 339 return; |
| 336 it->second.current = ack_handle; | 340 it->second.current = ack_handle; |
| 337 | 341 |
| 338 base::ListValue state_map_list; | 342 base::ListValue state_map_list; |
| 339 SerializeToList(state_map, &state_map_list); | 343 SerializeToList(state_map, &state_map_list); |
| 340 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, | 344 pref_service_->Set(prefs::kInvalidatorMaxInvalidationVersions, |
| 341 state_map_list); | 345 state_map_list); |
| 342 } | 346 } |
| 343 | 347 |
| 344 } // namespace browser_sync | 348 } // namespace browser_sync |
| OLD | NEW |