refactor: remove instances of createDeepCopy (#13703)

* add new native_mate converters for base::Value

* fix converter swapping

* remove createDeepCopy from browser/api

* replace missing ListValue converter

* convert bulk of remaining createDeepCopy instances

* convert last remaining instances of createDeepCopy

* incremental progress and helper methods for value conversion

* convert Get and add template function for GetString

* final DictionaryValue method conversions

* remove usage of base::DictionaryValue in web_contents_preferences

* use IsEnabled helper where possible

* Update atom_api_web_view_manager.cc
This commit is contained in:
Shelley Vohr 2018-08-03 14:23:07 -07:00 committed by Samuel Attard
parent cecb8fb0c4
commit 9f328abe19
14 changed files with 208 additions and 113 deletions

View file

@ -262,12 +262,13 @@ Cookies::~Cookies() {}
void Cookies::Get(const base::DictionaryValue& filter,
const GetCallback& callback) {
std::unique_ptr<base::DictionaryValue> copied(filter.CreateDeepCopy());
auto copy = base::DictionaryValue::From(
base::Value::ToUniquePtrValue(filter.Clone()));
auto* getter = browser_context_->GetRequestContext();
content::BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter),
std::move(copied), callback));
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), std::move(copy),
callback));
}
void Cookies::Remove(const GURL& url,
@ -282,12 +283,13 @@ void Cookies::Remove(const GURL& url,
void Cookies::Set(const base::DictionaryValue& details,
const SetCallback& callback) {
std::unique_ptr<base::DictionaryValue> copied(details.CreateDeepCopy());
auto copy = base::DictionaryValue::From(
base::Value::ToUniquePtrValue(details.Clone()));
auto* getter = browser_context_->GetRequestContext();
content::BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter),
std::move(copied), callback));
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), std::move(copy),
callback));
}
void Cookies::FlushStore(const base::Closure& callback) {