| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.ConflictingItemsSize(); |
| 286 sum += it->second->conflict_progress.NonblockingConflictingItemsSize(); | 286 sum += it->second->conflict_progress.NonblockingConflictingItemsSize(); |
| 287 sum += it->second->conflict_progress.HierarchyConflictingItemsSize(); |
| 287 } | 288 } |
| 288 return sum; | 289 return sum; |
| 289 } | 290 } |
| 290 | 291 |
| 291 bool StatusController::ServerSaysNothingMoreToDownload() const { | 292 bool StatusController::ServerSaysNothingMoreToDownload() const { |
| 292 if (!download_updates_succeeded()) | 293 if (!download_updates_succeeded()) |
| 293 return false; | 294 return false; |
| 294 | 295 |
| 295 if (!updates_response().get_updates().has_changes_remaining()) { | 296 if (!updates_response().get_updates().has_changes_remaining()) { |
| 296 NOTREACHED(); // Server should always send changes remaining. | 297 NOTREACHED(); // Server should always send changes remaining. |
| 297 return false; // Avoid looping forever. | 298 return false; // Avoid looping forever. |
| 298 } | 299 } |
| 299 // Changes remaining is an estimate, but if it's estimated to be | 300 // 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. | 301 // zero, that's firm and we don't have to ask again. |
| 301 return updates_response().get_updates().changes_remaining() == 0; | 302 return updates_response().get_updates().changes_remaining() == 0; |
| 302 } | 303 } |
| 303 | 304 |
| 304 void StatusController::set_debug_info_sent() { | 305 void StatusController::set_debug_info_sent() { |
| 305 shared_.control_params.debug_info_sent = true; | 306 shared_.control_params.debug_info_sent = true; |
| 306 } | 307 } |
| 307 | 308 |
| 308 bool StatusController::debug_info_sent() const { | 309 bool StatusController::debug_info_sent() const { |
| 309 return shared_.control_params.debug_info_sent; | 310 return shared_.control_params.debug_info_sent; |
| 310 } | 311 } |
| 311 | 312 |
| 312 } // namespace sessions | 313 } // namespace sessions |
| 313 } // namespace browser_sync | 314 } // namespace browser_sync |
| OLD | NEW |