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

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

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PER_USER_METADATA, refactor some encryption code Created 8 years, 4 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/base_node.h" 5 #include "sync/internal_api/public/base_node.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const sync_pb::ExtensionSpecifics& BaseNode::GetExtensionSpecifics() const { 325 const sync_pb::ExtensionSpecifics& BaseNode::GetExtensionSpecifics() const {
326 DCHECK_EQ(GetModelType(), EXTENSIONS); 326 DCHECK_EQ(GetModelType(), EXTENSIONS);
327 return GetEntitySpecifics().extension(); 327 return GetEntitySpecifics().extension();
328 } 328 }
329 329
330 const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const { 330 const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const {
331 DCHECK_EQ(GetModelType(), SESSIONS); 331 DCHECK_EQ(GetModelType(), SESSIONS);
332 return GetEntitySpecifics().session(); 332 return GetEntitySpecifics().session();
333 } 333 }
334 334
335 const sync_pb::PerDeviceSpecifics& BaseNode::GetPerDeviceSpecifics() const {
336 DCHECK_EQ(GetModelType(), PER_DEVICE_METADATA);
337 return GetEntitySpecifics().per_device_metadata();
338 }
339
340 const sync_pb::PerUserSpecifics& BaseNode::GetPerUserSpecifics() const {
341 DCHECK_EQ(GetModelType(), PER_USER_METADATA);
342 return GetEntitySpecifics().per_user_metadata();
343 }
344
335 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { 345 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const {
336 return GetUnencryptedSpecifics(GetEntry()); 346 return GetUnencryptedSpecifics(GetEntry());
337 } 347 }
338 348
339 ModelType BaseNode::GetModelType() const { 349 ModelType BaseNode::GetModelType() const {
340 return GetEntry()->GetModelType(); 350 return GetEntry()->GetModelType();
341 } 351 }
342 352
343 void BaseNode::SetUnencryptedSpecifics( 353 void BaseNode::SetUnencryptedSpecifics(
344 const sync_pb::EntitySpecifics& specifics) { 354 const sync_pb::EntitySpecifics& specifics) {
345 ModelType type = GetModelTypeFromSpecifics(specifics); 355 ModelType type = GetModelTypeFromSpecifics(specifics);
346 DCHECK_NE(UNSPECIFIED, type); 356 DCHECK_NE(UNSPECIFIED, type);
347 if (GetModelType() != UNSPECIFIED) { 357 if (GetModelType() != UNSPECIFIED) {
348 DCHECK_EQ(GetModelType(), type); 358 DCHECK_EQ(GetModelType(), type);
349 } 359 }
350 unencrypted_data_.CopyFrom(specifics); 360 unencrypted_data_.CopyFrom(specifics);
351 } 361 }
352 362
353 } // namespace syncer 363 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698