| Index: extensions/browser/api/declarative_webrequest/webrequest_action.cc
|
| diff --git a/extensions/browser/api/declarative_webrequest/webrequest_action.cc b/extensions/browser/api/declarative_webrequest/webrequest_action.cc
|
| index 1a777cef2d8e6593931b50ac07deacc3d92c1a96..4e52a17a8ecf0f8cc4ac2ec49a7c0e7e237ca512 100644
|
| --- a/extensions/browser/api/declarative_webrequest/webrequest_action.cc
|
| +++ b/extensions/browser/api/declarative_webrequest/webrequest_action.cc
|
| @@ -126,7 +126,7 @@ scoped_refptr<const WebRequestAction> CreateRedirectRequestAction(
|
| const base::Value* value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
| std::string redirect_url_string;
|
| INPUT_FORMAT_VALIDATE(
|
| @@ -141,7 +141,7 @@ scoped_refptr<const WebRequestAction> CreateRedirectRequestByRegExAction(
|
| const base::Value* value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
| std::string from;
|
| std::string to;
|
| @@ -156,7 +156,7 @@ scoped_refptr<const WebRequestAction> CreateRedirectRequestByRegExAction(
|
|
|
| if (!from_pattern->ok()) {
|
| *error = "Invalid pattern '" + from + "' -> '" + to + "'";
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestRedirectByRegExAction(from_pattern.Pass(), to));
|
| @@ -167,7 +167,7 @@ scoped_refptr<const WebRequestAction> CreateSetRequestHeaderAction(
|
| const base::Value* json_value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(json_value->GetAsDictionary(&dict));
|
| std::string name;
|
| std::string value;
|
| @@ -175,12 +175,12 @@ scoped_refptr<const WebRequestAction> CreateSetRequestHeaderAction(
|
| INPUT_FORMAT_VALIDATE(dict->GetString(keys::kValueKey, &value));
|
| if (!net::HttpUtil::IsValidHeaderName(name)) {
|
| *error = extension_web_request_api_constants::kInvalidHeaderName;
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| if (!net::HttpUtil::IsValidHeaderValue(value)) {
|
| *error = ErrorUtils::FormatErrorMessage(
|
| extension_web_request_api_constants::kInvalidHeaderValue, name);
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestSetRequestHeaderAction(name, value));
|
| @@ -191,13 +191,13 @@ scoped_refptr<const WebRequestAction> CreateRemoveRequestHeaderAction(
|
| const base::Value* value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
| std::string name;
|
| INPUT_FORMAT_VALIDATE(dict->GetString(keys::kNameKey, &name));
|
| if (!net::HttpUtil::IsValidHeaderName(name)) {
|
| *error = extension_web_request_api_constants::kInvalidHeaderName;
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestRemoveRequestHeaderAction(name));
|
| @@ -208,7 +208,7 @@ scoped_refptr<const WebRequestAction> CreateAddResponseHeaderAction(
|
| const base::Value* json_value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(json_value->GetAsDictionary(&dict));
|
| std::string name;
|
| std::string value;
|
| @@ -216,12 +216,12 @@ scoped_refptr<const WebRequestAction> CreateAddResponseHeaderAction(
|
| INPUT_FORMAT_VALIDATE(dict->GetString(keys::kValueKey, &value));
|
| if (!net::HttpUtil::IsValidHeaderName(name)) {
|
| *error = extension_web_request_api_constants::kInvalidHeaderName;
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| if (!net::HttpUtil::IsValidHeaderValue(value)) {
|
| *error = ErrorUtils::FormatErrorMessage(
|
| extension_web_request_api_constants::kInvalidHeaderValue, name);
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestAddResponseHeaderAction(name, value));
|
| @@ -232,7 +232,7 @@ scoped_refptr<const WebRequestAction> CreateRemoveResponseHeaderAction(
|
| const base::Value* json_value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(json_value->GetAsDictionary(&dict));
|
| std::string name;
|
| std::string value;
|
| @@ -240,12 +240,12 @@ scoped_refptr<const WebRequestAction> CreateRemoveResponseHeaderAction(
|
| bool has_value = dict->GetString(keys::kValueKey, &value);
|
| if (!net::HttpUtil::IsValidHeaderName(name)) {
|
| *error = extension_web_request_api_constants::kInvalidHeaderName;
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| if (has_value && !net::HttpUtil::IsValidHeaderValue(value)) {
|
| *error = ErrorUtils::FormatErrorMessage(
|
| extension_web_request_api_constants::kInvalidHeaderValue, name);
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestRemoveResponseHeaderAction(name, value, has_value));
|
| @@ -256,7 +256,7 @@ scoped_refptr<const WebRequestAction> CreateIgnoreRulesAction(
|
| const base::Value* value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
| bool has_parameter = false;
|
| int minimum_priority = std::numeric_limits<int>::min();
|
| @@ -272,7 +272,7 @@ scoped_refptr<const WebRequestAction> CreateIgnoreRulesAction(
|
| }
|
| if (!has_parameter) {
|
| *error = kIgnoreRulesRequiresParameterError;
|
| - return scoped_refptr<const WebRequestAction>(NULL);
|
| + return scoped_refptr<const WebRequestAction>(nullptr);
|
| }
|
| return scoped_refptr<const WebRequestAction>(
|
| new WebRequestIgnoreRulesAction(minimum_priority, ignore_tag));
|
| @@ -285,7 +285,7 @@ scoped_refptr<const WebRequestAction> CreateRequestCookieAction(
|
| bool* bad_message) {
|
| using extension_web_request_api_helpers::RequestCookieModification;
|
|
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
|
|
| linked_ptr<RequestCookieModification> modification(
|
| @@ -304,18 +304,18 @@ scoped_refptr<const WebRequestAction> CreateRequestCookieAction(
|
| // Get filter.
|
| if (modification->type == helpers::EDIT ||
|
| modification->type == helpers::REMOVE) {
|
| - const base::DictionaryValue* filter = NULL;
|
| + const base::DictionaryValue* filter = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kFilterKey, &filter));
|
| modification->filter = ParseRequestCookie(filter);
|
| }
|
|
|
| // Get new value.
|
| if (modification->type == helpers::ADD) {
|
| - const base::DictionaryValue* value = NULL;
|
| + const base::DictionaryValue* value = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kCookieKey, &value));
|
| modification->modification = ParseRequestCookie(value);
|
| } else if (modification->type == helpers::EDIT) {
|
| - const base::DictionaryValue* value = NULL;
|
| + const base::DictionaryValue* value = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kModificationKey, &value));
|
| modification->modification = ParseRequestCookie(value);
|
| }
|
| @@ -331,7 +331,7 @@ scoped_refptr<const WebRequestAction> CreateResponseCookieAction(
|
| bool* bad_message) {
|
| using extension_web_request_api_helpers::ResponseCookieModification;
|
|
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
|
|
| linked_ptr<ResponseCookieModification> modification(
|
| @@ -350,18 +350,18 @@ scoped_refptr<const WebRequestAction> CreateResponseCookieAction(
|
| // Get filter.
|
| if (modification->type == helpers::EDIT ||
|
| modification->type == helpers::REMOVE) {
|
| - const base::DictionaryValue* filter = NULL;
|
| + const base::DictionaryValue* filter = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kFilterKey, &filter));
|
| modification->filter = ParseFilterResponseCookie(filter);
|
| }
|
|
|
| // Get new value.
|
| if (modification->type == helpers::ADD) {
|
| - const base::DictionaryValue* value = NULL;
|
| + const base::DictionaryValue* value = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kCookieKey, &value));
|
| modification->modification = ParseResponseCookie(value);
|
| } else if (modification->type == helpers::EDIT) {
|
| - const base::DictionaryValue* value = NULL;
|
| + const base::DictionaryValue* value = nullptr;
|
| INPUT_FORMAT_VALIDATE(dict->GetDictionary(keys::kModificationKey, &value));
|
| modification->modification = ParseResponseCookie(value);
|
| }
|
| @@ -375,7 +375,7 @@ scoped_refptr<const WebRequestAction> CreateSendMessageToExtensionAction(
|
| const base::Value* value,
|
| std::string* error,
|
| bool* bad_message) {
|
| - const base::DictionaryValue* dict = NULL;
|
| + const base::DictionaryValue* dict = nullptr;
|
| CHECK(value->GetAsDictionary(&dict));
|
| std::string message;
|
| INPUT_FORMAT_VALIDATE(dict->GetString(keys::kMessageKey, &message));
|
| @@ -521,7 +521,7 @@ scoped_refptr<const WebRequestAction> WebRequestAction::Create(
|
| *error = "";
|
| *bad_message = false;
|
|
|
| - const base::DictionaryValue* action_dict = NULL;
|
| + const base::DictionaryValue* action_dict = nullptr;
|
| INPUT_FORMAT_VALIDATE(json_action.GetAsDictionary(&action_dict));
|
|
|
| std::string instance_type;
|
| @@ -620,7 +620,7 @@ LinkedPtrEventResponseDelta WebRequestRedirectAction::CreateDelta(
|
| const base::Time& extension_install_time) const {
|
| CHECK(request_data.stage & stages());
|
| if (request_data.request->url() == redirect_url_)
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
| LinkedPtrEventResponseDelta result(
|
| new helpers::EventResponseDelta(extension_id, extension_install_time));
|
| result->new_url = redirect_url_;
|
| @@ -781,7 +781,7 @@ LinkedPtrEventResponseDelta WebRequestRedirectByRegExAction::CreateDelta(
|
| std::string new_url = old_url;
|
| if (!RE2::Replace(&new_url, *from_pattern_, to_pattern_) ||
|
| new_url == old_url) {
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
| }
|
|
|
| LinkedPtrEventResponseDelta result(
|
| @@ -910,11 +910,11 @@ WebRequestAddResponseHeaderAction::CreateDelta(
|
| const net::HttpResponseHeaders* headers =
|
| request_data.original_response_headers;
|
| if (!headers)
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
|
|
| // Don't generate the header if it exists already.
|
| if (headers->HasHeaderValue(name_, value_))
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
|
|
| LinkedPtrEventResponseDelta result(
|
| new helpers::EventResponseDelta(extension_id, extension_install_time));
|
| @@ -963,11 +963,11 @@ WebRequestRemoveResponseHeaderAction::CreateDelta(
|
| const net::HttpResponseHeaders* headers =
|
| request_data.original_response_headers;
|
| if (!headers)
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
|
|
| LinkedPtrEventResponseDelta result(
|
| new helpers::EventResponseDelta(extension_id, extension_install_time));
|
| - void* iter = NULL;
|
| + void* iter = nullptr;
|
| std::string current_value;
|
| while (headers->EnumerateHeader(&iter, name_, ¤t_value)) {
|
| if (has_value_ &&
|
| @@ -1016,7 +1016,7 @@ LinkedPtrEventResponseDelta WebRequestIgnoreRulesAction::CreateDelta(
|
| const std::string& extension_id,
|
| const base::Time& extension_install_time) const {
|
| CHECK(request_data.stage & stages());
|
| - return LinkedPtrEventResponseDelta(NULL);
|
| + return LinkedPtrEventResponseDelta(nullptr);
|
| }
|
|
|
| //
|
|
|