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