Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/values_util.cc ('k') | extensions/browser/api/device_permissions_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
index 4b1ee0e5d633106c6792d320c859b2f7da8ac971..f3aa8d35e0803e84528f12e8fccd7394d9f6a3c3 100644
--- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -320,7 +320,7 @@ class HeaderMatcher {
// |data| is the pattern to be matched in the position given by |type|.
// Note that |data| must point to a StringValue object.
- static std::unique_ptr<StringMatchTest> Create(const base::Value* data,
+ static std::unique_ptr<StringMatchTest> Create(const base::Value& data,
MatchType type,
bool case_sensitive);
~StringMatchTest();
@@ -417,13 +417,12 @@ HeaderMatcher::HeaderMatcher(
// static
std::unique_ptr<HeaderMatcher::StringMatchTest>
-HeaderMatcher::StringMatchTest::Create(const base::Value* data,
+HeaderMatcher::StringMatchTest::Create(const base::Value& data,
MatchType type,
bool case_sensitive) {
std::string str;
- CHECK(data->GetAsString(&str));
- return std::unique_ptr<StringMatchTest>(
- new StringMatchTest(str, type, case_sensitive));
+ CHECK(data.GetAsString(&str));
+ return base::WrapUnique(new StringMatchTest(str, type, case_sensitive));
}
HeaderMatcher::StringMatchTest::~StringMatchTest() {}
@@ -511,16 +510,14 @@ HeaderMatcher::HeaderMatchTest::Create(const base::DictionaryValue* tests) {
case base::Value::TYPE_LIST: {
const base::ListValue* list = NULL;
CHECK(content->GetAsList(&list));
- for (base::ListValue::const_iterator it = list->begin();
- it != list->end(); ++it) {
- tests->push_back(base::WrapUnique(
- StringMatchTest::Create(*it, match_type, !is_name).release()));
+ for (const auto& it : *list) {
+ tests->push_back(StringMatchTest::Create(*it, match_type, !is_name));
}
break;
}
case base::Value::TYPE_STRING: {
- tests->push_back(base::WrapUnique(
- StringMatchTest::Create(content, match_type, !is_name).release()));
+ tests->push_back(
+ StringMatchTest::Create(*content, match_type, !is_name));
break;
}
default: {
« no previous file with comments | « dbus/values_util.cc ('k') | extensions/browser/api/device_permissions_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698