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

Unified Diff: net/cookies/cookie_util.h

Issue 354183002: Enforce SafetyMode for YouTube if prefs::kForceSafeSearch is on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert string_util.h change Created 6 years, 5 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 | « chrome/chrome_tests_unit.gypi ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_util.h
diff --git a/net/cookies/cookie_util.h b/net/cookies/cookie_util.h
index aaaf27d41aa7f4c992d9c5a0b1840706dc9831c7..0bf1452af864015331c1491ad50f78d1652e81dc 100644
--- a/net/cookies/cookie_util.h
+++ b/net/cookies/cookie_util.h
@@ -6,7 +6,10 @@
#define NET_COOKIES_COOKIE_UTIL_H_
#include <string>
+#include <utility>
+#include <vector>
+#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
@@ -40,7 +43,25 @@ NET_EXPORT base::Time ParseCookieTime(const std::string& time_string);
// Convenience for converting a cookie origin (domain and https pair) to a URL.
NET_EXPORT GURL CookieOriginToURL(const std::string& domain, bool is_https);
-} // namspace cookie_util
+// A ParsedRequestCookie consists of the key and value of the cookie.
+typedef std::pair<base::StringPiece, base::StringPiece> ParsedRequestCookie;
+typedef std::vector<ParsedRequestCookie> ParsedRequestCookies;
+
+// Assumes that |header_value| is the cookie header value of a HTTP Request
+// following the cookie-string schema of RFC 6265, section 4.2.1, and returns
+// cookie name/value pairs. If cookie values are presented in double quotes,
+// these will appear in |parsed_cookies| as well. Assumes that the cookie
+// header is written by Chromium and therefore well-formed.
+NET_EXPORT void ParseRequestCookieLine(const std::string& header_value,
+ ParsedRequestCookies* parsed_cookies);
+
+// Writes all cookies of |parsed_cookies| into a HTTP Request header value
+// that belongs to the "Cookie" header. The entries of |parsed_cookies| must
+// already be appropriately escaped.
+NET_EXPORT std::string SerializeRequestCookieLine(
+ const ParsedRequestCookies& parsed_cookies);
+
+} // namespace cookie_util
} // namespace net
#endif // NET_COOKIES_COOKIE_UTIL_H_
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698