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
3 // found in the LICENSE file.
5 #include "components/sync_driver/sync_prefs.h"
7 #include "base/base64.h"
8 #include "base/logging.h"
9 #include "base/prefs/pref_member.h"
10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h"
13 #include "build/build_config.h"
14 #include "components/pref_registry/pref_registry_syncable.h"
15 #include "components/sync_driver/pref_names.h"
17 namespace sync_driver
{
19 SyncPrefObserver::~SyncPrefObserver() {}
21 SyncPrefs::SyncPrefs(PrefService
* pref_service
) : pref_service_(pref_service
) {
24 // Watch the preference that indicates sync is managed so we can take
25 // appropriate action.
26 pref_sync_managed_
.Init(
29 base::Bind(&SyncPrefs::OnSyncManagedPrefChanged
, base::Unretained(this)));
32 SyncPrefs::SyncPrefs() : pref_service_(NULL
) {}
34 SyncPrefs::~SyncPrefs() { DCHECK(CalledOnValidThread()); }
37 void SyncPrefs::RegisterProfilePrefs(
38 user_prefs::PrefRegistrySyncable
* registry
) {
39 registry
->RegisterBooleanPref(prefs::kSyncHasSetupCompleted
, false);
40 registry
->RegisterBooleanPref(prefs::kSyncSuppressStart
, false);
41 registry
->RegisterInt64Pref(prefs::kSyncLastSyncedTime
, 0);
42 registry
->RegisterInt64Pref(prefs::kSyncLastPollTime
, 0);
43 registry
->RegisterInt64Pref(prefs::kSyncFirstSyncTime
, 0);
45 // All datatypes are on by default, but this gets set explicitly
46 // when you configure sync (when turning it on), in
47 // ProfileSyncService::OnUserChoseDatatypes.
48 registry
->RegisterBooleanPref(prefs::kSyncKeepEverythingSynced
, true);
50 syncer::ModelTypeSet user_types
= syncer::UserTypes();
52 // Include proxy types as well, as they can be individually selected,
53 // although they don't have sync representations.
54 user_types
.PutAll(syncer::ProxyTypes());
56 // Treat bookmarks and device info specially.
57 RegisterDataTypePreferredPref(registry
, syncer::BOOKMARKS
, true);
58 RegisterDataTypePreferredPref(registry
, syncer::DEVICE_INFO
, true);
59 user_types
.Remove(syncer::BOOKMARKS
);
60 user_types
.Remove(syncer::DEVICE_INFO
);
62 // All types are set to off by default, which forces a configuration to
63 // explicitly enable them. GetPreferredTypes() will ensure that any new
64 // implicit types are enabled when their pref group is, or via
65 // KeepEverythingSynced.
66 for (syncer::ModelTypeSet::Iterator it
= user_types
.First(); it
.Good();
68 RegisterDataTypePreferredPref(registry
, it
.Get(), false);
71 registry
->RegisterBooleanPref(prefs::kSyncManaged
, false);
72 registry
->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken
,
74 registry
->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken
,
76 #if defined(OS_CHROMEOS)
77 registry
->RegisterStringPref(prefs::kSyncSpareBootstrapToken
, "");
80 registry
->RegisterBooleanPref(prefs::kSyncHasAuthError
, false);
81 registry
->RegisterStringPref(prefs::kSyncSessionsGUID
, std::string());
82 registry
->RegisterIntegerPref(prefs::kSyncRemainingRollbackTries
, 0);
83 registry
->RegisterBooleanPref(prefs::kSyncPassphrasePrompted
, false);
84 registry
->RegisterIntegerPref(prefs::kSyncMemoryPressureWarningCount
, -1);
85 registry
->RegisterBooleanPref(prefs::kSyncShutdownCleanly
, false);
86 registry
->RegisterDictionaryPref(prefs::kSyncInvalidationVersions
);
87 registry
->RegisterStringPref(prefs::kSyncLastRunVersion
, std::string());
88 registry
->RegisterBooleanPref(
89 prefs::kSyncPassphraseEncryptionTransitionInProgress
, false);
90 registry
->RegisterStringPref(prefs::kSyncNigoriStateForPassphraseTransition
,
94 void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver
* sync_pref_observer
) {
95 DCHECK(CalledOnValidThread());
96 sync_pref_observers_
.AddObserver(sync_pref_observer
);
99 void SyncPrefs::RemoveSyncPrefObserver(SyncPrefObserver
* sync_pref_observer
) {
100 DCHECK(CalledOnValidThread());
101 sync_pref_observers_
.RemoveObserver(sync_pref_observer
);
104 void SyncPrefs::ClearPreferences() {
105 DCHECK(CalledOnValidThread());
106 pref_service_
->ClearPref(prefs::kSyncLastSyncedTime
);
107 pref_service_
->ClearPref(prefs::kSyncLastPollTime
);
108 pref_service_
->ClearPref(prefs::kSyncHasSetupCompleted
);
109 pref_service_
->ClearPref(prefs::kSyncEncryptionBootstrapToken
);
110 pref_service_
->ClearPref(prefs::kSyncKeystoreEncryptionBootstrapToken
);
111 pref_service_
->ClearPref(prefs::kSyncPassphrasePrompted
);
112 pref_service_
->ClearPref(prefs::kSyncMemoryPressureWarningCount
);
113 pref_service_
->ClearPref(prefs::kSyncShutdownCleanly
);
114 pref_service_
->ClearPref(prefs::kSyncInvalidationVersions
);
115 pref_service_
->ClearPref(prefs::kSyncLastRunVersion
);
116 pref_service_
->ClearPref(
117 prefs::kSyncPassphraseEncryptionTransitionInProgress
);
118 pref_service_
->ClearPref(prefs::kSyncNigoriStateForPassphraseTransition
);
120 // TODO(nick): The current behavior does not clear
121 // e.g. prefs::kSyncBookmarks. Is that really what we want?
124 bool SyncPrefs::HasSyncSetupCompleted() const {
125 DCHECK(CalledOnValidThread());
126 return pref_service_
->GetBoolean(prefs::kSyncHasSetupCompleted
);
129 void SyncPrefs::SetSyncSetupCompleted() {
130 DCHECK(CalledOnValidThread());
131 pref_service_
->SetBoolean(prefs::kSyncHasSetupCompleted
, true);
132 SetSyncRequested(true);
135 bool SyncPrefs::SyncHasAuthError() const {
136 DCHECK(CalledOnValidThread());
137 return pref_service_
->GetBoolean(prefs::kSyncHasAuthError
);
140 void SyncPrefs::SetSyncAuthError(bool error
) {
141 DCHECK(CalledOnValidThread());
142 pref_service_
->SetBoolean(prefs::kSyncHasAuthError
, error
);
145 bool SyncPrefs::IsSyncRequested() const {
146 DCHECK(CalledOnValidThread());
147 // IsSyncRequested is the inverse of the old SuppressStart pref.
148 // Since renaming a pref value is hard, here we still use the old one.
149 return !pref_service_
->GetBoolean(prefs::kSyncSuppressStart
);
152 void SyncPrefs::SetSyncRequested(bool is_requested
) {
153 DCHECK(CalledOnValidThread());
154 // See IsSyncRequested for why we use this pref and !is_requested.
155 pref_service_
->SetBoolean(prefs::kSyncSuppressStart
, !is_requested
);
158 base::Time
SyncPrefs::GetLastSyncedTime() const {
159 DCHECK(CalledOnValidThread());
160 return base::Time::FromInternalValue(
161 pref_service_
->GetInt64(prefs::kSyncLastSyncedTime
));
164 void SyncPrefs::SetLastSyncedTime(base::Time time
) {
165 DCHECK(CalledOnValidThread());
166 pref_service_
->SetInt64(prefs::kSyncLastSyncedTime
, time
.ToInternalValue());
169 base::Time
SyncPrefs::GetLastPollTime() const {
170 DCHECK(CalledOnValidThread());
171 return base::Time::FromInternalValue(
172 pref_service_
->GetInt64(prefs::kSyncLastSyncedTime
));
175 void SyncPrefs::SetLastPollTime(base::Time time
) {
176 DCHECK(CalledOnValidThread());
177 pref_service_
->SetInt64(prefs::kSyncLastPollTime
, time
.ToInternalValue());
180 bool SyncPrefs::HasKeepEverythingSynced() const {
181 DCHECK(CalledOnValidThread());
182 return pref_service_
->GetBoolean(prefs::kSyncKeepEverythingSynced
);
185 void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced
) {
186 DCHECK(CalledOnValidThread());
187 pref_service_
->SetBoolean(prefs::kSyncKeepEverythingSynced
,
188 keep_everything_synced
);
191 syncer::ModelTypeSet
SyncPrefs::GetPreferredDataTypes(
192 syncer::ModelTypeSet registered_types
) const {
193 DCHECK(CalledOnValidThread());
195 if (pref_service_
->GetBoolean(prefs::kSyncKeepEverythingSynced
)) {
196 return registered_types
;
199 syncer::ModelTypeSet preferred_types
;
200 for (syncer::ModelTypeSet::Iterator it
= registered_types
.First(); it
.Good();
202 if (GetDataTypePreferred(it
.Get())) {
203 preferred_types
.Put(it
.Get());
206 return ResolvePrefGroups(registered_types
, preferred_types
);
209 void SyncPrefs::SetPreferredDataTypes(syncer::ModelTypeSet registered_types
,
210 syncer::ModelTypeSet preferred_types
) {
211 DCHECK(CalledOnValidThread());
212 preferred_types
= ResolvePrefGroups(registered_types
, preferred_types
);
213 DCHECK(registered_types
.HasAll(preferred_types
));
214 for (syncer::ModelTypeSet::Iterator i
= registered_types
.First(); i
.Good();
216 SetDataTypePreferred(i
.Get(), preferred_types
.Has(i
.Get()));
220 bool SyncPrefs::IsManaged() const {
221 DCHECK(CalledOnValidThread());
222 return pref_service_
->GetBoolean(prefs::kSyncManaged
);
225 std::string
SyncPrefs::GetEncryptionBootstrapToken() const {
226 DCHECK(CalledOnValidThread());
227 return pref_service_
->GetString(prefs::kSyncEncryptionBootstrapToken
);
230 void SyncPrefs::SetEncryptionBootstrapToken(const std::string
& token
) {
231 DCHECK(CalledOnValidThread());
232 pref_service_
->SetString(prefs::kSyncEncryptionBootstrapToken
, token
);
235 std::string
SyncPrefs::GetKeystoreEncryptionBootstrapToken() const {
236 DCHECK(CalledOnValidThread());
237 return pref_service_
->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken
);
240 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string
& token
) {
241 DCHECK(CalledOnValidThread());
242 pref_service_
->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken
, token
);
245 std::string
SyncPrefs::GetSyncSessionsGUID() const {
246 DCHECK(CalledOnValidThread());
247 return pref_service_
->GetString(prefs::kSyncSessionsGUID
);
250 void SyncPrefs::SetSyncSessionsGUID(const std::string
& guid
) {
251 DCHECK(CalledOnValidThread());
252 pref_service_
->SetString(prefs::kSyncSessionsGUID
, guid
);
256 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type
) {
258 case syncer::BOOKMARKS
:
259 return prefs::kSyncBookmarks
;
260 case syncer::PASSWORDS
:
261 return prefs::kSyncPasswords
;
262 case syncer::PREFERENCES
:
263 return prefs::kSyncPreferences
;
264 case syncer::AUTOFILL
:
265 return prefs::kSyncAutofill
;
266 case syncer::AUTOFILL_PROFILE
:
267 return prefs::kSyncAutofillProfile
;
268 case syncer::AUTOFILL_WALLET_DATA
:
269 return prefs::kSyncAutofillWallet
;
270 case syncer::AUTOFILL_WALLET_METADATA
:
271 return prefs::kSyncAutofillWalletMetadata
;
273 return prefs::kSyncThemes
;
274 case syncer::TYPED_URLS
:
275 return prefs::kSyncTypedUrls
;
276 case syncer::EXTENSION_SETTINGS
:
277 return prefs::kSyncExtensionSettings
;
278 case syncer::EXTENSIONS
:
279 return prefs::kSyncExtensions
;
280 case syncer::APP_LIST
:
281 return prefs::kSyncAppList
;
282 case syncer::APP_SETTINGS
:
283 return prefs::kSyncAppSettings
;
285 return prefs::kSyncApps
;
286 case syncer::SEARCH_ENGINES
:
287 return prefs::kSyncSearchEngines
;
288 case syncer::SESSIONS
:
289 return prefs::kSyncSessions
;
290 case syncer::APP_NOTIFICATIONS
:
291 return prefs::kSyncAppNotifications
;
292 case syncer::HISTORY_DELETE_DIRECTIVES
:
293 return prefs::kSyncHistoryDeleteDirectives
;
294 case syncer::SYNCED_NOTIFICATIONS
:
295 return prefs::kSyncSyncedNotifications
;
296 case syncer::SYNCED_NOTIFICATION_APP_INFO
:
297 return prefs::kSyncSyncedNotificationAppInfo
;
298 case syncer::DICTIONARY
:
299 return prefs::kSyncDictionary
;
300 case syncer::FAVICON_IMAGES
:
301 return prefs::kSyncFaviconImages
;
302 case syncer::FAVICON_TRACKING
:
303 return prefs::kSyncFaviconTracking
;
304 case syncer::SUPERVISED_USER_SETTINGS
:
305 return prefs::kSyncSupervisedUserSettings
;
306 case syncer::PROXY_TABS
:
307 return prefs::kSyncTabs
;
308 case syncer::PRIORITY_PREFERENCES
:
309 return prefs::kSyncPriorityPreferences
;
310 case syncer::SUPERVISED_USERS
:
311 return prefs::kSyncSupervisedUsers
;
312 case syncer::ARTICLES
:
313 return prefs::kSyncArticles
;
314 case syncer::SUPERVISED_USER_SHARED_SETTINGS
:
315 return prefs::kSyncSupervisedUserSharedSettings
;
316 case syncer::SUPERVISED_USER_WHITELISTS
:
317 return prefs::kSyncSupervisedUserWhitelists
;
318 case syncer::DEVICE_INFO
:
319 return prefs::kSyncDeviceInfo
;
320 case syncer::WIFI_CREDENTIALS
:
321 return prefs::kSyncWifiCredentials
;
325 NOTREACHED() << "Type is " << data_type
;
329 #if defined(OS_CHROMEOS)
330 std::string
SyncPrefs::GetSpareBootstrapToken() const {
331 DCHECK(CalledOnValidThread());
332 return pref_service_
->GetString(prefs::kSyncSpareBootstrapToken
);
335 void SyncPrefs::SetSpareBootstrapToken(const std::string
& token
) {
336 DCHECK(CalledOnValidThread());
337 pref_service_
->SetString(prefs::kSyncSpareBootstrapToken
, token
);
341 int SyncPrefs::GetRemainingRollbackTries() const {
342 return pref_service_
->GetInteger(prefs::kSyncRemainingRollbackTries
);
345 void SyncPrefs::SetRemainingRollbackTries(int times
) {
346 pref_service_
->SetInteger(prefs::kSyncRemainingRollbackTries
, times
);
349 void SyncPrefs::OnSyncManagedPrefChanged() {
350 DCHECK(CalledOnValidThread());
351 FOR_EACH_OBSERVER(SyncPrefObserver
,
352 sync_pref_observers_
,
353 OnSyncManagedPrefChange(*pref_sync_managed_
));
356 void SyncPrefs::SetManagedForTest(bool is_managed
) {
357 DCHECK(CalledOnValidThread());
358 pref_service_
->SetBoolean(prefs::kSyncManaged
, is_managed
);
361 void SyncPrefs::RegisterPrefGroups() {
362 pref_groups_
[syncer::APPS
].Put(syncer::APP_NOTIFICATIONS
);
363 pref_groups_
[syncer::APPS
].Put(syncer::APP_SETTINGS
);
364 pref_groups_
[syncer::APPS
].Put(syncer::APP_LIST
);
366 pref_groups_
[syncer::AUTOFILL
].Put(syncer::AUTOFILL_PROFILE
);
367 pref_groups_
[syncer::AUTOFILL
].Put(syncer::AUTOFILL_WALLET_DATA
);
368 pref_groups_
[syncer::AUTOFILL
].Put(syncer::AUTOFILL_WALLET_METADATA
);
370 pref_groups_
[syncer::EXTENSIONS
].Put(syncer::EXTENSION_SETTINGS
);
372 pref_groups_
[syncer::PREFERENCES
].Put(syncer::DICTIONARY
);
373 pref_groups_
[syncer::PREFERENCES
].Put(syncer::PRIORITY_PREFERENCES
);
374 pref_groups_
[syncer::PREFERENCES
].Put(syncer::SEARCH_ENGINES
);
376 pref_groups_
[syncer::TYPED_URLS
].Put(syncer::HISTORY_DELETE_DIRECTIVES
);
377 pref_groups_
[syncer::TYPED_URLS
].Put(syncer::SESSIONS
);
378 pref_groups_
[syncer::TYPED_URLS
].Put(syncer::FAVICON_IMAGES
);
379 pref_groups_
[syncer::TYPED_URLS
].Put(syncer::FAVICON_TRACKING
);
381 pref_groups_
[syncer::PROXY_TABS
].Put(syncer::SESSIONS
);
382 pref_groups_
[syncer::PROXY_TABS
].Put(syncer::FAVICON_IMAGES
);
383 pref_groups_
[syncer::PROXY_TABS
].Put(syncer::FAVICON_TRACKING
);
385 // TODO(zea): put favicons in the bookmarks group as well once it handles
390 void SyncPrefs::RegisterDataTypePreferredPref(
391 user_prefs::PrefRegistrySyncable
* registry
,
392 syncer::ModelType type
,
394 const char* pref_name
= GetPrefNameForDataType(type
);
399 registry
->RegisterBooleanPref(pref_name
, is_preferred
);
402 bool SyncPrefs::GetDataTypePreferred(syncer::ModelType type
) const {
403 DCHECK(CalledOnValidThread());
404 const char* pref_name
= GetPrefNameForDataType(type
);
410 // Device info is always enabled.
411 if (pref_name
== prefs::kSyncDeviceInfo
)
414 if (type
== syncer::PROXY_TABS
&&
415 pref_service_
->GetUserPrefValue(pref_name
) == NULL
&&
416 pref_service_
->IsUserModifiablePreference(pref_name
)) {
417 // If there is no tab sync preference yet (i.e. newly enabled type),
418 // default to the session sync preference value.
419 pref_name
= GetPrefNameForDataType(syncer::SESSIONS
);
422 return pref_service_
->GetBoolean(pref_name
);
425 void SyncPrefs::SetDataTypePreferred(syncer::ModelType type
,
427 DCHECK(CalledOnValidThread());
428 const char* pref_name
= GetPrefNameForDataType(type
);
434 // Device info is always preferred.
435 if (type
== syncer::DEVICE_INFO
)
438 pref_service_
->SetBoolean(pref_name
, is_preferred
);
441 syncer::ModelTypeSet
SyncPrefs::ResolvePrefGroups(
442 syncer::ModelTypeSet registered_types
,
443 syncer::ModelTypeSet types
) const {
444 syncer::ModelTypeSet types_with_groups
= types
;
445 for (PrefGroupsMap::const_iterator i
= pref_groups_
.begin();
446 i
!= pref_groups_
.end();
448 if (types
.Has(i
->first
))
449 types_with_groups
.PutAll(i
->second
);
451 types_with_groups
.RetainAll(registered_types
);
452 return types_with_groups
;
455 base::Time
SyncPrefs::GetFirstSyncTime() const {
456 return base::Time::FromInternalValue(
457 pref_service_
->GetInt64(prefs::kSyncFirstSyncTime
));
460 void SyncPrefs::SetFirstSyncTime(base::Time time
) {
461 pref_service_
->SetInt64(prefs::kSyncFirstSyncTime
, time
.ToInternalValue());
464 void SyncPrefs::ClearFirstSyncTime() {
465 pref_service_
->ClearPref(prefs::kSyncFirstSyncTime
);
468 bool SyncPrefs::IsPassphrasePrompted() const {
469 return pref_service_
->GetBoolean(prefs::kSyncPassphrasePrompted
);
472 void SyncPrefs::SetPassphrasePrompted(bool value
) {
473 pref_service_
->SetBoolean(prefs::kSyncPassphrasePrompted
, value
);
476 int SyncPrefs::GetMemoryPressureWarningCount() const {
477 return pref_service_
->GetInteger(prefs::kSyncMemoryPressureWarningCount
);
480 void SyncPrefs::SetMemoryPressureWarningCount(int value
) {
481 pref_service_
->SetInteger(prefs::kSyncMemoryPressureWarningCount
, value
);
484 bool SyncPrefs::DidSyncShutdownCleanly() const {
485 return pref_service_
->GetBoolean(prefs::kSyncShutdownCleanly
);
488 void SyncPrefs::SetCleanShutdown(bool value
) {
489 pref_service_
->SetBoolean(prefs::kSyncShutdownCleanly
, value
);
492 void SyncPrefs::GetInvalidationVersions(
493 std::map
<syncer::ModelType
, int64
>* invalidation_versions
) const {
494 const base::DictionaryValue
* invalidation_dictionary
=
495 pref_service_
->GetDictionary(prefs::kSyncInvalidationVersions
);
496 syncer::ModelTypeSet protocol_types
= syncer::ProtocolTypes();
497 for (auto iter
= protocol_types
.First(); iter
.Good(); iter
.Inc()) {
498 std::string key
= syncer::ModelTypeToString(iter
.Get());
499 std::string version_str
;
500 if (!invalidation_dictionary
->GetString(key
, &version_str
))
503 if (!base::StringToInt64(version_str
, &version
))
505 (*invalidation_versions
)[iter
.Get()] = version
;
509 void SyncPrefs::UpdateInvalidationVersions(
510 const std::map
<syncer::ModelType
, int64
>& invalidation_versions
) {
511 scoped_ptr
<base::DictionaryValue
> invalidation_dictionary(
512 new base::DictionaryValue());
513 for (const auto& map_iter
: invalidation_versions
) {
514 std::string version_str
= base::Int64ToString(map_iter
.second
);
515 invalidation_dictionary
->SetString(
516 syncer::ModelTypeToString(map_iter
.first
), version_str
);
518 pref_service_
->Set(prefs::kSyncInvalidationVersions
,
519 *invalidation_dictionary
);
522 std::string
SyncPrefs::GetLastRunVersion() const {
523 return pref_service_
->GetString(prefs::kSyncLastRunVersion
);
526 void SyncPrefs::SetLastRunVersion(const std::string
& current_version
) {
527 pref_service_
->SetString(prefs::kSyncLastRunVersion
, current_version
);
530 void SyncPrefs::SetPassphraseEncryptionTransitionInProgress(bool value
) {
531 pref_service_
->SetBoolean(
532 prefs::kSyncPassphraseEncryptionTransitionInProgress
, value
);
535 bool SyncPrefs::GetPassphraseEncryptionTransitionInProgress() const {
536 return pref_service_
->GetBoolean(
537 prefs::kSyncPassphraseEncryptionTransitionInProgress
);
540 void SyncPrefs::SetSavedNigoriStateForPassphraseEncryptionTransition(
541 const syncer::SyncEncryptionHandler::NigoriState
& nigori_state
) {
543 base::Base64Encode(nigori_state
.nigori_specifics
.SerializeAsString(),
545 pref_service_
->SetString(prefs::kSyncNigoriStateForPassphraseTransition
,
549 scoped_ptr
<syncer::SyncEncryptionHandler::NigoriState
>
550 SyncPrefs::GetSavedNigoriStateForPassphraseEncryptionTransition() const {
551 const std::string encoded
=
552 pref_service_
->GetString(prefs::kSyncNigoriStateForPassphraseTransition
);
554 if (!base::Base64Decode(encoded
, &decoded
))
555 return scoped_ptr
<syncer::SyncEncryptionHandler::NigoriState
>();
557 scoped_ptr
<syncer::SyncEncryptionHandler::NigoriState
> result(
558 new syncer::SyncEncryptionHandler::NigoriState());
559 if (!result
->nigori_specifics
.ParseFromString(decoded
))
560 return scoped_ptr
<syncer::SyncEncryptionHandler::NigoriState
>();
564 } // namespace sync_driver