OLD | NEW |
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 Loading... |
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 |
OLD | NEW |