| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void StatusController::set_invalid_store(bool invalid_store) { | 98 void StatusController::set_invalid_store(bool invalid_store) { |
| 99 if (shared_.syncer_status.value().invalid_store != invalid_store) | 99 if (shared_.syncer_status.value().invalid_store != invalid_store) |
| 100 shared_.syncer_status.mutate()->invalid_store = invalid_store; | 100 shared_.syncer_status.mutate()->invalid_store = invalid_store; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void StatusController::set_syncer_stuck(bool syncer_stuck) { | 103 void StatusController::set_syncer_stuck(bool syncer_stuck) { |
| 104 if (shared_.syncer_status.value().syncer_stuck != syncer_stuck) | 104 if (shared_.syncer_status.value().syncer_stuck != syncer_stuck) |
| 105 shared_.syncer_status.mutate()->syncer_stuck = syncer_stuck; | 105 shared_.syncer_status.mutate()->syncer_stuck = syncer_stuck; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void StatusController::set_syncing(bool syncing) { | 108 void StatusController::SetSyncInProgressAndUpdateStartTime( |
| 109 if (shared_.syncer_status.value().syncing != syncing) | 109 bool sync_in_progress) { |
| 110 shared_.syncer_status.mutate()->syncing = syncing; | 110 if (shared_.syncer_status.value().sync_in_progress != sync_in_progress) { |
| 111 shared_.syncer_status.mutate()->sync_in_progress = sync_in_progress; |
| 112 sync_start_time_ = base::Time::Now(); |
| 113 } |
| 111 } | 114 } |
| 112 | 115 |
| 113 void StatusController::set_num_successful_bookmark_commits(int value) { | 116 void StatusController::set_num_successful_bookmark_commits(int value) { |
| 114 if (shared_.syncer_status.value().num_successful_bookmark_commits != value) | 117 if (shared_.syncer_status.value().num_successful_bookmark_commits != value) |
| 115 shared_.syncer_status.mutate()->num_successful_bookmark_commits = value; | 118 shared_.syncer_status.mutate()->num_successful_bookmark_commits = value; |
| 116 } | 119 } |
| 117 | 120 |
| 118 void StatusController::set_unsynced_handles( | 121 void StatusController::set_unsynced_handles( |
| 119 const std::vector<int64>& unsynced_handles) { | 122 const std::vector<int64>& unsynced_handles) { |
| 120 if (!operator==(unsynced_handles, shared_.unsynced_handles.value())) { | 123 if (!operator==(unsynced_handles, shared_.unsynced_handles.value())) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 NOTREACHED(); // Server should always send changes remaining. | 231 NOTREACHED(); // Server should always send changes remaining. |
| 229 return false; // Avoid looping forever. | 232 return false; // Avoid looping forever. |
| 230 } | 233 } |
| 231 // Changes remaining is an estimate, but if it's estimated to be | 234 // Changes remaining is an estimate, but if it's estimated to be |
| 232 // zero, that's firm and we don't have to ask again. | 235 // zero, that's firm and we don't have to ask again. |
| 233 return updates_response().get_updates().changes_remaining() == 0; | 236 return updates_response().get_updates().changes_remaining() == 0; |
| 234 } | 237 } |
| 235 | 238 |
| 236 } // namespace sessions | 239 } // namespace sessions |
| 237 } // namespace browser_sync | 240 } // namespace browser_sync |
| OLD | NEW |