| 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 <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 #endif | 407 #endif |
| 408 CreateBackend(); | 408 CreateBackend(); |
| 409 | 409 |
| 410 // Initialize the backend. Every time we start up a new SyncBackendHost, | 410 // Initialize the backend. Every time we start up a new SyncBackendHost, |
| 411 // we'll want to start from a fresh SyncDB, so delete any old one that might | 411 // we'll want to start from a fresh SyncDB, so delete any old one that might |
| 412 // be there. | 412 // be there. |
| 413 InitializeBackend(!HasSyncSetupCompleted()); | 413 InitializeBackend(!HasSyncSetupCompleted()); |
| 414 | 414 |
| 415 if (!sync_global_error_.get()) { | 415 if (!sync_global_error_.get()) { |
| 416 sync_global_error_.reset(new SyncGlobalError(this)); | 416 sync_global_error_.reset(new SyncGlobalError(this, signin())); |
| 417 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( | 417 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( |
| 418 sync_global_error_.get()); | 418 sync_global_error_.get()); |
| 419 AddObserver(sync_global_error_.get()); | 419 AddObserver(sync_global_error_.get()); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 void ProfileSyncService::Shutdown() { | 423 void ProfileSyncService::Shutdown() { |
| 424 ShutdownImpl(false); | 424 ShutdownImpl(false); |
| 425 } | 425 } |
| 426 | 426 |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 } | 995 } |
| 996 | 996 |
| 997 bool ProfileSyncService::waiting_for_auth() const { | 997 bool ProfileSyncService::waiting_for_auth() const { |
| 998 return is_auth_in_progress_; | 998 return is_auth_in_progress_; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 bool ProfileSyncService::unrecoverable_error_detected() const { | 1001 bool ProfileSyncService::unrecoverable_error_detected() const { |
| 1002 return unrecoverable_error_detected_; | 1002 return unrecoverable_error_detected_; |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 bool ProfileSyncService::UIShouldDepictAuthInProgress() const { | |
| 1006 return signin()->AuthInProgress(); | |
| 1007 } | |
| 1008 | |
| 1009 bool ProfileSyncService::IsPassphraseRequired() const { | 1005 bool ProfileSyncService::IsPassphraseRequired() const { |
| 1010 return passphrase_required_reason_ != | 1006 return passphrase_required_reason_ != |
| 1011 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; | 1007 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; |
| 1012 } | 1008 } |
| 1013 | 1009 |
| 1014 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used | 1010 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used |
| 1015 // appropriately (see http://crbug.com/91379). | 1011 // appropriately (see http://crbug.com/91379). |
| 1016 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { | 1012 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { |
| 1017 // If there is an encrypted datatype enabled and we don't have the proper | 1013 // If there is an encrypted datatype enabled and we don't have the proper |
| 1018 // passphrase, we must prompt the user for a passphrase. The only way for the | 1014 // passphrase, we must prompt the user for a passphrase. The only way for the |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1636 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
| 1641 ProfileSyncService* old_this = this; | 1637 ProfileSyncService* old_this = this; |
| 1642 this->~ProfileSyncService(); | 1638 this->~ProfileSyncService(); |
| 1643 new(old_this) ProfileSyncService( | 1639 new(old_this) ProfileSyncService( |
| 1644 new ProfileSyncComponentsFactoryImpl(profile, | 1640 new ProfileSyncComponentsFactoryImpl(profile, |
| 1645 CommandLine::ForCurrentProcess()), | 1641 CommandLine::ForCurrentProcess()), |
| 1646 profile, | 1642 profile, |
| 1647 signin, | 1643 signin, |
| 1648 behavior); | 1644 behavior); |
| 1649 } | 1645 } |
| OLD | NEW |