Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: chrome/browser/sync/sync_prefs.cc

Issue 12313075: [sync] Upstream the Android ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased which required moving strings to GRD. Removed unused imports and fixed a long line. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/sync_prefs.h" 5 #include "chrome/browser/sync/sync_prefs.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/public/pref_member.h" 9 #include "base/prefs/public/pref_member.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 PrefRegistrySyncable::UNSYNCABLE_PREF); 85 PrefRegistrySyncable::UNSYNCABLE_PREF);
86 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, 86 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken,
87 "", 87 "",
88 PrefRegistrySyncable::UNSYNCABLE_PREF); 88 PrefRegistrySyncable::UNSYNCABLE_PREF);
89 #if defined(OS_CHROMEOS) 89 #if defined(OS_CHROMEOS)
90 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, 90 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken,
91 "", 91 "",
92 PrefRegistrySyncable::UNSYNCABLE_PREF); 92 PrefRegistrySyncable::UNSYNCABLE_PREF);
93 #endif 93 #endif
94 94
95 registry->RegisterStringPref(prefs::kSyncSessionsGUID,
96 "",
97 PrefRegistrySyncable::UNSYNCABLE_PREF);
98
95 // We will start prompting people about new data types after the launch of 99 // We will start prompting people about new data types after the launch of
96 // SESSIONS - all previously launched data types are treated as if they are 100 // SESSIONS - all previously launched data types are treated as if they are
97 // already acknowledged. 101 // already acknowledged.
98 syncer::ModelTypeSet model_set; 102 syncer::ModelTypeSet model_set;
99 model_set.Put(syncer::BOOKMARKS); 103 model_set.Put(syncer::BOOKMARKS);
100 model_set.Put(syncer::PREFERENCES); 104 model_set.Put(syncer::PREFERENCES);
101 model_set.Put(syncer::PASSWORDS); 105 model_set.Put(syncer::PASSWORDS);
102 model_set.Put(syncer::AUTOFILL_PROFILE); 106 model_set.Put(syncer::AUTOFILL_PROFILE);
103 model_set.Put(syncer::AUTOFILL); 107 model_set.Put(syncer::AUTOFILL);
104 model_set.Put(syncer::THEMES); 108 model_set.Put(syncer::THEMES);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 pref_service_ ? 276 pref_service_ ?
273 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : 277 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) :
274 ""; 278 "";
275 } 279 }
276 280
277 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { 281 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) {
278 DCHECK(CalledOnValidThread()); 282 DCHECK(CalledOnValidThread());
279 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token); 283 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token);
280 } 284 }
281 285
286 std::string SyncPrefs::GetSyncSessionsGUID() const {
287 DCHECK(CalledOnValidThread());
288 return
289 pref_service_ ?
290 pref_service_->GetString(prefs::kSyncSessionsGUID) : "";
291 }
292
293 void SyncPrefs::SetSyncSessionsGUID(const std::string& guid) {
294 DCHECK(CalledOnValidThread());
295 pref_service_->SetString(prefs::kSyncSessionsGUID, guid);
296 }
297
282 // static 298 // static
283 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { 299 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) {
284 switch (data_type) { 300 switch (data_type) {
285 case syncer::BOOKMARKS: 301 case syncer::BOOKMARKS:
286 return prefs::kSyncBookmarks; 302 return prefs::kSyncBookmarks;
287 case syncer::PASSWORDS: 303 case syncer::PASSWORDS:
288 return prefs::kSyncPasswords; 304 return prefs::kSyncPasswords;
289 case syncer::PREFERENCES: 305 case syncer::PREFERENCES:
290 return prefs::kSyncPreferences; 306 return prefs::kSyncPreferences;
291 case syncer::AUTOFILL: 307 case syncer::AUTOFILL:
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if (types.Has(i->first)) 461 if (types.Has(i->first))
446 types_with_groups.PutAll(i->second); 462 types_with_groups.PutAll(i->second);
447 else 463 else
448 types_with_groups.RemoveAll(i->second); 464 types_with_groups.RemoveAll(i->second);
449 } 465 }
450 types_with_groups.RetainAll(registered_types); 466 types_with_groups.RetainAll(registered_types);
451 return types_with_groups; 467 return types_with_groups;
452 } 468 }
453 469
454 } // namespace browser_sync 470 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698