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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 bool SyncSession::HasMoreToSync() const { | 136 bool SyncSession::HasMoreToSync() const { |
137 const StatusController* status = status_controller_.get(); | 137 const StatusController* status = status_controller_.get(); |
138 return ((status->commit_ids().size() < status->unsynced_handles().size()) && | 138 return ((status->commit_ids().size() < status->unsynced_handles().size()) && |
139 status->syncer_status().num_successful_commits > 0) || | 139 status->syncer_status().num_successful_commits > 0) || |
140 status->conflict_sets_built() || | 140 status->conflict_sets_built() || |
141 status->conflicts_resolved(); | 141 status->conflicts_resolved(); |
142 // Or, we have conflicting updates, but we're making progress on | 142 // Or, we have conflicting updates, but we're making progress on |
143 // resolving them... | 143 // resolving them... |
144 } | 144 } |
| 145 |
| 146 bool SyncSession::FailedToMakeProgress() const { |
| 147 const StatusController* status = status_controller_.get(); |
| 148 |
| 149 // In the future, we should be able to report more about the cause of the |
| 150 // errors and return an enum value. Right now that's not possible because |
| 151 // our error detection is based on state that can tell us only that an |
| 152 // error exists, but not much else. |
| 153 |
| 154 // We were unable to download all updates, for some unknown reason. |
| 155 if (status->num_server_changes_remaining() > 0) |
| 156 return true; |
| 157 |
| 158 // There are many possible causes for this. |
| 159 if (status->error().consecutive_errors > 0) |
| 160 return true; |
| 161 |
| 162 return false; |
| 163 } |
145 | 164 |
146 } // namespace sessions | 165 } // namespace sessions |
147 } // namespace browser_sync | 166 } // namespace browser_sync |
OLD | NEW |