Remove raw base::DictionaryValue::Set
https://codereview.chromium.org/2911033002
This commit is contained in:
parent
cf00fc0661
commit
2c063f93ff
5 changed files with 20 additions and 12 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
@ -143,7 +144,7 @@ void Debugger::SendCommand(mate::Arguments* args) {
|
|||
request.SetInteger("id", request_id);
|
||||
request.SetString("method", method);
|
||||
if (!command_params.empty())
|
||||
request.Set("params", command_params.DeepCopy());
|
||||
request.Set("params", base::WrapUnique(command_params.DeepCopy()));
|
||||
|
||||
std::string json_args;
|
||||
base::JSONWriter::Write(request, &json_args);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
|
@ -758,10 +759,10 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
|
|||
DCHECK(it != pending_requests_.end());
|
||||
|
||||
base::DictionaryValue response;
|
||||
auto* headers = new base::DictionaryValue();
|
||||
auto headers = base::MakeUnique<base::DictionaryValue>();
|
||||
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
|
||||
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||
response.Set("headers", headers);
|
||||
response.Set("headers", std::move(headers));
|
||||
|
||||
size_t iterator = 0;
|
||||
std::string name;
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#include "brightray/browser/net/devtools_network_protocol_handler.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "brightray/browser/browser_context.h"
|
||||
#include "brightray/browser/net/devtools_network_conditions.h"
|
||||
|
@ -60,17 +62,17 @@ bool ParseCommand(const base::DictionaryValue* command,
|
|||
|
||||
std::unique_ptr<base::DictionaryValue>
|
||||
CreateSuccessResponse(int id, std::unique_ptr<base::DictionaryValue> result) {
|
||||
std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue);
|
||||
auto response = base::MakeUnique<base::DictionaryValue>();
|
||||
response->SetInteger(kId, id);
|
||||
response->Set(params::kResult, result.release());
|
||||
response->Set(params::kResult, std::move(result));
|
||||
return response;
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue>
|
||||
CreateFailureResponse(int id, const std::string& param) {
|
||||
std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue);
|
||||
auto error_object = new base::DictionaryValue;
|
||||
response->Set(kError, error_object);
|
||||
auto response = base::MakeUnique<base::DictionaryValue>();
|
||||
auto error_object = base::MakeUnique<base::DictionaryValue>();
|
||||
response->Set(kError, std::move(error_object));
|
||||
error_object->SetInteger(params::kErrorCode, kErrorInvalidParams);
|
||||
error_object->SetString(params::kErrorMessage,
|
||||
base::StringPrintf("Missing or Invalid '%s' parameter", param.c_str()));
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
|
||||
#include "brightray/browser/net_log.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/values.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/log/net_log_util.h"
|
||||
|
@ -18,12 +21,12 @@ std::unique_ptr<base::DictionaryValue> GetConstants() {
|
|||
std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants();
|
||||
|
||||
// Adding client information to constants dictionary.
|
||||
auto* client_info = new base::DictionaryValue();
|
||||
auto client_info = base::MakeUnique<base::DictionaryValue>();
|
||||
client_info->SetString(
|
||||
"command_line",
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString());
|
||||
|
||||
constants->Set("clientInfo", client_info);
|
||||
constants->Set("clientInfo", std::move(client_info));
|
||||
return constants;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "components/prefs/json_pref_store.h"
|
||||
|
@ -87,8 +88,8 @@ void ZoomLevelDelegate::OnZoomLevelChanged(
|
|||
base::DictionaryValue* host_zoom_dictionary = nullptr;
|
||||
if (!host_zoom_dictionaries->GetDictionary(partition_key_,
|
||||
&host_zoom_dictionary)) {
|
||||
host_zoom_dictionary = new base::DictionaryValue();
|
||||
host_zoom_dictionaries->Set(partition_key_, host_zoom_dictionary);
|
||||
host_zoom_dictionary = host_zoom_dictionaries->SetDictionary(
|
||||
partition_key_, base::MakeUnique<base::DictionaryValue>());
|
||||
}
|
||||
|
||||
if (modification_is_removal)
|
||||
|
|
Loading…
Add table
Reference in a new issue