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

Side by Side Diff: chrome/browser/sync/sessions/sync_session.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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/sessions/sync_session.h" 5 #include "chrome/browser/sync/sessions/sync_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h" 10 #include "chrome/browser/sync/syncable/directory_manager.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void SyncSession::ResetTransientState() { 128 void SyncSession::ResetTransientState() {
129 status_controller_.reset(new StatusController(routing_info_)); 129 status_controller_.reset(new StatusController(routing_info_));
130 } 130 }
131 131
132 SyncSessionSnapshot SyncSession::TakeSnapshot() const { 132 SyncSessionSnapshot SyncSession::TakeSnapshot() const {
133 syncable::ScopedDirLookup dir(context_->directory_manager(), 133 syncable::ScopedDirLookup dir(context_->directory_manager(),
134 context_->account_name()); 134 context_->account_name());
135 if (!dir.good()) 135 if (!dir.good())
136 LOG(ERROR) << "Scoped dir lookup failed!"; 136 LOG(ERROR) << "Scoped dir lookup failed!";
137 137
138 bool is_share_useable = true;
139 syncable::ModelTypeSet initial_sync_ended; 138 syncable::ModelTypeSet initial_sync_ended;
140 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; 139 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
141 for (int i = syncable::FIRST_REAL_MODEL_TYPE; 140 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
142 i < syncable::MODEL_TYPE_COUNT; ++i) { 141 i < syncable::MODEL_TYPE_COUNT; ++i) {
143 syncable::ModelType type(syncable::ModelTypeFromInt(i)); 142 syncable::ModelType type(syncable::ModelTypeFromInt(i));
144 if (routing_info_.count(type) != 0) { 143 if (routing_info_.count(type) != 0) {
145 if (dir->initial_sync_ended_for_type(type)) 144 if (dir->initial_sync_ended_for_type(type))
146 initial_sync_ended.Put(type); 145 initial_sync_ended.Put(type);
147 else
148 is_share_useable = false;
149 } 146 }
150 dir->GetDownloadProgressAsString(type, &download_progress_markers[i]); 147 dir->GetDownloadProgressAsString(type, &download_progress_markers[i]);
151 } 148 }
152 149
153 return SyncSessionSnapshot( 150 return SyncSessionSnapshot(
154 status_controller_->syncer_status(), 151 status_controller_->syncer_status(),
155 status_controller_->error(), 152 status_controller_->error(),
156 status_controller_->num_server_changes_remaining(), 153 status_controller_->num_server_changes_remaining(),
157 is_share_useable,
158 initial_sync_ended, 154 initial_sync_ended,
159 download_progress_markers, 155 download_progress_markers,
160 HasMoreToSync(), 156 HasMoreToSync(),
161 delegate_->IsSyncingCurrentlySilenced(), 157 delegate_->IsSyncingCurrentlySilenced(),
162 status_controller_->unsynced_handles().size(), 158 status_controller_->unsynced_handles().size(),
163 status_controller_->TotalNumBlockingConflictingItems(), 159 status_controller_->TotalNumBlockingConflictingItems(),
164 status_controller_->TotalNumConflictingItems(), 160 status_controller_->TotalNumConflictingItems(),
165 status_controller_->did_commit_items(), 161 status_controller_->did_commit_items(),
166 source_, 162 source_,
167 dir->GetEntriesCount(), 163 dir->GetEntriesCount(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 IsError(status_controller_->error().last_post_commit_result); 247 IsError(status_controller_->error().last_post_commit_result);
252 const bool process_commit_response_error = 248 const bool process_commit_response_error =
253 IsError(status_controller_->error().last_process_commit_response_result); 249 IsError(status_controller_->error().last_process_commit_response_result);
254 return !download_updates_error 250 return !download_updates_error
255 && !post_commit_error 251 && !post_commit_error
256 && !process_commit_response_error; 252 && !process_commit_response_error;
257 } 253 }
258 254
259 } // namespace sessions 255 } // namespace sessions
260 } // namespace browser_sync 256 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698