| 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 "sync/internal_api/public/sessions/sync_session_snapshot.h" | 5 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| 11 namespace syncer { | 11 namespace syncer { |
| 12 namespace sessions { | 12 namespace sessions { |
| 13 | 13 |
| 14 SyncSessionSnapshot::SyncSessionSnapshot() | 14 SyncSessionSnapshot::SyncSessionSnapshot() |
| 15 : is_share_usable_(false), | 15 : is_share_usable_(false), |
| 16 has_more_to_sync_(false), | 16 has_more_to_sync_(false), |
| 17 is_silenced_(false), | 17 is_silenced_(false), |
| 18 num_encryption_conflicts_(0), | 18 num_encryption_conflicts_(0), |
| 19 num_hierarchy_conflicts_(0), | 19 num_hierarchy_conflicts_(0), |
| 20 num_simple_conflicts_(0), | 20 num_simple_conflicts_(0), |
| 21 num_server_conflicts_(0), | 21 num_server_conflicts_(0), |
| 22 notifications_enabled_(false), | 22 notifications_enabled_(false), |
| 23 num_entries_(0), | 23 num_entries_(0), |
| 24 retry_scheduled_(false) { | 24 retry_scheduled_(false) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 SyncSessionSnapshot::SyncSessionSnapshot( | 27 SyncSessionSnapshot::SyncSessionSnapshot( |
| 28 const ModelNeutralState& model_neutral_state, | 28 const ModelNeutralState& model_neutral_state, |
| 29 bool is_share_usable, | 29 bool is_share_usable, |
| 30 syncer::ModelTypeSet initial_sync_ended, | 30 ModelTypeSet initial_sync_ended, |
| 31 const syncer::ModelTypePayloadMap& download_progress_markers, | 31 const ModelTypePayloadMap& download_progress_markers, |
| 32 bool more_to_sync, | 32 bool more_to_sync, |
| 33 bool is_silenced, | 33 bool is_silenced, |
| 34 int num_encryption_conflicts, | 34 int num_encryption_conflicts, |
| 35 int num_hierarchy_conflicts, | 35 int num_hierarchy_conflicts, |
| 36 int num_simple_conflicts, | 36 int num_simple_conflicts, |
| 37 int num_server_conflicts, | 37 int num_server_conflicts, |
| 38 const SyncSourceInfo& source, | 38 const SyncSourceInfo& source, |
| 39 bool notifications_enabled, | 39 bool notifications_enabled, |
| 40 size_t num_entries, | 40 size_t num_entries, |
| 41 base::Time sync_start_time, | 41 base::Time sync_start_time, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 model_neutral_state_.num_reflected_updates_downloaded_total); | 73 model_neutral_state_.num_reflected_updates_downloaded_total); |
| 74 value->SetInteger("numLocalOverwrites", | 74 value->SetInteger("numLocalOverwrites", |
| 75 model_neutral_state_.num_local_overwrites); | 75 model_neutral_state_.num_local_overwrites); |
| 76 value->SetInteger("numServerOverwrites", | 76 value->SetInteger("numServerOverwrites", |
| 77 model_neutral_state_.num_server_overwrites); | 77 model_neutral_state_.num_server_overwrites); |
| 78 value->SetInteger( | 78 value->SetInteger( |
| 79 "numServerChangesRemaining", | 79 "numServerChangesRemaining", |
| 80 static_cast<int>(model_neutral_state_.num_server_changes_remaining)); | 80 static_cast<int>(model_neutral_state_.num_server_changes_remaining)); |
| 81 value->SetBoolean("isShareUsable", is_share_usable_); | 81 value->SetBoolean("isShareUsable", is_share_usable_); |
| 82 value->Set("initialSyncEnded", | 82 value->Set("initialSyncEnded", |
| 83 syncer::ModelTypeSetToValue(initial_sync_ended_)); | 83 ModelTypeSetToValue(initial_sync_ended_)); |
| 84 value->Set("downloadProgressMarkers", | 84 value->Set("downloadProgressMarkers", |
| 85 syncer::ModelTypePayloadMapToValue(download_progress_markers_)); | 85 ModelTypePayloadMapToValue(download_progress_markers_)); |
| 86 value->SetBoolean("hasMoreToSync", has_more_to_sync_); | 86 value->SetBoolean("hasMoreToSync", has_more_to_sync_); |
| 87 value->SetBoolean("isSilenced", is_silenced_); | 87 value->SetBoolean("isSilenced", is_silenced_); |
| 88 // We don't care too much if we lose precision here, also. | 88 // We don't care too much if we lose precision here, also. |
| 89 value->SetInteger("numEncryptionConflicts", | 89 value->SetInteger("numEncryptionConflicts", |
| 90 num_encryption_conflicts_); | 90 num_encryption_conflicts_); |
| 91 value->SetInteger("numHierarchyConflicts", | 91 value->SetInteger("numHierarchyConflicts", |
| 92 num_hierarchy_conflicts_); | 92 num_hierarchy_conflicts_); |
| 93 value->SetInteger("numSimpleConflicts", | 93 value->SetInteger("numSimpleConflicts", |
| 94 num_simple_conflicts_); | 94 num_simple_conflicts_); |
| 95 value->SetInteger("numServerConflicts", | 95 value->SetInteger("numServerConflicts", |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 int64 SyncSessionSnapshot::num_server_changes_remaining() const { | 112 int64 SyncSessionSnapshot::num_server_changes_remaining() const { |
| 113 return model_neutral_state().num_server_changes_remaining; | 113 return model_neutral_state().num_server_changes_remaining; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool SyncSessionSnapshot::is_share_usable() const { | 116 bool SyncSessionSnapshot::is_share_usable() const { |
| 117 return is_share_usable_; | 117 return is_share_usable_; |
| 118 } | 118 } |
| 119 | 119 |
| 120 syncer::ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { | 120 ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { |
| 121 return initial_sync_ended_; | 121 return initial_sync_ended_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 syncer::ModelTypePayloadMap | 124 ModelTypePayloadMap SyncSessionSnapshot::download_progress_markers() const { |
| 125 SyncSessionSnapshot::download_progress_markers() const { | |
| 126 return download_progress_markers_; | 125 return download_progress_markers_; |
| 127 } | 126 } |
| 128 | 127 |
| 129 bool SyncSessionSnapshot::has_more_to_sync() const { | 128 bool SyncSessionSnapshot::has_more_to_sync() const { |
| 130 return has_more_to_sync_; | 129 return has_more_to_sync_; |
| 131 } | 130 } |
| 132 | 131 |
| 133 bool SyncSessionSnapshot::is_silenced() const { | 132 bool SyncSessionSnapshot::is_silenced() const { |
| 134 return is_silenced_; | 133 return is_silenced_; |
| 135 } | 134 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 165 base::Time SyncSessionSnapshot::sync_start_time() const { | 164 base::Time SyncSessionSnapshot::sync_start_time() const { |
| 166 return sync_start_time_; | 165 return sync_start_time_; |
| 167 } | 166 } |
| 168 | 167 |
| 169 bool SyncSessionSnapshot::retry_scheduled() const { | 168 bool SyncSessionSnapshot::retry_scheduled() const { |
| 170 return retry_scheduled_; | 169 return retry_scheduled_; |
| 171 } | 170 } |
| 172 | 171 |
| 173 } // namespace sessions | 172 } // namespace sessions |
| 174 } // namespace syncer | 173 } // namespace syncer |
| OLD | NEW |