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

Side by Side Diff: sync/internal_api/base_node.cc

Issue 134443004: sync: Remove some WebUI debug functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/sync_internals_ui.cc ('k') | sync/internal_api/public/base_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base_node.h" 5 #include "sync/internal_api/public/base_node.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h"
12 #include "sync/internal_api/public/base_transaction.h" 11 #include "sync/internal_api/public/base_transaction.h"
13 #include "sync/internal_api/syncapi_internal.h" 12 #include "sync/internal_api/syncapi_internal.h"
14 #include "sync/protocol/app_specifics.pb.h" 13 #include "sync/protocol/app_specifics.pb.h"
15 #include "sync/protocol/autofill_specifics.pb.h" 14 #include "sync/protocol/autofill_specifics.pb.h"
16 #include "sync/protocol/bookmark_specifics.pb.h" 15 #include "sync/protocol/bookmark_specifics.pb.h"
17 #include "sync/protocol/extension_specifics.pb.h" 16 #include "sync/protocol/extension_specifics.pb.h"
18 #include "sync/protocol/nigori_specifics.pb.h" 17 #include "sync/protocol/nigori_specifics.pb.h"
19 #include "sync/protocol/password_specifics.pb.h" 18 #include "sync/protocol/password_specifics.pb.h"
20 #include "sync/protocol/session_specifics.pb.h" 19 #include "sync/protocol/session_specifics.pb.h"
21 #include "sync/protocol/theme_specifics.pb.h" 20 #include "sync/protocol/theme_specifics.pb.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 219 }
221 220
222 int BaseNode::GetTotalNodeCount() const { 221 int BaseNode::GetTotalNodeCount() const {
223 return GetEntry()->GetTotalNodeCount(); 222 return GetEntry()->GetTotalNodeCount();
224 } 223 }
225 224
226 int BaseNode::GetPositionIndex() const { 225 int BaseNode::GetPositionIndex() const {
227 return GetEntry()->GetPositionIndex(); 226 return GetEntry()->GetPositionIndex();
228 } 227 }
229 228
230 base::DictionaryValue* BaseNode::GetSummaryAsValue() const { 229 base::DictionaryValue* BaseNode::ToValue() const {
231 base::DictionaryValue* node_info = new base::DictionaryValue(); 230 return GetEntry()->ToValue(GetTransaction()->GetCryptographer());
232 node_info->SetString("id", base::Int64ToString(GetId()));
233 node_info->SetBoolean("isFolder", GetIsFolder());
234 node_info->SetString("title", GetTitle());
235 node_info->Set("type", ModelTypeToValue(GetModelType()));
236 return node_info;
237 }
238
239 base::DictionaryValue* BaseNode::GetDetailsAsValue() const {
240 base::DictionaryValue* node_info = GetSummaryAsValue();
241 node_info->SetString(
242 "modificationTime", GetTimeDebugString(GetModificationTime()));
243 node_info->SetString("parentId", base::Int64ToString(GetParentId()));
244 // Specifics are already in the Entry value, so no need to duplicate
245 // it here.
246 node_info->SetString("externalId", base::Int64ToString(GetExternalId()));
247 if (GetEntry()->ShouldMaintainPosition() &&
248 !GetEntry()->GetIsDel()) {
249 node_info->SetString("successorId", base::Int64ToString(GetSuccessorId()));
250 node_info->SetString(
251 "predecessorId", base::Int64ToString(GetPredecessorId()));
252 }
253 if (GetEntry()->GetIsDir()) {
254 node_info->SetString(
255 "firstChildId", base::Int64ToString(GetFirstChildId()));
256 }
257 node_info->Set(
258 "entry", GetEntry()->ToValue(GetTransaction()->GetCryptographer()));
259 return node_info;
260 } 231 }
261 232
262 int64 BaseNode::GetExternalId() const { 233 int64 BaseNode::GetExternalId() const {
263 return GetEntry()->GetLocalExternalId(); 234 return GetEntry()->GetLocalExternalId();
264 } 235 }
265 236
266 const sync_pb::AppSpecifics& BaseNode::GetAppSpecifics() const { 237 const sync_pb::AppSpecifics& BaseNode::GetAppSpecifics() const {
267 DCHECK_EQ(GetModelType(), APPS); 238 DCHECK_EQ(GetModelType(), APPS);
268 return GetEntitySpecifics().app(); 239 return GetEntitySpecifics().app();
269 } 240 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const sync_pb::EntitySpecifics& specifics) { 323 const sync_pb::EntitySpecifics& specifics) {
353 ModelType type = GetModelTypeFromSpecifics(specifics); 324 ModelType type = GetModelTypeFromSpecifics(specifics);
354 DCHECK_NE(UNSPECIFIED, type); 325 DCHECK_NE(UNSPECIFIED, type);
355 if (GetModelType() != UNSPECIFIED) { 326 if (GetModelType() != UNSPECIFIED) {
356 DCHECK_EQ(GetModelType(), type); 327 DCHECK_EQ(GetModelType(), type);
357 } 328 }
358 unencrypted_data_.CopyFrom(specifics); 329 unencrypted_data_.CopyFrom(specifics);
359 } 330 }
360 331
361 } // namespace syncer 332 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_internals_ui.cc ('k') | sync/internal_api/public/base_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698