OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/sessions/session_state.h" | 5 #include "chrome/browser/sync/sessions/session_state.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base64.h" | 13 #include "base/base64.h" |
| 14 #include "base/json/json_writer.h" |
| 15 #include "base/memory/scoped_ptr.h" |
14 #include "base/values.h" | 16 #include "base/values.h" |
15 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 17 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
16 | 18 |
17 using std::set; | 19 using std::set; |
18 using std::vector; | 20 using std::vector; |
19 | 21 |
20 namespace browser_sync { | 22 namespace browser_sync { |
21 namespace sessions { | 23 namespace sessions { |
22 | 24 |
23 SyncSourceInfo::SyncSourceInfo() | 25 SyncSourceInfo::SyncSourceInfo() |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 static_cast<int>(unsynced_count)); | 167 static_cast<int>(unsynced_count)); |
166 value->SetInteger("numBlockingConflictingUpdates", | 168 value->SetInteger("numBlockingConflictingUpdates", |
167 num_blocking_conflicting_updates); | 169 num_blocking_conflicting_updates); |
168 value->SetInteger("numConflictingUpdates", num_conflicting_updates); | 170 value->SetInteger("numConflictingUpdates", num_conflicting_updates); |
169 value->SetBoolean("didCommitItems", did_commit_items); | 171 value->SetBoolean("didCommitItems", did_commit_items); |
170 value->SetInteger("numEntries", num_entries); | 172 value->SetInteger("numEntries", num_entries); |
171 value->Set("source", source.ToValue()); | 173 value->Set("source", source.ToValue()); |
172 return value; | 174 return value; |
173 } | 175 } |
174 | 176 |
| 177 std::string SyncSessionSnapshot::ToString() const { |
| 178 scoped_ptr<DictionaryValue> value(ToValue()); |
| 179 std::string json; |
| 180 base::JSONWriter::Write(value.get(), true, &json); |
| 181 return json; |
| 182 } |
| 183 |
175 ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} | 184 ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {} |
176 | 185 |
177 ConflictProgress::~ConflictProgress() { | 186 ConflictProgress::~ConflictProgress() { |
178 CleanupSets(); | 187 CleanupSets(); |
179 } | 188 } |
180 | 189 |
181 IdToConflictSetMap::const_iterator ConflictProgress::IdToConflictSetFind( | 190 IdToConflictSetMap::const_iterator ConflictProgress::IdToConflictSetFind( |
182 const syncable::Id& the_id) const { | 191 const syncable::Id& the_id) const { |
183 return id_to_conflict_set_.find(the_id); | 192 return id_to_conflict_set_.find(the_id); |
184 } | 193 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 389 |
381 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) | 390 PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) |
382 : conflict_progress(dirty_flag) { | 391 : conflict_progress(dirty_flag) { |
383 } | 392 } |
384 | 393 |
385 PerModelSafeGroupState::~PerModelSafeGroupState() { | 394 PerModelSafeGroupState::~PerModelSafeGroupState() { |
386 } | 395 } |
387 | 396 |
388 } // namespace sessions | 397 } // namespace sessions |
389 } // namespace browser_sync | 398 } // namespace browser_sync |
OLD | NEW |