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 #include "chrome/browser/sync/sessions/status_controller.h" | 5 #include "chrome/browser/sync/sessions/status_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | 10 #include "chrome/browser/sync/protocol/sync_protocol_error.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 << "HasConflictingUpdates applies to all ModelSafeGroups"; | 256 << "HasConflictingUpdates applies to all ModelSafeGroups"; |
257 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 257 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
258 per_model_group_.begin(); | 258 per_model_group_.begin(); |
259 for (; it != per_model_group_.end(); ++it) { | 259 for (; it != per_model_group_.end(); ++it) { |
260 if (it->second->update_progress.HasConflictingUpdates()) | 260 if (it->second->update_progress.HasConflictingUpdates()) |
261 return true; | 261 return true; |
262 } | 262 } |
263 return false; | 263 return false; |
264 } | 264 } |
265 | 265 |
266 int StatusController::TotalNumBlockingConflictingItems() const { | 266 int StatusController::TotalNumBlockingConflictingItems() const { |
Nicolas Zea
2012/02/02 21:53:41
Rename to TotalNumResolvableConflictingItems?
rlarocque
2012/02/03 22:31:15
Done, sort of: TotalNumSimpleConflctingItems.
| |
267 DCHECK(!group_restriction_in_effect_) | 267 DCHECK(!group_restriction_in_effect_) |
268 << "TotalNumBlockingConflictingItems applies to all ModelSafeGroups"; | 268 << "TotalNumBlockingConflictingItems applies to all ModelSafeGroups"; |
269 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 269 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
270 per_model_group_.begin(); | 270 per_model_group_.begin(); |
271 int sum = 0; | 271 int sum = 0; |
272 for (; it != per_model_group_.end(); ++it) { | 272 for (; it != per_model_group_.end(); ++it) { |
273 sum += it->second->conflict_progress.ConflictingItemsSize(); | 273 sum += it->second->conflict_progress.SimpleConflictingItemsSize(); |
274 } | 274 } |
275 return sum; | 275 return sum; |
276 } | 276 } |
277 | 277 |
278 int StatusController::TotalNumConflictingItems() const { | 278 int StatusController::TotalNumConflictingItems() const { |
279 DCHECK(!group_restriction_in_effect_) | 279 DCHECK(!group_restriction_in_effect_) |
280 << "TotalNumConflictingItems applies to all ModelSafeGroups"; | 280 << "TotalNumConflictingItems applies to all ModelSafeGroups"; |
281 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 281 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
282 per_model_group_.begin(); | 282 per_model_group_.begin(); |
283 int sum = 0; | 283 int sum = 0; |
284 for (; it != per_model_group_.end(); ++it) { | 284 for (; it != per_model_group_.end(); ++it) { |
285 sum += it->second->conflict_progress.ConflictingItemsSize(); | 285 sum += it->second->conflict_progress.SimpleConflictingItemsSize(); |
286 sum += it->second->conflict_progress.NonblockingConflictingItemsSize(); | 286 sum += it->second->conflict_progress.EncryptionConflictingItemsSize(); |
287 sum += it->second->conflict_progress.HierarchyConflictingItemsSize(); | |
288 sum += it->second->conflict_progress.ServerConflictingItemsSize(); | |
287 } | 289 } |
288 return sum; | 290 return sum; |
289 } | 291 } |
290 | 292 |
291 bool StatusController::ServerSaysNothingMoreToDownload() const { | 293 bool StatusController::ServerSaysNothingMoreToDownload() const { |
292 if (!download_updates_succeeded()) | 294 if (!download_updates_succeeded()) |
293 return false; | 295 return false; |
294 | 296 |
295 if (!updates_response().get_updates().has_changes_remaining()) { | 297 if (!updates_response().get_updates().has_changes_remaining()) { |
296 NOTREACHED(); // Server should always send changes remaining. | 298 NOTREACHED(); // Server should always send changes remaining. |
297 return false; // Avoid looping forever. | 299 return false; // Avoid looping forever. |
298 } | 300 } |
299 // Changes remaining is an estimate, but if it's estimated to be | 301 // Changes remaining is an estimate, but if it's estimated to be |
300 // zero, that's firm and we don't have to ask again. | 302 // zero, that's firm and we don't have to ask again. |
301 return updates_response().get_updates().changes_remaining() == 0; | 303 return updates_response().get_updates().changes_remaining() == 0; |
302 } | 304 } |
303 | 305 |
304 void StatusController::set_debug_info_sent() { | 306 void StatusController::set_debug_info_sent() { |
305 shared_.control_params.debug_info_sent = true; | 307 shared_.control_params.debug_info_sent = true; |
306 } | 308 } |
307 | 309 |
308 bool StatusController::debug_info_sent() const { | 310 bool StatusController::debug_info_sent() const { |
309 return shared_.control_params.debug_info_sent; | 311 return shared_.control_params.debug_info_sent; |
310 } | 312 } |
311 | 313 |
312 } // namespace sessions | 314 } // namespace sessions |
313 } // namespace browser_sync | 315 } // namespace browser_sync |
OLD | NEW |