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

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

Issue 10985008: sync: Add DeviceInfo protobuf and supporting code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another missing include Created 8 years, 2 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/chrome_browser.gypi ('k') | sync/internal_api/public/base/model_type.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 "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::DeviceInfoSpecifics& BaseNode::GetDeviceInfoSpecifics() const {
336 DCHECK_EQ(GetModelType(), DEVICE_INFO);
337 return GetEntitySpecifics().device_info();
338 }
339
335 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { 340 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const {
336 return GetUnencryptedSpecifics(GetEntry()); 341 return GetUnencryptedSpecifics(GetEntry());
337 } 342 }
338 343
339 ModelType BaseNode::GetModelType() const { 344 ModelType BaseNode::GetModelType() const {
340 return GetEntry()->GetModelType(); 345 return GetEntry()->GetModelType();
341 } 346 }
342 347
343 void BaseNode::SetUnencryptedSpecifics( 348 void BaseNode::SetUnencryptedSpecifics(
344 const sync_pb::EntitySpecifics& specifics) { 349 const sync_pb::EntitySpecifics& specifics) {
345 ModelType type = GetModelTypeFromSpecifics(specifics); 350 ModelType type = GetModelTypeFromSpecifics(specifics);
346 DCHECK_NE(UNSPECIFIED, type); 351 DCHECK_NE(UNSPECIFIED, type);
347 if (GetModelType() != UNSPECIFIED) { 352 if (GetModelType() != UNSPECIFIED) {
348 DCHECK_EQ(GetModelType(), type); 353 DCHECK_EQ(GetModelType(), type);
349 } 354 }
350 unencrypted_data_.CopyFrom(specifics); 355 unencrypted_data_.CopyFrom(specifics);
351 } 356 }
352 357
353 } // namespace syncer 358 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | sync/internal_api/public/base/model_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698