| 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 #ifndef COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ | 5 #ifndef COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ |
| 6 #define COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ | 6 #define COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 CloudDeviceDescription(); | 24 CloudDeviceDescription(); |
| 25 ~CloudDeviceDescription(); | 25 ~CloudDeviceDescription(); |
| 26 | 26 |
| 27 void Reset(); | 27 void Reset(); |
| 28 | 28 |
| 29 bool InitFromDictionary(scoped_ptr<base::DictionaryValue> root); | 29 bool InitFromDictionary(scoped_ptr<base::DictionaryValue> root); |
| 30 bool InitFromString(const std::string& json); | 30 bool InitFromString(const std::string& json); |
| 31 | 31 |
| 32 std::string ToString() const; | 32 std::string ToString() const; |
| 33 | 33 |
| 34 // Releases root dictionary and hands ownership over to the caller. |
| 35 scoped_ptr<base::DictionaryValue> release(); |
| 36 |
| 34 // Returns dictionary with capability/option. | 37 // Returns dictionary with capability/option. |
| 35 // Returns NULL if missing. | 38 // Returns NULL if missing. |
| 36 const base::DictionaryValue* GetItem(const std::string& path) const; | 39 const base::DictionaryValue* GetItem(const std::string& path) const; |
| 37 | 40 |
| 38 // Create dictionary for capability/option. | 41 // Create dictionary for capability/option. |
| 39 // Never returns NULL. | 42 // Never returns NULL. |
| 40 base::DictionaryValue* CreateItem(const std::string& path); | 43 base::DictionaryValue* CreateItem(const std::string& path); |
| 41 | 44 |
| 42 // Returns list with capability/option. | 45 // Returns list with capability/option. |
| 43 // Returns NULL if missing. | 46 // Returns NULL if missing. |
| 44 const base::ListValue* GetListItem(const std::string& path) const; | 47 const base::ListValue* GetListItem(const std::string& path) const; |
| 45 | 48 |
| 46 // Create list for capability/option. | 49 // Create list for capability/option. |
| 47 // Never returns NULL. | 50 // Never returns NULL. |
| 48 base::ListValue* CreateListItem(const std::string& path); | 51 base::ListValue* CreateListItem(const std::string& path); |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 scoped_ptr<base::DictionaryValue> root_; | 54 scoped_ptr<base::DictionaryValue> root_; |
| 52 | 55 |
| 53 DISALLOW_COPY_AND_ASSIGN(CloudDeviceDescription); | 56 DISALLOW_COPY_AND_ASSIGN(CloudDeviceDescription); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace cloud_devices | 59 } // namespace cloud_devices |
| 57 | 60 |
| 58 #endif // COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ | 61 #endif // COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_ |
| OLD | NEW |