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 shared_.error.value().last_download_updates_result | 178 return updates_response().has_get_updates(); |
179 == SYNCER_OK; | |
180 } | 179 } |
181 | 180 |
182 // Returns true if the last updates response indicated that we were fully | 181 // Returns true if the last updates response indicated that we were fully |
183 // up to date. This is subtle: if it's false, it could either mean that | 182 // up to date. This is subtle: if it's false, it could either mean that |
184 // the server said there WAS more to download, or it could mean that we | 183 // the server said there WAS more to download, or it could mean that we |
185 // were unable to reach the server. If we didn't request every enabled | 184 // were unable to reach the server. If we didn't request every enabled |
186 // datatype, then we can't say for sure that there's nothing left to | 185 // datatype, then we can't say for sure that there's nothing left to |
187 // download: in that case, this also returns false. | 186 // download: in that case, this also returns false. |
188 bool ServerSaysNothingMoreToDownload() const; | 187 bool ServerSaysNothingMoreToDownload() const; |
189 | 188 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 289 } |
291 private: | 290 private: |
292 StatusController* status_; | 291 StatusController* status_; |
293 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 292 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
294 }; | 293 }; |
295 | 294 |
296 } | 295 } |
297 } | 296 } |
298 | 297 |
299 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 298 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
OLD | NEW |