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