buffet: Fix return type of DeviceRegistrationInfo::GetDeviceInfo
Result can't be any Value. According doc string it's a JSON object
which is DictionaryValue.
BUG=none
TEST=compile
Change-Id: I0988d4558629974ad1fc980a5e096319620b585c
Reviewed-on: https://chromium-review.googlesource.com/259660
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/device_registration_info.cc b/buffet/device_registration_info.cc
index 9036ed8..ff4df89 100644
--- a/buffet/device_registration_info.cc
+++ b/buffet/device_registration_info.cc
@@ -460,10 +460,10 @@
return resource;
}
-std::unique_ptr<base::Value> DeviceRegistrationInfo::GetDeviceInfo(
+std::unique_ptr<base::DictionaryValue> DeviceRegistrationInfo::GetDeviceInfo(
chromeos::ErrorPtr* error) {
if (!CheckRegistration(error))
- return std::unique_ptr<base::Value>();
+ return std::unique_ptr<base::DictionaryValue>();
// TODO(antonm): Switch to DoCloudRequest later.
auto response = chromeos::http::GetAndBlock(
@@ -476,10 +476,10 @@
LOG(WARNING) << "Failed to retrieve the device info. Response code = "
<< status_code;
ParseGCDError(json.get(), error);
- return std::unique_ptr<base::Value>();
+ return std::unique_ptr<base::DictionaryValue>();
}
}
- return std::unique_ptr<base::Value>(json.release());
+ return json;
}
std::string DeviceRegistrationInfo::RegisterDevice(
diff --git a/buffet/device_registration_info.h b/buffet/device_registration_info.h
index 7d64d31..e8f02eb 100644
--- a/buffet/device_registration_info.h
+++ b/buffet/device_registration_info.h
@@ -24,7 +24,7 @@
#include "buffet/xmpp/xmpp_client.h"
namespace base {
-class Value;
+class DictionaryValue;
} // namespace base
namespace chromeos {
@@ -112,7 +112,8 @@
// Gets the full device description JSON object, or nullptr if
// the device is not registered or communication failure.
- std::unique_ptr<base::Value> GetDeviceInfo(chromeos::ErrorPtr* error);
+ std::unique_ptr<base::DictionaryValue> GetDeviceInfo(
+ chromeos::ErrorPtr* error);
// Registers the device.
//