From 9a0bbc2e30b9bb6c0c7c0a0d7fdd1734dce7451a Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 29 Aug 2020 18:48:43 +0800 Subject: [PATCH] naive proxy bin Fix base::Value usage --- src/net/tools/naive/naive_proxy_bin.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/net/tools/naive/naive_proxy_bin.cc b/src/net/tools/naive/naive_proxy_bin.cc index b7c6103372..353631ac2f 100644 --- a/src/net/tools/naive/naive_proxy_bin.cc +++ b/src/net/tools/naive/naive_proxy_bin.cc @@ -82,24 +82,16 @@ struct Params { std::unique_ptr GetConstants( const base::CommandLine::StringType& command_line_string) { - auto constants_dict = net::GetNetConstants(); - DCHECK(constants_dict); - - // Add a dictionary with the version of the client and its command line - // arguments. - auto dict = std::make_unique(); - - // We have everything we need to send the right values. + auto constants_dict = std::make_unique(net::GetNetConstants()); + base::DictionaryValue dict; std::string os_type = base::StringPrintf( "%s: %s (%s)", base::SysInfo::OperatingSystemName().c_str(), base::SysInfo::OperatingSystemVersion().c_str(), base::SysInfo::OperatingSystemArchitecture().c_str()); - dict->SetString("os_type", os_type); - dict->SetString("command_line", command_line_string); - - constants_dict->Set("clientInfo", std::move(dict)); - - return std::move(constants_dict); + dict.SetString("os_type", os_type); + dict.SetString("command_line", command_line_string); + constants_dict->SetKey("clientInfo", std::move(dict)); + return constants_dict; } // Builds a URLRequestContext assuming there's only a single loop.