naive proxy bin Fix base::Value usage

This commit is contained in:
klzgrad 2020-08-29 18:48:43 +08:00
parent 6fe3ed64af
commit 9a0bbc2e30

View File

@ -82,24 +82,16 @@ struct Params {
std::unique_ptr<base::Value> GetConstants( std::unique_ptr<base::Value> GetConstants(
const base::CommandLine::StringType& command_line_string) { const base::CommandLine::StringType& command_line_string) {
auto constants_dict = net::GetNetConstants(); auto constants_dict = std::make_unique<base::Value>(net::GetNetConstants());
DCHECK(constants_dict); base::DictionaryValue dict;
// Add a dictionary with the version of the client and its command line
// arguments.
auto dict = std::make_unique<base::DictionaryValue>();
// We have everything we need to send the right values.
std::string os_type = base::StringPrintf( std::string os_type = base::StringPrintf(
"%s: %s (%s)", base::SysInfo::OperatingSystemName().c_str(), "%s: %s (%s)", base::SysInfo::OperatingSystemName().c_str(),
base::SysInfo::OperatingSystemVersion().c_str(), base::SysInfo::OperatingSystemVersion().c_str(),
base::SysInfo::OperatingSystemArchitecture().c_str()); base::SysInfo::OperatingSystemArchitecture().c_str());
dict->SetString("os_type", os_type); dict.SetString("os_type", os_type);
dict->SetString("command_line", command_line_string); dict.SetString("command_line", command_line_string);
constants_dict->SetKey("clientInfo", std::move(dict));
constants_dict->Set("clientInfo", std::move(dict)); return constants_dict;
return std::move(constants_dict);
} }
// Builds a URLRequestContext assuming there's only a single loop. // Builds a URLRequestContext assuming there's only a single loop.