| OLD | NEW |
| 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 // StatusController handles all counter and status related number crunching and | 5 // StatusController handles all counter and status related number crunching and |
| 6 // state tracking on behalf of a SyncSession. It 'controls' the model data | 6 // state tracking on behalf of a SyncSession. It 'controls' the model data |
| 7 // defined in session_state.h. The most important feature of StatusController | 7 // defined in session_state.h. The most important feature of StatusController |
| 8 // is the ScopedModelSafetyRestriction. When one of these is active, the | 8 // is the ScopedModelSafetyRestriction. When one of these is active, the |
| 9 // underlying data set exposed via accessors is swapped out to the appropriate | 9 // underlying data set exposed via accessors is swapped out to the appropriate |
| 10 // set for the restricted ModelSafeGroup behind the scenes. For example, if | 10 // set for the restricted ModelSafeGroup behind the scenes. For example, if |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Control parameters for sync cycles. | 140 // Control parameters for sync cycles. |
| 141 bool conflicts_resolved() const { | 141 bool conflicts_resolved() const { |
| 142 return shared_.control_params.conflicts_resolved; | 142 return shared_.control_params.conflicts_resolved; |
| 143 } | 143 } |
| 144 bool did_commit_items() const { | 144 bool did_commit_items() const { |
| 145 return shared_.control_params.items_committed; | 145 return shared_.control_params.items_committed; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // If a GetUpdates for any data type resulted in downloading an update that | 148 // If a GetUpdates for any data type resulted in downloading an update that |
| 149 // is in conflict, this method returns true. | 149 // is in conflict, this method returns true. |
| 150 // Note: this includes non-blocking conflicts. | 150 // Note: this includes unresolvable conflicts. |
| 151 bool HasConflictingUpdates() const; | 151 bool HasConflictingUpdates() const; |
| 152 | 152 |
| 153 // Aggregate sum of ConflictingItemSize() over all ConflictProgress objects | 153 // Aggregate sum of SimpleConflictingItemSize() over all ConflictProgress |
| 154 // (one for each ModelSafeGroup currently in-use). | 154 // objects (one for each ModelSafeGroup currently in-use). |
| 155 // Note: this does not include non-blocking conflicts. | 155 // Note: this does not include unresolvable conflicts. |
| 156 int TotalNumBlockingConflictingItems() const; | 156 int TotalNumSimpleConflictingItems() const; |
| 157 | 157 |
| 158 // Aggregate sum of ConflictingItemSize() and NonblockingConflictingItemsSize | 158 // Aggregate sum of SimpleConflictingItemSize() and other |
| 159 // over all ConflictProgress objects (one for each ModelSafeGroup currently | 159 // ${Type}ConflictingItemSize() methods over all ConflictProgress objects (one |
| 160 // in-use). | 160 // for each ModelSafeGroup currently in-use). |
| 161 int TotalNumConflictingItems() const; | 161 int TotalNumConflictingItems() const; |
| 162 | 162 |
| 163 // Returns the number of updates received from the sync server. | 163 // Returns the number of updates received from the sync server. |
| 164 int64 CountUpdates() const; | 164 int64 CountUpdates() const; |
| 165 | 165 |
| 166 // Returns true iff any of the commit ids added during this session are | 166 // Returns true iff any of the commit ids added during this session are |
| 167 // bookmark related, and the bookmark group restriction is in effect. | 167 // bookmark related, and the bookmark group restriction is in effect. |
| 168 bool HasBookmarkCommitActivity() const { | 168 bool HasBookmarkCommitActivity() const { |
| 169 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) && | 169 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) && |
| 170 shared_.commit_set.HasBookmarkCommitId(); | 170 shared_.commit_set.HasBookmarkCommitId(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 288 } |
| 289 private: | 289 private: |
| 290 StatusController* status_; | 290 StatusController* status_; |
| 291 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 291 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 297 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
| OLD | NEW |