| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cloud_devices/common/cloud_device_description.h" | 5 #include "components/cloud_devices/common/cloud_device_description.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 const base::DictionaryValue* CloudDeviceDescription::GetItem( | 57 const base::DictionaryValue* CloudDeviceDescription::GetItem( |
| 58 const std::string& path) const { | 58 const std::string& path) const { |
| 59 const base::DictionaryValue* value = NULL; | 59 const base::DictionaryValue* value = NULL; |
| 60 root_->GetDictionary(path, &value); | 60 root_->GetDictionary(path, &value); |
| 61 return value; | 61 return value; |
| 62 } | 62 } |
| 63 | 63 |
| 64 base::DictionaryValue* CloudDeviceDescription::CreateItem( | 64 base::DictionaryValue* CloudDeviceDescription::CreateItem( |
| 65 const std::string& path) { | 65 const std::string& path) { |
| 66 base::DictionaryValue* value = new base::DictionaryValue; | 66 return root_->SetDictionary(path, base::MakeUnique<base::DictionaryValue>()); |
| 67 root_->Set(path, value); | |
| 68 return value; | |
| 69 } | 67 } |
| 70 | 68 |
| 71 const base::ListValue* CloudDeviceDescription::GetListItem( | 69 const base::ListValue* CloudDeviceDescription::GetListItem( |
| 72 const std::string& path) const { | 70 const std::string& path) const { |
| 73 const base::ListValue* value = NULL; | 71 const base::ListValue* value = NULL; |
| 74 root_->GetList(path, &value); | 72 root_->GetList(path, &value); |
| 75 return value; | 73 return value; |
| 76 } | 74 } |
| 77 | 75 |
| 78 base::ListValue* CloudDeviceDescription::CreateListItem( | 76 base::ListValue* CloudDeviceDescription::CreateListItem( |
| 79 const std::string& path) { | 77 const std::string& path) { |
| 80 base::ListValue* value = new base::ListValue; | 78 return root_->SetList(path, base::MakeUnique<base::ListValue>()); |
| 81 root_->Set(path, value); | |
| 82 return value; | |
| 83 } | 79 } |
| 84 | 80 |
| 85 } // namespace cloud_devices | 81 } // namespace cloud_devices |
| OLD | NEW |