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 #include "sync/protocol/proto_enum_conversions.h" | 10 #include "sync/protocol/proto_enum_conversions.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 value->SetInteger("numUpdatesDownloadedTotal", | 63 value->SetInteger("numUpdatesDownloadedTotal", |
64 model_neutral_state_.num_updates_downloaded_total); | 64 model_neutral_state_.num_updates_downloaded_total); |
65 value->SetInteger("numTombstoneUpdatesDownloadedTotal", | 65 value->SetInteger("numTombstoneUpdatesDownloadedTotal", |
66 model_neutral_state_.num_tombstone_updates_downloaded_total); | 66 model_neutral_state_.num_tombstone_updates_downloaded_total); |
67 value->SetInteger("numReflectedUpdatesDownloadedTotal", | 67 value->SetInteger("numReflectedUpdatesDownloadedTotal", |
68 model_neutral_state_.num_reflected_updates_downloaded_total); | 68 model_neutral_state_.num_reflected_updates_downloaded_total); |
69 value->SetInteger("numLocalOverwrites", | 69 value->SetInteger("numLocalOverwrites", |
70 model_neutral_state_.num_local_overwrites); | 70 model_neutral_state_.num_local_overwrites); |
71 value->SetInteger("numServerOverwrites", | 71 value->SetInteger("numServerOverwrites", |
72 model_neutral_state_.num_server_overwrites); | 72 model_neutral_state_.num_server_overwrites); |
73 value->SetInteger( | |
74 "numServerChangesRemaining", | |
75 static_cast<int>(model_neutral_state_.num_server_changes_remaining)); | |
76 value->Set("downloadProgressMarkers", | 73 value->Set("downloadProgressMarkers", |
77 ProgressMarkerMapToValue(download_progress_markers_).release()); | 74 ProgressMarkerMapToValue(download_progress_markers_).release()); |
78 value->SetBoolean("isSilenced", is_silenced_); | 75 value->SetBoolean("isSilenced", is_silenced_); |
79 // We don't care too much if we lose precision here, also. | 76 // We don't care too much if we lose precision here, also. |
80 value->SetInteger("numEncryptionConflicts", | 77 value->SetInteger("numEncryptionConflicts", |
81 num_encryption_conflicts_); | 78 num_encryption_conflicts_); |
82 value->SetInteger("numHierarchyConflicts", | 79 value->SetInteger("numHierarchyConflicts", |
83 num_hierarchy_conflicts_); | 80 num_hierarchy_conflicts_); |
84 value->SetInteger("numServerConflicts", | 81 value->SetInteger("numServerConflicts", |
85 num_server_conflicts_); | 82 num_server_conflicts_); |
(...skipping 19 matching lines...) Expand all Loading... |
105 | 102 |
106 std::string SyncSessionSnapshot::ToString() const { | 103 std::string SyncSessionSnapshot::ToString() const { |
107 scoped_ptr<base::DictionaryValue> value(ToValue()); | 104 scoped_ptr<base::DictionaryValue> value(ToValue()); |
108 std::string json; | 105 std::string json; |
109 base::JSONWriter::WriteWithOptions(value.get(), | 106 base::JSONWriter::WriteWithOptions(value.get(), |
110 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 107 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
111 &json); | 108 &json); |
112 return json; | 109 return json; |
113 } | 110 } |
114 | 111 |
115 int64 SyncSessionSnapshot::num_server_changes_remaining() const { | |
116 return model_neutral_state().num_server_changes_remaining; | |
117 } | |
118 | |
119 const ProgressMarkerMap& | 112 const ProgressMarkerMap& |
120 SyncSessionSnapshot::download_progress_markers() const { | 113 SyncSessionSnapshot::download_progress_markers() const { |
121 return download_progress_markers_; | 114 return download_progress_markers_; |
122 } | 115 } |
123 | 116 |
124 bool SyncSessionSnapshot::is_silenced() const { | 117 bool SyncSessionSnapshot::is_silenced() const { |
125 return is_silenced_; | 118 return is_silenced_; |
126 } | 119 } |
127 | 120 |
128 int SyncSessionSnapshot::num_encryption_conflicts() const { | 121 int SyncSessionSnapshot::num_encryption_conflicts() const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return num_to_delete_entries_by_type_; | 155 return num_to_delete_entries_by_type_; |
163 } | 156 } |
164 | 157 |
165 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource | 158 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource |
166 SyncSessionSnapshot::legacy_updates_source() const { | 159 SyncSessionSnapshot::legacy_updates_source() const { |
167 return legacy_updates_source_; | 160 return legacy_updates_source_; |
168 } | 161 } |
169 | 162 |
170 } // namespace sessions | 163 } // namespace sessions |
171 } // namespace syncer | 164 } // namespace syncer |
OLD | NEW |