| 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 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 syncer::ModelTypeSet initial_sync_ended, | 31 syncer::ModelTypeSet initial_sync_ended, |
| 31 const syncer::ModelTypePayloadMap& download_progress_markers, | 32 const syncer::ModelTypePayloadMap& 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, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 47 has_more_to_sync_(more_to_sync), | 48 has_more_to_sync_(more_to_sync), |
| 48 is_silenced_(is_silenced), | 49 is_silenced_(is_silenced), |
| 49 num_encryption_conflicts_(num_encryption_conflicts), | 50 num_encryption_conflicts_(num_encryption_conflicts), |
| 50 num_hierarchy_conflicts_(num_hierarchy_conflicts), | 51 num_hierarchy_conflicts_(num_hierarchy_conflicts), |
| 51 num_simple_conflicts_(num_simple_conflicts), | 52 num_simple_conflicts_(num_simple_conflicts), |
| 52 num_server_conflicts_(num_server_conflicts), | 53 num_server_conflicts_(num_server_conflicts), |
| 53 source_(source), | 54 source_(source), |
| 54 notifications_enabled_(notifications_enabled), | 55 notifications_enabled_(notifications_enabled), |
| 55 num_entries_(num_entries), | 56 num_entries_(num_entries), |
| 56 sync_start_time_(sync_start_time), | 57 sync_start_time_(sync_start_time), |
| 57 retry_scheduled_(retry_scheduled) { | 58 retry_scheduled_(retry_scheduled), |
| 59 is_initialized_(true) { |
| 58 } | 60 } |
| 59 | 61 |
| 60 SyncSessionSnapshot::~SyncSessionSnapshot() {} | 62 SyncSessionSnapshot::~SyncSessionSnapshot() {} |
| 61 | 63 |
| 62 DictionaryValue* SyncSessionSnapshot::ToValue() const { | 64 DictionaryValue* SyncSessionSnapshot::ToValue() const { |
| 63 DictionaryValue* value = new DictionaryValue(); | 65 DictionaryValue* value = new DictionaryValue(); |
| 64 value->SetInteger("numSuccessfulCommits", | 66 value->SetInteger("numSuccessfulCommits", |
| 65 model_neutral_state_.num_successful_commits); | 67 model_neutral_state_.num_successful_commits); |
| 66 value->SetInteger("numSuccessfulBookmarkCommits", | 68 value->SetInteger("numSuccessfulBookmarkCommits", |
| 67 model_neutral_state_.num_successful_bookmark_commits); | 69 model_neutral_state_.num_successful_bookmark_commits); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 base::Time SyncSessionSnapshot::sync_start_time() const { | 167 base::Time SyncSessionSnapshot::sync_start_time() const { |
| 166 return sync_start_time_; | 168 return sync_start_time_; |
| 167 } | 169 } |
| 168 | 170 |
| 169 bool SyncSessionSnapshot::retry_scheduled() const { | 171 bool SyncSessionSnapshot::retry_scheduled() const { |
| 170 return retry_scheduled_; | 172 return retry_scheduled_; |
| 171 } | 173 } |
| 172 | 174 |
| 175 bool SyncSessionSnapshot::is_initialized() const { |
| 176 return is_initialized_; |
| 177 } |
| 178 |
| 173 } // namespace sessions | 179 } // namespace sessions |
| 174 } // namespace syncer | 180 } // namespace syncer |
| OLD | NEW |