Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3109)

Unified Diff: chrome/browser/sync/engine/all_status.cc

Issue 9323015: [Sync] - In about:sync page display if the first sync after restart has taken place or not. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/all_status.cc
diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc
index 374c0d35a42050e0c8944af7675a2aae7e400956..229e7af5469330584deea5af382b6bdd89d95f8e 100644
--- a/chrome/browser/sync/engine/all_status.cc
+++ b/chrome/browser/sync/engine/all_status.cc
@@ -17,7 +17,7 @@
namespace browser_sync {
AllStatus::AllStatus() {
- status_.summary = sync_api::SyncManager::Status::OFFLINE;
+ status_.summary = sync_api::SyncManager::Status::UNINITIALIZED;
status_.initial_sync_ended = true;
status_.notifications_enabled = false;
status_.cryptographer_ready = false;
@@ -69,6 +69,7 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
// TODO(ncarter): Make this realtime by having the syncer_status
// counter preserve its value across sessions. http://crbug.com/26339
if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
+ ++status.sync_count;
status.updates_received +=
snapshot->syncer_status.num_updates_downloaded_total;
status.tombstone_updates_received +=
@@ -94,19 +95,29 @@ sync_api::SyncManager::Status AllStatus::CalcSyncing(
void AllStatus::CalcStatusChanges() {
const bool unsynced_changes = status_.unsynced_count > 0;
- const bool online = status_.authenticated &&
+ const bool online = status_.sync_count > 0 && status_.authenticated &&
status_.server_reachable && status_.server_up;
+
+ if (status_.syncing) {
rlarocque 2012/02/08 00:07:37 Why not make this a big series of if/else if branc
lipalani1 2012/02/08 19:41:50 Nothing functionally wrong with that. The reason i
+ status_.summary = sync_api::SyncManager::Status::SYNCING;
+ return;
+ }
+
+ // If it is not syncing check if it is online.
if (online) {
- if (status_.syncing)
- status_.summary = sync_api::SyncManager::Status::SYNCING;
- else
- status_.summary = sync_api::SyncManager::Status::READY;
- } else if (!status_.initial_sync_ended) {
+ status_.summary = sync_api::SyncManager::Status::READY;
+ return;
+ }
+
+ // It is not online. Find out more details for the summary.
+ if (!status_.initial_sync_ended) {
status_.summary = sync_api::SyncManager::Status::OFFLINE_UNUSABLE;
} else if (unsynced_changes) {
status_.summary = sync_api::SyncManager::Status::OFFLINE_UNSYNCED;
- } else {
+ } else if (status_.sync_count > 0) {
status_.summary = sync_api::SyncManager::Status::OFFLINE;
+ } else {
+ status_.summary = sync_api::SyncManager::Status::UNINITIALIZED;
}
}

Powered by Google App Engine
This is Rietveld 408576698