| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // Returns true iff any of the commit ids added during this session are | 168 // Returns true iff any of the commit ids added during this session are |
| 169 // bookmark related, and the bookmark group restriction is in effect. | 169 // bookmark related, and the bookmark group restriction is in effect. |
| 170 bool HasBookmarkCommitActivity() const { | 170 bool HasBookmarkCommitActivity() const { |
| 171 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) && | 171 return ActiveGroupRestrictionIncludesModel(syncable::BOOKMARKS) && |
| 172 shared_.commit_set.HasBookmarkCommitId(); | 172 shared_.commit_set.HasBookmarkCommitId(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Returns true if the last download_updates_command received a valid | 175 // Returns true if the last download_updates_command received a valid |
| 176 // server response. | 176 // server response. |
| 177 bool download_updates_succeeded() const { | 177 bool download_updates_succeeded() const { |
| 178 return updates_response().has_get_updates(); | 178 return shared_.error.value().last_download_updates_result |
| 179 == SYNCER_OK; |
| 179 } | 180 } |
| 180 | 181 |
| 181 // Returns true if the last updates response indicated that we were fully | 182 // Returns true if the last updates response indicated that we were fully |
| 182 // up to date. This is subtle: if it's false, it could either mean that | 183 // up to date. This is subtle: if it's false, it could either mean that |
| 183 // the server said there WAS more to download, or it could mean that we | 184 // the server said there WAS more to download, or it could mean that we |
| 184 // were unable to reach the server. If we didn't request every enabled | 185 // were unable to reach the server. If we didn't request every enabled |
| 185 // datatype, then we can't say for sure that there's nothing left to | 186 // datatype, then we can't say for sure that there's nothing left to |
| 186 // download: in that case, this also returns false. | 187 // download: in that case, this also returns false. |
| 187 bool ServerSaysNothingMoreToDownload() const; | 188 bool ServerSaysNothingMoreToDownload() const; |
| 188 | 189 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 290 } |
| 290 private: | 291 private: |
| 291 StatusController* status_; | 292 StatusController* status_; |
| 292 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 293 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
| 293 }; | 294 }; |
| 294 | 295 |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 | 298 |
| 298 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 299 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
| OLD | NEW |