| 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 #ifndef CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ | 5 #ifndef CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ |
| 6 #define CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ | 6 #define CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Asynchronously looks for a cached credential file in the alternate profile | 137 // Asynchronously looks for a cached credential file in the alternate profile |
| 138 // and initiates start up using cached credentials if the file was found. | 138 // and initiates start up using cached credentials if the file was found. |
| 139 // Called by ProfileSyncService when it tries to start up on Windows 8 and | 139 // Called by ProfileSyncService when it tries to start up on Windows 8 and |
| 140 // cannot auto-start. | 140 // cannot auto-start. |
| 141 void LookForCachedCredentialsInAlternateProfile(); | 141 void LookForCachedCredentialsInAlternateProfile(); |
| 142 | 142 |
| 143 // Loads cached sync credentials from the alternate profile and calls | 143 // Loads cached sync credentials from the alternate profile and calls |
| 144 // ApplyCachedCredentials if the load was successful. | 144 // ApplyCachedCredentials if the load was successful. |
| 145 void ReadCachedCredentialsFromAlternateProfile(); | 145 void ReadCachedCredentialsFromAlternateProfile(); |
| 146 | 146 |
| 147 // Applies the credentials read from the alternate profile to the PrefStore | 147 // Initiates sync sign in using credentials read from the alternate profile by |
| 148 // and TokenService of the local profile and then notifies listeners. | 148 // persisting |google_services_username|, |encryption_bootstrap_token|, |
| 149 void ApplyCachedCredentials(const std::string& google_services_username, | 149 // |keep_everything_synced| and |preferred_types| to the local pref store, and |
| 150 const std::string& lsid, | 150 // preparing ProfileSyncService for sign in. |
| 151 const std::string& sid, | 151 void InitiateSignInWithCachedCredentials( |
| 152 const std::string& encryption_bootstrap_token, | 152 const std::string& google_services_username, |
| 153 bool keep_everything_synced, | 153 const std::string& encryption_bootstrap_token, |
| 154 const bool datatype_prefs[]); | 154 bool keep_everything_synced, |
| 155 ModelTypeSet preferred_types); |
| 156 |
| 157 // Updates the TokenService credentials with |lsid| and |sid| and triggers the |
| 158 // minting of new tokens for all Chrome services. ProfileSyncService is |
| 159 // automatically notified when tokens are minted, and goes on to consume the |
| 160 // updated credentials. |
| 161 void UpdateTokenServiceCredentials(const std::string& lsid, |
| 162 const std::string& sid); |
| 163 |
| 164 // Initiates a sign out of sync. Called when we notice that the user has |
| 165 // signed out from the alternate mode by reading its credential cache. |
| 166 void InitiateSignOut(); |
| 167 |
| 168 // Compares the sync preferences in the local profile with values that were |
| 169 // read from the alternate profile -- |keep_everything_synced| and |
| 170 // |preferred_types|. Returns true if the prefs have changed, and false |
| 171 // otherwise. |
| 172 bool HaveSyncPrefsChanged(bool keep_everything_synced, |
| 173 const ModelTypeSet& preferred_types) const; |
| 174 |
| 175 // Compares the token service credentials in the local profile with values |
| 176 // that were read from the alternate profile -- |lsid| and |sid|. Returns true |
| 177 // if the credentials have changed, and false otherwise. |
| 178 bool HaveTokenServiceCredentialsChanged(const std::string& lsid, |
| 179 const std::string& sid); |
| 180 |
| 181 // Determines if sync settings may be reconfigured or not. Called when |
| 182 // updated settings are noticed in the alternate credential cache for |
| 183 // |google_services_username|. Returns true if we may reconfigure, and false |
| 184 // if not. |
| 185 bool CredentialCacheService::MayReconfigureSync( |
| 186 const std::string& google_services_username); |
| 187 |
| 188 // Resets |alternate_store_| and schedules the next read from the alternate |
| 189 // credential cache. |
| 190 void ScheduleNextReadFromAlternateCredentialCache(); |
| 155 | 191 |
| 156 // Profile for which credentials are being cached. | 192 // Profile for which credentials are being cached. |
| 157 Profile* profile_; | 193 Profile* profile_; |
| 158 | 194 |
| 159 // Used to access sync specific preferences in the PrefStore of |profile_|. | 195 // Used to access sync specific preferences in the PrefStore of |profile_|. |
| 160 browser_sync::SyncPrefs sync_prefs_; | 196 browser_sync::SyncPrefs sync_prefs_; |
| 161 | 197 |
| 162 // Used for write operations to the credential cache file in the local profile | 198 // Used for write operations to the credential cache file in the local profile |
| 163 // directory. This is separate from the chrome pref store. Protected so that | 199 // directory. This is separate from the chrome pref store. Protected so that |
| 164 // it can be accessed by unit tests. | 200 // it can be accessed by unit tests. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 176 | 212 |
| 177 // WeakPtr implementation. | 213 // WeakPtr implementation. |
| 178 base::WeakPtrFactory<CredentialCacheService> weak_factory_; | 214 base::WeakPtrFactory<CredentialCacheService> weak_factory_; |
| 179 | 215 |
| 180 DISALLOW_COPY_AND_ASSIGN(CredentialCacheService); | 216 DISALLOW_COPY_AND_ASSIGN(CredentialCacheService); |
| 181 }; | 217 }; |
| 182 | 218 |
| 183 } // namespace syncer | 219 } // namespace syncer |
| 184 | 220 |
| 185 #endif // CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ | 221 #endif // CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ |
| OLD | NEW |