diff options
Diffstat (limited to 'chrome/browser/sync/engine/all_status.cc')
-rw-r--r-- | chrome/browser/sync/engine/all_status.cc | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc index 178fe7f..72e1f6d 100644 --- a/chrome/browser/sync/engine/all_status.cc +++ b/chrome/browser/sync/engine/all_status.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/port.h" -#include "chrome/browser/sync/engine/auth_watcher.h" #include "chrome/browser/sync/engine/net/server_connection_manager.h" #include "chrome/browser/sync/engine/syncer.h" #include "chrome/browser/sync/engine/syncer_thread.h" @@ -48,11 +47,6 @@ AllStatus::~AllStatus() { delete channel_; } -void AllStatus::WatchConnectionManager(ServerConnectionManager* conn_mgr) { - conn_mgr_hookup_.reset(NewEventListenerHookup(conn_mgr->channel(), this, - &AllStatus::HandleServerConnectionEvent)); -} - void AllStatus::WatchSyncerThread(SyncerThread* syncer_thread) { syncer_thread_hookup_.reset(syncer_thread == NULL ? NULL : syncer_thread->relay_channel()->AddObserver(this)); @@ -99,10 +93,6 @@ AllStatus::Status AllStatus::CalcSyncing(const SyncerEvent &event) const { return status; } -AllStatus::Status AllStatus::CalcSyncing() const { - return CreateBlankStatus(); -} - int AllStatus::CalcStatusChanges(Status* old_status) { int what_changed = 0; @@ -153,34 +143,6 @@ int AllStatus::CalcStatusChanges(Status* old_status) { return what_changed; } -void AllStatus::HandleAuthWatcherEvent(const AuthWatcherEvent& auth_event) { - ScopedStatusLockWithNotify lock(this); - switch (auth_event.what_happened) { - case AuthWatcherEvent::GAIA_AUTH_FAILED: - case AuthWatcherEvent::SERVICE_AUTH_FAILED: - case AuthWatcherEvent::SERVICE_CONNECTION_FAILED: - case AuthWatcherEvent::AUTHENTICATION_ATTEMPT_START: - status_.authenticated = false; - break; - case AuthWatcherEvent::AUTH_SUCCEEDED: - // If we've already calculated that the server is reachable, since we've - // successfully authenticated, we can be confident that the server is up. - if (status_.server_reachable) - status_.server_up = true; - - if (!status_.authenticated) { - status_.authenticated = true; - status_ = CalcSyncing(); - } else { - lock.set_notify_plan(DONT_NOTIFY); - } - break; - default: - lock.set_notify_plan(DONT_NOTIFY); - break; - } -} - void AllStatus::HandleChannelEvent(const SyncerEvent& event) { ScopedStatusLockWithNotify lock(this); switch (event.what_happened) { @@ -222,6 +184,15 @@ void AllStatus::HandleServerConnectionEvent( ScopedStatusLockWithNotify lock(this); status_.server_up = IsGoodReplyFromServer(event.connection_code); status_.server_reachable = event.server_reachable; + + if (event.connection_code == HttpResponse::SERVER_CONNECTION_OK) { + if (!status_.authenticated) { + status_ = CreateBlankStatus(); + } + status_.authenticated = true; + } else { + status_.authenticated = false; + } } } |