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

Unified Diff: chrome/browser/sync/credential_cache_service_win.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/credential_cache_service_win.cc
diff --git a/chrome/browser/sync/credential_cache_service_win.cc b/chrome/browser/sync/credential_cache_service_win.cc
index 9c938d0b5e1d2113fe53b8658a91f7e618af5501..8d05e0d6dc3041eea22fe9e000d23039c42a7b63 100644
--- a/chrome/browser/sync/credential_cache_service_win.cc
+++ b/chrome/browser/sync/credential_cache_service_win.cc
@@ -94,24 +94,6 @@ void CredentialCacheService::Observe(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(local_store_.get());
switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED: {
- // One of the two sync encryption tokens has changed. Update its value in
- // the local cache.
- const std::string pref_name =
- *(content::Details<const std::string>(details).ptr());
- if (pref_name == prefs::kSyncEncryptionBootstrapToken) {
- PackAndUpdateStringPref(pref_name,
- sync_prefs_.GetEncryptionBootstrapToken());
- } else if (pref_name == prefs::kSyncKeystoreEncryptionBootstrapToken) {
- PackAndUpdateStringPref(
- pref_name,
- sync_prefs_.GetKeystoreEncryptionBootstrapToken());
- } else {
- NOTREACHED() "Invalid pref name " << pref_name << ".";
- }
- break;
- }
-
case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT: {
// The user has signed out. Write blank values to the google username,
// encryption tokens and token service credentials in the local cache.
@@ -193,6 +175,22 @@ void CredentialCacheService::Observe(
}
}
+void CredentialCacheService::OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& pref_name) {
+ // One of the two sync encryption tokens has changed. Update its value in
+ // the local cache.
+ if (pref_name == prefs::kSyncEncryptionBootstrapToken) {
+ PackAndUpdateStringPref(pref_name,
+ sync_prefs_.GetEncryptionBootstrapToken());
+ } else if (pref_name == prefs::kSyncKeystoreEncryptionBootstrapToken) {
+ PackAndUpdateStringPref(
+ pref_name,
+ sync_prefs_.GetKeystoreEncryptionBootstrapToken());
+ } else {
+ NOTREACHED() "Invalid pref name " << pref_name << ".";
+ }
+}
+
void CredentialCacheService::ReadCachedCredentialsFromAlternateProfile() {
// If the local user has signed in and signed out, we do not consume cached
// credentials from the alternate profile. There is nothing more to do, now or
« no previous file with comments | « chrome/browser/sync/credential_cache_service_win.h ('k') | chrome/browser/sync/glue/typed_url_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698