| 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 <stack> | 7 #include <stack> |
| 8 | 8 |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 const sync_pb::DeviceInfoSpecifics& BaseNode::GetDeviceInfoSpecifics() const { | 336 const sync_pb::DeviceInfoSpecifics& BaseNode::GetDeviceInfoSpecifics() const { |
| 337 DCHECK_EQ(GetModelType(), DEVICE_INFO); | 337 DCHECK_EQ(GetModelType(), DEVICE_INFO); |
| 338 return GetEntitySpecifics().device_info(); | 338 return GetEntitySpecifics().device_info(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 const sync_pb::ExperimentsSpecifics& BaseNode::GetExperimentsSpecifics() const { | 341 const sync_pb::ExperimentsSpecifics& BaseNode::GetExperimentsSpecifics() const { |
| 342 DCHECK_EQ(GetModelType(), EXPERIMENTS); | 342 DCHECK_EQ(GetModelType(), EXPERIMENTS); |
| 343 return GetEntitySpecifics().experiments(); | 343 return GetEntitySpecifics().experiments(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 const sync_pb::ControlPreferenceSpecifics& |
| 347 BaseNode::GetControlPreferenceSpecifics() const { |
| 348 DCHECK_EQ(GetModelType(), CONTROL_PREFERENCES); |
| 349 return GetEntitySpecifics().control_preference(); |
| 350 } |
| 351 |
| 346 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { | 352 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { |
| 347 return GetUnencryptedSpecifics(GetEntry()); | 353 return GetUnencryptedSpecifics(GetEntry()); |
| 348 } | 354 } |
| 349 | 355 |
| 350 ModelType BaseNode::GetModelType() const { | 356 ModelType BaseNode::GetModelType() const { |
| 351 return GetEntry()->GetModelType(); | 357 return GetEntry()->GetModelType(); |
| 352 } | 358 } |
| 353 | 359 |
| 354 void BaseNode::SetUnencryptedSpecifics( | 360 void BaseNode::SetUnencryptedSpecifics( |
| 355 const sync_pb::EntitySpecifics& specifics) { | 361 const sync_pb::EntitySpecifics& specifics) { |
| 356 ModelType type = GetModelTypeFromSpecifics(specifics); | 362 ModelType type = GetModelTypeFromSpecifics(specifics); |
| 357 DCHECK_NE(UNSPECIFIED, type); | 363 DCHECK_NE(UNSPECIFIED, type); |
| 358 if (GetModelType() != UNSPECIFIED) { | 364 if (GetModelType() != UNSPECIFIED) { |
| 359 DCHECK_EQ(GetModelType(), type); | 365 DCHECK_EQ(GetModelType(), type); |
| 360 } | 366 } |
| 361 unencrypted_data_.CopyFrom(specifics); | 367 unencrypted_data_.CopyFrom(specifics); |
| 362 } | 368 } |
| 363 | 369 |
| 364 } // namespace syncer | 370 } // namespace syncer |
| OLD | NEW |