Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: sync/internal_api/public/sessions/sync_session_snapshot.cc

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 notifications_enabled_(notifications_enabled), 46 notifications_enabled_(notifications_enabled),
47 num_entries_(num_entries), 47 num_entries_(num_entries),
48 sync_start_time_(sync_start_time), 48 sync_start_time_(sync_start_time),
49 num_entries_by_type_(num_entries_by_type), 49 num_entries_by_type_(num_entries_by_type),
50 num_to_delete_entries_by_type_(num_to_delete_entries_by_type), 50 num_to_delete_entries_by_type_(num_to_delete_entries_by_type),
51 is_initialized_(true) { 51 is_initialized_(true) {
52 } 52 }
53 53
54 SyncSessionSnapshot::~SyncSessionSnapshot() {} 54 SyncSessionSnapshot::~SyncSessionSnapshot() {}
55 55
56 DictionaryValue* SyncSessionSnapshot::ToValue() const { 56 base::DictionaryValue* SyncSessionSnapshot::ToValue() const {
57 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 57 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
58 value->SetInteger("numSuccessfulCommits", 58 value->SetInteger("numSuccessfulCommits",
59 model_neutral_state_.num_successful_commits); 59 model_neutral_state_.num_successful_commits);
60 value->SetInteger("numSuccessfulBookmarkCommits", 60 value->SetInteger("numSuccessfulBookmarkCommits",
61 model_neutral_state_.num_successful_bookmark_commits); 61 model_neutral_state_.num_successful_bookmark_commits);
62 value->SetInteger("numUpdatesDownloadedTotal", 62 value->SetInteger("numUpdatesDownloadedTotal",
63 model_neutral_state_.num_updates_downloaded_total); 63 model_neutral_state_.num_updates_downloaded_total);
64 value->SetInteger("numTombstoneUpdatesDownloadedTotal", 64 value->SetInteger("numTombstoneUpdatesDownloadedTotal",
65 model_neutral_state_.num_tombstone_updates_downloaded_total); 65 model_neutral_state_.num_tombstone_updates_downloaded_total);
66 value->SetInteger("numReflectedUpdatesDownloadedTotal", 66 value->SetInteger("numReflectedUpdatesDownloadedTotal",
67 model_neutral_state_.num_reflected_updates_downloaded_total); 67 model_neutral_state_.num_reflected_updates_downloaded_total);
(...skipping 11 matching lines...) Expand all
79 value->SetInteger("numEncryptionConflicts", 79 value->SetInteger("numEncryptionConflicts",
80 num_encryption_conflicts_); 80 num_encryption_conflicts_);
81 value->SetInteger("numHierarchyConflicts", 81 value->SetInteger("numHierarchyConflicts",
82 num_hierarchy_conflicts_); 82 num_hierarchy_conflicts_);
83 value->SetInteger("numServerConflicts", 83 value->SetInteger("numServerConflicts",
84 num_server_conflicts_); 84 num_server_conflicts_);
85 value->SetInteger("numEntries", num_entries_); 85 value->SetInteger("numEntries", num_entries_);
86 value->Set("source", source_.ToValue()); 86 value->Set("source", source_.ToValue());
87 value->SetBoolean("notificationsEnabled", notifications_enabled_); 87 value->SetBoolean("notificationsEnabled", notifications_enabled_);
88 88
89 scoped_ptr<DictionaryValue> counter_entries(new DictionaryValue()); 89 scoped_ptr<base::DictionaryValue> counter_entries(
90 new base::DictionaryValue());
90 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { 91 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) {
91 scoped_ptr<DictionaryValue> type_entries(new DictionaryValue()); 92 scoped_ptr<base::DictionaryValue> type_entries(new base::DictionaryValue());
92 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); 93 type_entries->SetInteger("numEntries", num_entries_by_type_[i]);
93 type_entries->SetInteger("numToDeleteEntries", 94 type_entries->SetInteger("numToDeleteEntries",
94 num_to_delete_entries_by_type_[i]); 95 num_to_delete_entries_by_type_[i]);
95 96
96 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); 97 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i));
97 counter_entries->Set(model_type, type_entries.release()); 98 counter_entries->Set(model_type, type_entries.release());
98 } 99 }
99 value->Set("counter_entries", counter_entries.release()); 100 value->Set("counter_entries", counter_entries.release());
100 return value.release(); 101 return value.release();
101 } 102 }
102 103
103 std::string SyncSessionSnapshot::ToString() const { 104 std::string SyncSessionSnapshot::ToString() const {
104 scoped_ptr<DictionaryValue> value(ToValue()); 105 scoped_ptr<base::DictionaryValue> value(ToValue());
105 std::string json; 106 std::string json;
106 base::JSONWriter::WriteWithOptions(value.get(), 107 base::JSONWriter::WriteWithOptions(value.get(),
107 base::JSONWriter::OPTIONS_PRETTY_PRINT, 108 base::JSONWriter::OPTIONS_PRETTY_PRINT,
108 &json); 109 &json);
109 return json; 110 return json;
110 } 111 }
111 112
112 int64 SyncSessionSnapshot::num_server_changes_remaining() const { 113 int64 SyncSessionSnapshot::num_server_changes_remaining() const {
113 return model_neutral_state().num_server_changes_remaining; 114 return model_neutral_state().num_server_changes_remaining;
114 } 115 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return num_entries_by_type_; 159 return num_entries_by_type_;
159 } 160 }
160 161
161 const std::vector<int>& 162 const std::vector<int>&
162 SyncSessionSnapshot::num_to_delete_entries_by_type() const { 163 SyncSessionSnapshot::num_to_delete_entries_by_type() const {
163 return num_to_delete_entries_by_type_; 164 return num_to_delete_entries_by_type_;
164 } 165 }
165 166
166 } // namespace sessions 167 } // namespace sessions
167 } // namespace syncer 168 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698