| 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 #include "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 void ProfileSyncService::OnSyncManagedPrefChange(bool is_sync_managed) { | 2286 void ProfileSyncService::OnSyncManagedPrefChange(bool is_sync_managed) { |
| 2287 NotifyObservers(); | 2287 NotifyObservers(); |
| 2288 if (is_sync_managed) { | 2288 if (is_sync_managed) { |
| 2289 DisableForUser(); | 2289 DisableForUser(); |
| 2290 } else { | 2290 } else { |
| 2291 // Sync is no longer disabled by policy. Try starting it up if appropriate. | 2291 // Sync is no longer disabled by policy. Try starting it up if appropriate. |
| 2292 startup_controller_.TryStart(); | 2292 startup_controller_.TryStart(); |
| 2293 } | 2293 } |
| 2294 } | 2294 } |
| 2295 | 2295 |
| 2296 void ProfileSyncService::GoogleSigninSucceeded(const std::string& username, | 2296 void ProfileSyncService::GoogleSigninSucceeded(const std::string& account_id, |
| 2297 const std::string& username, |
| 2297 const std::string& password) { | 2298 const std::string& password) { |
| 2298 if (!sync_prefs_.IsStartSuppressed() && !password.empty()) { | 2299 if (!sync_prefs_.IsStartSuppressed() && !password.empty()) { |
| 2299 cached_passphrase_ = password; | 2300 cached_passphrase_ = password; |
| 2300 // Try to consume the passphrase we just cached. If the sync backend | 2301 // Try to consume the passphrase we just cached. If the sync backend |
| 2301 // is not running yet, the passphrase will remain cached until the | 2302 // is not running yet, the passphrase will remain cached until the |
| 2302 // backend starts up. | 2303 // backend starts up. |
| 2303 ConsumeCachedPassphraseIfPossible(); | 2304 ConsumeCachedPassphraseIfPossible(); |
| 2304 } | 2305 } |
| 2305 #if defined(OS_CHROMEOS) | 2306 #if defined(OS_CHROMEOS) |
| 2306 RefreshSpareBootstrapToken(password); | 2307 RefreshSpareBootstrapToken(password); |
| 2307 #endif | 2308 #endif |
| 2308 if (!sync_initialized() || GetAuthError().state() != AuthError::NONE) { | 2309 if (!sync_initialized() || GetAuthError().state() != AuthError::NONE) { |
| 2309 // Track the fact that we're still waiting for auth to complete. | 2310 // Track the fact that we're still waiting for auth to complete. |
| 2310 is_auth_in_progress_ = true; | 2311 is_auth_in_progress_ = true; |
| 2311 } | 2312 } |
| 2312 } | 2313 } |
| 2313 | 2314 |
| 2314 void ProfileSyncService::GoogleSignedOut(const std::string& username) { | 2315 void ProfileSyncService::GoogleSignedOut(const std::string& account_id, |
| 2316 const std::string& username) { |
| 2315 sync_disabled_by_admin_ = false; | 2317 sync_disabled_by_admin_ = false; |
| 2316 DisableForUser(); | 2318 DisableForUser(); |
| 2317 | 2319 |
| 2318 if (browser_sync::BackupRollbackController::IsBackupEnabled()) { | 2320 if (browser_sync::BackupRollbackController::IsBackupEnabled()) { |
| 2319 need_backup_ = true; | 2321 need_backup_ = true; |
| 2320 backup_finished_ = false; | 2322 backup_finished_ = false; |
| 2321 } | 2323 } |
| 2322 } | 2324 } |
| 2323 | 2325 |
| 2324 void ProfileSyncService::AddObserver( | 2326 void ProfileSyncService::AddObserver( |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 true)); | 2782 true)); |
| 2781 } | 2783 } |
| 2782 | 2784 |
| 2783 bool ProfileSyncService::NeedBackup() const { | 2785 bool ProfileSyncService::NeedBackup() const { |
| 2784 return need_backup_; | 2786 return need_backup_; |
| 2785 } | 2787 } |
| 2786 | 2788 |
| 2787 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2789 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
| 2788 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); | 2790 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); |
| 2789 } | 2791 } |
| OLD | NEW |