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

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

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/credential_cache_service_win.h" 5 #include "chrome/browser/sync/credential_cache_service_win.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/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 profile_)); 634 profile_));
635 chrome::GetDefaultUserDataDirectory(&alternate_user_data_dir); 635 chrome::GetDefaultUserDataDirectory(&alternate_user_data_dir);
636 } 636 }
637 637
638 FilePath alternate_default_profile_dir = 638 FilePath alternate_default_profile_dir =
639 ProfileManager::GetDefaultProfileDir(alternate_user_data_dir); 639 ProfileManager::GetDefaultProfileDir(alternate_user_data_dir);
640 return alternate_default_profile_dir.Append(chrome::kSyncCredentialsFilename); 640 return alternate_default_profile_dir.Append(chrome::kSyncCredentialsFilename);
641 } 641 }
642 642
643 void CredentialCacheService::InitializeLocalCredentialCacheWriter() { 643 void CredentialCacheService::InitializeLocalCredentialCacheWriter() {
644 local_store_ = new JsonPrefStore( 644 local_store_ = JsonPrefStore::Create(
645 GetCredentialPathInCurrentProfile(), 645 GetCredentialPathInCurrentProfile(),
646 content::BrowserThread::GetMessageLoopProxyForThread( 646 JsonPrefStore::GetTaskRunnerForFile(GetCredentialPathInCurrentProfile(),
647 content::BrowserThread::FILE)); 647 BrowserThread::GetBlockingPool()));
Mattias Nissler (ping if slow) 2012/10/22 17:28:21 Do we have the assumption that the profile directo
zel 2012/10/24 02:20:11 I am not really sure where that actually happens f
648 local_store_observer_ = new LocalStoreObserver(this, local_store_); 648 local_store_observer_ = new LocalStoreObserver(this, local_store_);
649 local_store_->ReadPrefsAsync(NULL); 649 local_store_->ReadPrefsAsync(NULL);
650 } 650 }
651 651
652 void CredentialCacheService::StartListeningForSyncConfigChanges() { 652 void CredentialCacheService::StartListeningForSyncConfigChanges() {
653 // Register for notifications for google sign in and sign out. 653 // Register for notifications for google sign in and sign out.
654 registrar_.Add(this, 654 registrar_.Add(this,
655 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, 655 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
656 content::Source<Profile>(profile_)); 656 content::Source<Profile>(profile_));
657 registrar_.Add(this, 657 registrar_.Add(this,
(...skipping 28 matching lines...) Expand all
686 content::Source<TokenService>(token_service)); 686 content::Source<TokenService>(token_service));
687 registrar_.Add(this, 687 registrar_.Add(this,
688 chrome::NOTIFICATION_TOKENS_CLEARED, 688 chrome::NOTIFICATION_TOKENS_CLEARED,
689 content::Source<TokenService>(token_service)); 689 content::Source<TokenService>(token_service));
690 } 690 }
691 691
692 void CredentialCacheService::LookForCachedCredentialsInAlternateProfile() { 692 void CredentialCacheService::LookForCachedCredentialsInAlternateProfile() {
693 // Attempt to read cached credentials from the alternate profile. If no file 693 // Attempt to read cached credentials from the alternate profile. If no file
694 // exists, ReadPrefsAsync() will cause PREF_READ_ERROR_NO_FILE to be returned 694 // exists, ReadPrefsAsync() will cause PREF_READ_ERROR_NO_FILE to be returned
695 // after initialization is complete. 695 // after initialization is complete.
696 alternate_store_ = new JsonPrefStore( 696 FilePath path = GetCredentialPathInAlternateProfile();
697 GetCredentialPathInAlternateProfile(), 697 alternate_store_ = JsonPrefStore::Create(
698 content::BrowserThread::GetMessageLoopProxyForThread( 698 path,
699 content::BrowserThread::FILE)); 699 JsonPrefStore::GetTaskRunnerForFile(
700 path,
701 BrowserThread::GetBlockingPool()));
700 alternate_store_observer_ = new AlternateStoreObserver(this, 702 alternate_store_observer_ = new AlternateStoreObserver(this,
701 alternate_store_); 703 alternate_store_);
702 alternate_store_->ReadPrefsAsync(NULL); 704 alternate_store_->ReadPrefsAsync(NULL);
703 } 705 }
704 706
705 bool CredentialCacheService::HasUserSignedOut() { 707 bool CredentialCacheService::HasUserSignedOut() {
706 DCHECK(local_store_.get()); 708 DCHECK(local_store_.get());
707 // If HasPref() is false, the user never signed in, since there are no 709 // If HasPref() is false, the user never signed in, since there are no
708 // previously cached credentials. If the kGoogleServicesUsername pref is 710 // previously cached credentials. If the kGoogleServicesUsername pref is
709 // empty, it means that the user signed in and subsequently signed out. 711 // empty, it means that the user signed in and subsequently signed out.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 !HasUserSignedOut() && 871 !HasUserSignedOut() &&
870 !alternate_google_services_username.empty() && 872 !alternate_google_services_username.empty() &&
871 !alternate_lsid.empty() && 873 !alternate_lsid.empty() &&
872 !alternate_sid.empty() && 874 !alternate_sid.empty() &&
873 !(alternate_encryption_bootstrap_token.empty() && 875 !(alternate_encryption_bootstrap_token.empty() &&
874 alternate_keystore_encryption_bootstrap_token.empty()) && 876 alternate_keystore_encryption_bootstrap_token.empty()) &&
875 !service->setup_in_progress(); 877 !service->setup_in_progress();
876 } 878 }
877 879
878 } // namespace syncer 880 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698