Index: chrome/browser/sync/engine/all_status.cc |
=================================================================== |
--- chrome/browser/sync/engine/all_status.cc (revision 58702) |
+++ chrome/browser/sync/engine/all_status.cc (working copy) |
@@ -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 @@ |
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 @@ |
return status; |
} |
-AllStatus::Status AllStatus::CalcSyncing() const { |
- return CreateBlankStatus(); |
-} |
- |
int AllStatus::CalcStatusChanges(Status* old_status) { |
int what_changed = 0; |
@@ -153,34 +143,6 @@ |
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 @@ |
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; |
+ } |
} |
} |