| 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 is_initialized_(false) { | 25 is_initialized_(false) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 SyncSessionSnapshot::SyncSessionSnapshot( | 28 SyncSessionSnapshot::SyncSessionSnapshot( |
| 28 const ModelNeutralState& model_neutral_state, | 29 const ModelNeutralState& model_neutral_state, |
| 29 bool is_share_usable, | 30 bool is_share_usable, |
| 30 ModelTypeSet initial_sync_ended, | 31 ModelTypeSet initial_sync_ended, |
| 31 const ProgressMarkerMap& download_progress_markers, | 32 const ProgressMarkerMap& download_progress_markers, |
| 32 bool more_to_sync, | 33 bool more_to_sync, |
| 33 bool is_silenced, | 34 bool is_silenced, |
| 34 int num_encryption_conflicts, | 35 int num_encryption_conflicts, |
| 35 int num_hierarchy_conflicts, | 36 int num_hierarchy_conflicts, |
| 36 int num_simple_conflicts, | 37 int num_simple_conflicts, |
| 37 int num_server_conflicts, | 38 int num_server_conflicts, |
| 38 const SyncSourceInfo& source, | 39 const SyncSourceInfo& source, |
| 39 bool notifications_enabled, | 40 bool notifications_enabled, |
| 40 size_t num_entries, | 41 size_t num_entries, |
| 41 base::Time sync_start_time) | 42 base::Time sync_start_time, |
| 43 bool retry_scheduled) |
| 42 : model_neutral_state_(model_neutral_state), | 44 : model_neutral_state_(model_neutral_state), |
| 43 is_share_usable_(is_share_usable), | 45 is_share_usable_(is_share_usable), |
| 44 initial_sync_ended_(initial_sync_ended), | 46 initial_sync_ended_(initial_sync_ended), |
| 45 download_progress_markers_(download_progress_markers), | 47 download_progress_markers_(download_progress_markers), |
| 46 has_more_to_sync_(more_to_sync), | 48 has_more_to_sync_(more_to_sync), |
| 47 is_silenced_(is_silenced), | 49 is_silenced_(is_silenced), |
| 48 num_encryption_conflicts_(num_encryption_conflicts), | 50 num_encryption_conflicts_(num_encryption_conflicts), |
| 49 num_hierarchy_conflicts_(num_hierarchy_conflicts), | 51 num_hierarchy_conflicts_(num_hierarchy_conflicts), |
| 50 num_simple_conflicts_(num_simple_conflicts), | 52 num_simple_conflicts_(num_simple_conflicts), |
| 51 num_server_conflicts_(num_server_conflicts), | 53 num_server_conflicts_(num_server_conflicts), |
| 52 source_(source), | 54 source_(source), |
| 53 notifications_enabled_(notifications_enabled), | 55 notifications_enabled_(notifications_enabled), |
| 54 num_entries_(num_entries), | 56 num_entries_(num_entries), |
| 55 sync_start_time_(sync_start_time), | 57 sync_start_time_(sync_start_time), |
| 58 retry_scheduled_(retry_scheduled), |
| 56 is_initialized_(true) { | 59 is_initialized_(true) { |
| 57 } | 60 } |
| 58 | 61 |
| 59 SyncSessionSnapshot::~SyncSessionSnapshot() {} | 62 SyncSessionSnapshot::~SyncSessionSnapshot() {} |
| 60 | 63 |
| 61 DictionaryValue* SyncSessionSnapshot::ToValue() const { | 64 DictionaryValue* SyncSessionSnapshot::ToValue() const { |
| 62 DictionaryValue* value = new DictionaryValue(); | 65 DictionaryValue* value = new DictionaryValue(); |
| 63 value->SetInteger("numSuccessfulCommits", | 66 value->SetInteger("numSuccessfulCommits", |
| 64 model_neutral_state_.num_successful_commits); | 67 model_neutral_state_.num_successful_commits); |
| 65 value->SetInteger("numSuccessfulBookmarkCommits", | 68 value->SetInteger("numSuccessfulBookmarkCommits", |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 161 } |
| 159 | 162 |
| 160 size_t SyncSessionSnapshot::num_entries() const { | 163 size_t SyncSessionSnapshot::num_entries() const { |
| 161 return num_entries_; | 164 return num_entries_; |
| 162 } | 165 } |
| 163 | 166 |
| 164 base::Time SyncSessionSnapshot::sync_start_time() const { | 167 base::Time SyncSessionSnapshot::sync_start_time() const { |
| 165 return sync_start_time_; | 168 return sync_start_time_; |
| 166 } | 169 } |
| 167 | 170 |
| 171 bool SyncSessionSnapshot::retry_scheduled() const { |
| 172 return retry_scheduled_; |
| 173 } |
| 174 |
| 168 bool SyncSessionSnapshot::is_initialized() const { | 175 bool SyncSessionSnapshot::is_initialized() const { |
| 169 return is_initialized_; | 176 return is_initialized_; |
| 170 } | 177 } |
| 171 | 178 |
| 172 } // namespace sessions | 179 } // namespace sessions |
| 173 } // namespace syncer | 180 } // namespace syncer |
| OLD | NEW |