| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 SyncSessionSnapshot SyncSession::TakeSnapshot() const { | 89 SyncSessionSnapshot SyncSession::TakeSnapshot() const { |
| 90 syncable::ScopedDirLookup dir(context_->directory_manager(), | 90 syncable::ScopedDirLookup dir(context_->directory_manager(), |
| 91 context_->account_name()); | 91 context_->account_name()); |
| 92 if (!dir.good()) | 92 if (!dir.good()) |
| 93 LOG(ERROR) << "Scoped dir lookup failed!"; | 93 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 94 | 94 |
| 95 bool is_share_useable = true; | 95 bool is_share_useable = true; |
| 96 syncable::ModelTypeBitSet initial_sync_ended; | 96 syncable::ModelTypeBitSet initial_sync_ended; |
| 97 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 97 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 98 for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) { | 98 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| 99 i < syncable::MODEL_TYPE_COUNT; ++i) { |
| 99 syncable::ModelType type(syncable::ModelTypeFromInt(i)); | 100 syncable::ModelType type(syncable::ModelTypeFromInt(i)); |
| 100 if (routing_info_.count(type) != 0) { | 101 if (routing_info_.count(type) != 0) { |
| 101 if (dir->initial_sync_ended_for_type(type)) | 102 if (dir->initial_sync_ended_for_type(type)) |
| 102 initial_sync_ended.set(type); | 103 initial_sync_ended.set(type); |
| 103 else | 104 else |
| 104 is_share_useable = false; | 105 is_share_useable = false; |
| 105 dir->GetDownloadProgressAsString(type, &download_progress_markers[i]); | |
| 106 } | 106 } |
| 107 dir->GetDownloadProgressAsString(type, &download_progress_markers[i]); |
| 107 } | 108 } |
| 108 | 109 |
| 109 return SyncSessionSnapshot( | 110 return SyncSessionSnapshot( |
| 110 status_controller_->syncer_status(), | 111 status_controller_->syncer_status(), |
| 111 status_controller_->error(), | 112 status_controller_->error(), |
| 112 status_controller_->num_server_changes_remaining(), | 113 status_controller_->num_server_changes_remaining(), |
| 113 is_share_useable, | 114 is_share_useable, |
| 114 initial_sync_ended, | 115 initial_sync_ended, |
| 115 download_progress_markers, | 116 download_progress_markers, |
| 116 HasMoreToSync(), | 117 HasMoreToSync(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 137 return ((status->commit_ids().size() < status->unsynced_handles().size()) && | 138 return ((status->commit_ids().size() < status->unsynced_handles().size()) && |
| 138 status->syncer_status().num_successful_commits > 0) || | 139 status->syncer_status().num_successful_commits > 0) || |
| 139 status->conflict_sets_built() || | 140 status->conflict_sets_built() || |
| 140 status->conflicts_resolved(); | 141 status->conflicts_resolved(); |
| 141 // Or, we have conflicting updates, but we're making progress on | 142 // Or, we have conflicting updates, but we're making progress on |
| 142 // resolving them... | 143 // resolving them... |
| 143 } | 144 } |
| 144 | 145 |
| 145 } // namespace sessions | 146 } // namespace sessions |
| 146 } // namespace browser_sync | 147 } // namespace browser_sync |
| OLD | NEW |