| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Loads cached sync credentials from the alternate profile and applies them | 55 // Loads cached sync credentials from the alternate profile and applies them |
| 56 // to the local profile if the load was successful. | 56 // to the local profile if the load was successful. |
| 57 void ReadCachedCredentialsFromAlternateProfile(); | 57 void ReadCachedCredentialsFromAlternateProfile(); |
| 58 | 58 |
| 59 // Writes kSyncKeepEverythingSynced and the sync preferences for individual | 59 // Writes kSyncKeepEverythingSynced and the sync preferences for individual |
| 60 // datatypes to the local cache. | 60 // datatypes to the local cache. |
| 61 void WriteSyncPrefsToLocalCache(); | 61 void WriteSyncPrefsToLocalCache(); |
| 62 | 62 |
| 63 // Resets |alternate_store_| and schedules the next read from the alternate | 63 // Resets |alternate_store_| and schedules the next read from the alternate |
| 64 // credential cache. | 64 // credential cache in |delay_secs| seconds. |
| 65 void ScheduleNextReadFromAlternateCredentialCache(); | 65 void ScheduleNextReadFromAlternateCredentialCache(int delay_secs); |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 // Returns true if the credential cache represented by |store| contains a | 68 // Returns true if the credential cache represented by |store| contains a |
| 69 // value for |pref_name|. | 69 // value for |pref_name|. |
| 70 bool HasPref(scoped_refptr<JsonPrefStore> store, | 70 bool HasPref(scoped_refptr<JsonPrefStore> store, |
| 71 const std::string& pref_name); | 71 const std::string& pref_name); |
| 72 | 72 |
| 73 // Encrypts and base 64 encodes |credential|, converts the result to a | 73 // Encrypts and base 64 encodes |credential|, converts the result to a |
| 74 // StringValue, and returns the result. Caller owns the StringValue returned. | 74 // StringValue, and returns the result. Caller owns the StringValue returned. |
| 75 static base::StringValue* PackCredential(const std::string& credential); | 75 static base::StringValue* PackCredential(const std::string& credential); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void UpdateTokenServiceCredentials(const std::string& alternate_lsid, | 222 void UpdateTokenServiceCredentials(const std::string& alternate_lsid, |
| 223 const std::string& alternate_sid); | 223 const std::string& alternate_sid); |
| 224 | 224 |
| 225 // Initiates a sign out of sync. Called when we notice that the user has | 225 // Initiates a sign out of sync. Called when we notice that the user has |
| 226 // signed out from the alternate mode by reading its credential cache. | 226 // signed out from the alternate mode by reading its credential cache. |
| 227 void InitiateSignOut(); | 227 void InitiateSignOut(); |
| 228 | 228 |
| 229 // Compares the sync preferences in the local profile with values that were | 229 // Compares the sync preferences in the local profile with values that were |
| 230 // read from the alternate profile -- |alternate_keep_everything_synced| and | 230 // read from the alternate profile -- |alternate_keep_everything_synced| and |
| 231 // |alternate_preferred_types|. Returns true if the prefs have changed, and | 231 // |alternate_preferred_types|. Returns true if the prefs have changed, and |
| 232 // false otherwise. | 232 // false otherwise. Note: Differences in preferred_types are ignored if the |
| 233 // alternate and local values of keep_everything_synced are both true. |
| 233 bool HaveSyncPrefsChanged(bool alternate_keep_everything_synced, | 234 bool HaveSyncPrefsChanged(bool alternate_keep_everything_synced, |
| 234 ModelTypeSet alternate_preferred_types) const; | 235 ModelTypeSet alternate_preferred_types) const; |
| 235 | 236 |
| 236 // Compares the sync encryption tokens in the local profile with values that | 237 // Compares the sync encryption tokens in the local profile with values that |
| 237 // were read from the alternate profile -- | 238 // were read from the alternate profile -- |
| 238 // |alternate_encryption_bootstrap_token| and | 239 // |alternate_encryption_bootstrap_token| and |
| 239 // |alternate_keystore_encryption_bootstrap_token|. Returns true if the tokens | 240 // |alternate_keystore_encryption_bootstrap_token|. Returns true if the tokens |
| 240 // have changed, and false otherwise. | 241 // have changed, and false otherwise. |
| 241 bool HaveSyncEncryptionTokensChanged( | 242 bool HaveSyncEncryptionTokensChanged( |
| 242 const std::string& alternate_encryption_bootstrap_token, | 243 const std::string& alternate_encryption_bootstrap_token, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // Used to make sure that there is always at most one future read scheduled | 310 // Used to make sure that there is always at most one future read scheduled |
| 310 // on the alternate credential cache. | 311 // on the alternate credential cache. |
| 311 base::CancelableClosure next_read_; | 312 base::CancelableClosure next_read_; |
| 312 | 313 |
| 313 DISALLOW_COPY_AND_ASSIGN(CredentialCacheService); | 314 DISALLOW_COPY_AND_ASSIGN(CredentialCacheService); |
| 314 }; | 315 }; |
| 315 | 316 |
| 316 } // namespace syncer | 317 } // namespace syncer |
| 317 | 318 |
| 318 #endif // CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ | 319 #endif // CHROME_BROWSER_SYNC_CREDENTIAL_CACHE_SERVICE_WIN_H_ |
| OLD | NEW |