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

Unified Diff: extensions/browser/api/web_request/web_request_api_helpers.cc

Issue 1577673002: WebRequest API cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copy GetSocketAddress().host instead of & to resolve win failure Created 4 years, 11 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
Index: extensions/browser/api/web_request/web_request_api_helpers.cc
diff --git a/extensions/browser/api/web_request/web_request_api_helpers.cc b/extensions/browser/api/web_request/web_request_api_helpers.cc
index fd21d2ccbb7fd88c380b4f7bc9c0f7f03210aa60..6f86bf43943515ad524872c9bac3dca439769263 100644
--- a/extensions/browser/api/web_request/web_request_api_helpers.cc
+++ b/extensions/browser/api/web_request/web_request_api_helpers.cc
@@ -137,6 +137,33 @@ bool NullableEquals(const std::string* a, const std::string* b) {
} // namespace
+bool ExtraInfoSpec::InitFromValue(const base::ListValue& value,
+ int* extra_info_spec) {
+ *extra_info_spec = 0;
+ for (size_t i = 0; i < value.GetSize(); ++i) {
+ std::string str;
+ if (!value.GetString(i, &str))
+ return false;
+
+ if (str == "requestHeaders")
+ *extra_info_spec |= REQUEST_HEADERS;
+ else if (str == "responseHeaders")
+ *extra_info_spec |= RESPONSE_HEADERS;
+ else if (str == "blocking")
+ *extra_info_spec |= BLOCKING;
+ else if (str == "asyncBlocking")
+ *extra_info_spec |= ASYNC_BLOCKING;
+ else if (str == "requestBody")
+ *extra_info_spec |= REQUEST_BODY;
+ else
+ return false;
+ }
+ // BLOCKING and ASYNC_BLOCKING are mutually exclusive.
+ if ((*extra_info_spec & BLOCKING) && (*extra_info_spec & ASYNC_BLOCKING))
+ return false;
+ return true;
+}
+
RequestCookie::RequestCookie() {}
RequestCookie::~RequestCookie() {}

Powered by Google App Engine
This is Rietveld 408576698