diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 17:32:20 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 17:32:20 +0000 |
commit | 44b78f90aa7fb40d6694045f4da76c502dea2272 (patch) | |
tree | 8b2d947065d5b00f5b12a61407134438b7a0446d /chrome/browser/sync | |
parent | 08b8f440a84673f70cdfbd52d3918c4a31d3ba90 (diff) | |
download | chromium_src-44b78f90aa7fb40d6694045f4da76c502dea2272.zip chromium_src-44b78f90aa7fb40d6694045f4da76c502dea2272.tar.gz chromium_src-44b78f90aa7fb40d6694045f4da76c502dea2272.tar.bz2 |
Fix pieces of syncapi that aren't implemented on Linux.
Review URL: http://codereview.chromium.org/242141
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/glue/bookmark_model_worker.h | 1 | ||||
-rw-r--r-- | chrome/browser/sync/glue/model_associator.h | 1 | ||||
-rw-r--r-- | chrome/browser/sync/notifier/communicator/login.cc | 33 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 20 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 8 |
5 files changed, 34 insertions, 29 deletions
diff --git a/chrome/browser/sync/glue/bookmark_model_worker.h b/chrome/browser/sync/glue/bookmark_model_worker.h index 7ac61e8..2c4520c 100644 --- a/chrome/browser/sync/glue/bookmark_model_worker.h +++ b/chrome/browser/sync/glue/bookmark_model_worker.h @@ -132,4 +132,3 @@ class BookmarkModelWorker #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_WORKER_H_ #endif // CHROME_PERSONALIZATION - diff --git a/chrome/browser/sync/glue/model_associator.h b/chrome/browser/sync/glue/model_associator.h index 6c3776e..70fc486 100644 --- a/chrome/browser/sync/glue/model_associator.h +++ b/chrome/browser/sync/glue/model_associator.h @@ -141,4 +141,3 @@ class ModelAssociator #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCATOR_H_ #endif // CHROME_PERSONALIZATION - diff --git a/chrome/browser/sync/notifier/communicator/login.cc b/chrome/browser/sync/notifier/communicator/login.cc index 4e2feb1..90a0e70 100644 --- a/chrome/browser/sync/notifier/communicator/login.cc +++ b/chrome/browser/sync/notifier/communicator/login.cc @@ -70,20 +70,23 @@ Login::Login(talk_base::Task* parent, network_status->Start(); } } - network_status->SignalNetworkStateDetected.connect( - this, &Login::OnNetworkStateDetected); - auto_reconnect_.reset(new AutoReconnect(parent_, network_status)); - auto_reconnect_->SignalStartConnection.connect(this, - &Login::StartConnection); - auto_reconnect_->SignalTimerStartStop.connect( - this, - &Login::OnAutoReconnectTimerChange); - SignalClientStateChange.connect(auto_reconnect_.get(), - &AutoReconnect::OnClientStateChange); - SignalIdleChange.connect(auto_reconnect_.get(), - &AutoReconnect::set_idle); - SignalPowerSuspended.connect(auto_reconnect_.get(), - &AutoReconnect::OnPowerSuspend); + + if (network_status) { + network_status->SignalNetworkStateDetected.connect( + this, &Login::OnNetworkStateDetected); + auto_reconnect_.reset(new AutoReconnect(parent_, network_status)); + auto_reconnect_->SignalStartConnection.connect(this, + &Login::StartConnection); + auto_reconnect_->SignalTimerStartStop.connect( + this, + &Login::OnAutoReconnectTimerChange); + SignalClientStateChange.connect(auto_reconnect_.get(), + &AutoReconnect::OnClientStateChange); + SignalIdleChange.connect(auto_reconnect_.get(), + &AutoReconnect::set_idle); + SignalPowerSuspended.connect(auto_reconnect_.get(), + &AutoReconnect::OnPowerSuspend); + } } // Defined so that the destructors are executed here (and the corresponding @@ -190,7 +193,7 @@ void Login::OnClientStateChange(buzz::XmppEngine::State state) { void Login::HandleClientStateChange(ConnectionState new_state) { // Do we need to transition between the retrying and closed states? - if (auto_reconnect_->is_retrying()) { + if (auto_reconnect_.get() && auto_reconnect_->is_retrying()) { if (new_state == STATE_CLOSED) { new_state = STATE_RETRYING; } diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 9b2c3f2..3dbf1d7 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -45,8 +45,8 @@ ProfileSyncService::ProfileSyncService(Profile* profile) backend_initialized_(false), expecting_first_run_auth_needed_event_(false), is_auth_in_progress_(false), - unrecoverable_error_detected_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(wizard_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(wizard_(this)), + unrecoverable_error_detected_(false) { change_processor_.reset(new ChangeProcessor(this)); } @@ -72,7 +72,7 @@ void ProfileSyncService::Initialize() { void ProfileSyncService::InitSettings() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - // Override the sync server URL from the command-line, if sync server + // Override the sync server URL from the command-line, if sync server // command-line argument exists. if (command_line.HasSwitch(switches::kSyncServiceURL)) { std::wstring value(command_line.GetSwitchValue(switches::kSyncServiceURL)); @@ -152,7 +152,7 @@ void ProfileSyncService::Shutdown(bool sync_disabled) { } void ProfileSyncService::EnableForUser() { - if (wizard_.IsVisible()) { + if (WizardIsVisible()) { // TODO(timsteele): Focus wizard. return; } @@ -163,7 +163,7 @@ void ProfileSyncService::EnableForUser() { } void ProfileSyncService::DisableForUser() { - if (wizard_.IsVisible()) { + if (WizardIsVisible()) { // TODO(timsteele): Focus wizard. return; } @@ -212,6 +212,7 @@ void ProfileSyncService::UpdateLastSyncedTime() { void ProfileSyncService::OnUnrecoverableError() { unrecoverable_error_detected_ = true; change_processor_->Stop(); + if (SetupInProgress()) wizard_.Step(SyncSetupWizard::FATAL_ERROR); FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); @@ -240,7 +241,7 @@ void ProfileSyncService::OnAuthError() { // Protect against the in-your-face dialogs that pop out of nowhere. // Require the user to click somewhere to run the setup wizard in the case // of a steady-state auth failure. - if (wizard_.IsVisible() || expecting_first_run_auth_needed_event_) { + if (WizardIsVisible() || expecting_first_run_auth_needed_event_) { wizard_.Step(AUTH_ERROR_NONE == backend_->GetAuthErrorState() ? SyncSetupWizard::GAIA_SUCCESS : SyncSetupWizard::GAIA_LOGIN); } @@ -250,7 +251,7 @@ void ProfileSyncService::OnAuthError() { expecting_first_run_auth_needed_event_ = false; } - if (!wizard_.IsVisible()) { + if (!WizardIsVisible()) { auth_error_time_ == base::TimeTicks::Now(); } @@ -266,7 +267,7 @@ void ProfileSyncService::OnAuthError() { } void ProfileSyncService::ShowLoginDialog() { - if (wizard_.IsVisible()) + if (WizardIsVisible()) return; if (!auth_error_time_.is_null()) { @@ -275,8 +276,9 @@ void ProfileSyncService::ShowLoginDialog() { auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. } - if (last_auth_error_ != AUTH_ERROR_NONE) + if (last_auth_error_ != AUTH_ERROR_NONE) { wizard_.Step(SyncSetupWizard::GAIA_LOGIN); + } } SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 011f55f..fab7ea5 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -144,7 +144,9 @@ class ProfileSyncService : public NotificationObserver, bool SetupInProgress() const { return !HasSyncSetupCompleted() && WizardIsVisible(); } - bool WizardIsVisible() const { return wizard_.IsVisible(); } + bool WizardIsVisible() const { + return wizard_.IsVisible(); + } void ShowLoginDialog(); // Pretty-printed strings for a given StatusSummary. @@ -298,13 +300,13 @@ class ProfileSyncService : public NotificationObserver, // As its name suggests, this should NOT be used for anything other than UI. bool is_auth_in_progress_; + SyncSetupWizard wizard_; + // True if an unrecoverable error (e.g. violation of an assumed invariant) // occurred during syncer operation. This value should be checked before // doing any work that might corrupt things further. bool unrecoverable_error_detected_; - SyncSetupWizard wizard_; - ObserverList<Observer> observers_; DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |