| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 << "HasConflictingUpdates applies to all ModelSafeGroups"; | 226 << "HasConflictingUpdates applies to all ModelSafeGroups"; |
| 227 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 227 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
| 228 per_model_group_.begin(); | 228 per_model_group_.begin(); |
| 229 for (; it != per_model_group_.end(); ++it) { | 229 for (; it != per_model_group_.end(); ++it) { |
| 230 if (it->second->update_progress.HasConflictingUpdates()) | 230 if (it->second->update_progress.HasConflictingUpdates()) |
| 231 return true; | 231 return true; |
| 232 } | 232 } |
| 233 return false; | 233 return false; |
| 234 } | 234 } |
| 235 | 235 |
| 236 int StatusController::TotalNumBlockingConflictingItems() const { | 236 int StatusController::TotalNumSimpleConflictingItems() const { |
| 237 DCHECK(!group_restriction_in_effect_) | 237 DCHECK(!group_restriction_in_effect_) |
| 238 << "TotalNumBlockingConflictingItems applies to all ModelSafeGroups"; | 238 << "TotalNumSimpleConflictingItems applies to all ModelSafeGroups"; |
| 239 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 239 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
| 240 per_model_group_.begin(); | 240 per_model_group_.begin(); |
| 241 int sum = 0; | 241 int sum = 0; |
| 242 for (; it != per_model_group_.end(); ++it) { | 242 for (; it != per_model_group_.end(); ++it) { |
| 243 sum += it->second->conflict_progress.ConflictingItemsSize(); | 243 sum += it->second->conflict_progress.SimpleConflictingItemsSize(); |
| 244 } | 244 } |
| 245 return sum; | 245 return sum; |
| 246 } | 246 } |
| 247 | 247 |
| 248 int StatusController::TotalNumConflictingItems() const { | 248 int StatusController::TotalNumConflictingItems() const { |
| 249 DCHECK(!group_restriction_in_effect_) | 249 DCHECK(!group_restriction_in_effect_) |
| 250 << "TotalNumConflictingItems applies to all ModelSafeGroups"; | 250 << "TotalNumConflictingItems applies to all ModelSafeGroups"; |
| 251 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = | 251 std::map<ModelSafeGroup, PerModelSafeGroupState*>::const_iterator it = |
| 252 per_model_group_.begin(); | 252 per_model_group_.begin(); |
| 253 int sum = 0; | 253 int sum = 0; |
| 254 for (; it != per_model_group_.end(); ++it) { | 254 for (; it != per_model_group_.end(); ++it) { |
| 255 sum += it->second->conflict_progress.ConflictingItemsSize(); | 255 sum += it->second->conflict_progress.SimpleConflictingItemsSize(); |
| 256 sum += it->second->conflict_progress.NonblockingConflictingItemsSize(); | 256 sum += it->second->conflict_progress.EncryptionConflictingItemsSize(); |
| 257 sum += it->second->conflict_progress.HierarchyConflictingItemsSize(); |
| 258 sum += it->second->conflict_progress.ServerConflictingItemsSize(); |
| 257 } | 259 } |
| 258 return sum; | 260 return sum; |
| 259 } | 261 } |
| 260 | 262 |
| 261 bool StatusController::ServerSaysNothingMoreToDownload() const { | 263 bool StatusController::ServerSaysNothingMoreToDownload() const { |
| 262 if (!download_updates_succeeded()) | 264 if (!download_updates_succeeded()) |
| 263 return false; | 265 return false; |
| 264 | 266 |
| 265 if (!updates_response().get_updates().has_changes_remaining()) { | 267 if (!updates_response().get_updates().has_changes_remaining()) { |
| 266 NOTREACHED(); // Server should always send changes remaining. | 268 NOTREACHED(); // Server should always send changes remaining. |
| 267 return false; // Avoid looping forever. | 269 return false; // Avoid looping forever. |
| 268 } | 270 } |
| 269 // Changes remaining is an estimate, but if it's estimated to be | 271 // Changes remaining is an estimate, but if it's estimated to be |
| 270 // zero, that's firm and we don't have to ask again. | 272 // zero, that's firm and we don't have to ask again. |
| 271 return updates_response().get_updates().changes_remaining() == 0; | 273 return updates_response().get_updates().changes_remaining() == 0; |
| 272 } | 274 } |
| 273 | 275 |
| 274 void StatusController::set_debug_info_sent() { | 276 void StatusController::set_debug_info_sent() { |
| 275 shared_.control_params.debug_info_sent = true; | 277 shared_.control_params.debug_info_sent = true; |
| 276 } | 278 } |
| 277 | 279 |
| 278 bool StatusController::debug_info_sent() const { | 280 bool StatusController::debug_info_sent() const { |
| 279 return shared_.control_params.debug_info_sent; | 281 return shared_.control_params.debug_info_sent; |
| 280 } | 282 } |
| 281 | 283 |
| 282 } // namespace sessions | 284 } // namespace sessions |
| 283 } // namespace browser_sync | 285 } // namespace browser_sync |
| OLD | NEW |