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

Side by Side Diff: net/cookies/cookie_util.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_COOKIES_COOKIE_UTIL_H_
6 #define NET_COOKIES_COOKIE_UTIL_H_
7
8 #include <string>
9 #include <utility>
10 #include <vector>
11
12 #include "base/strings/string_piece.h"
13 #include "base/time/time.h"
14 #include "net/base/net_export.h"
15
16 class GURL;
17
18 namespace net {
19 namespace cookie_util {
20
21 // Returns the effective TLD+1 for a given host. This only makes sense for http
22 // and https schemes. For other schemes, the host will be returned unchanged
23 // (minus any leading period).
24 NET_EXPORT std::string GetEffectiveDomain(const std::string& scheme,
25 const std::string& host);
26
27 // Determine the actual cookie domain based on the domain string passed
28 // (if any) and the URL from which the cookie came.
29 // On success returns true, and sets cookie_domain to either a
30 // -host cookie domain (ex: "google.com")
31 // -domain cookie domain (ex: ".google.com")
32 NET_EXPORT bool GetCookieDomainWithString(const GURL& url,
33 const std::string& domain_string,
34 std::string* result);
35
36 // Returns true if a domain string represents a host-only cookie,
37 // i.e. it doesn't begin with a leading '.' character.
38 NET_EXPORT bool DomainIsHostOnly(const std::string& domain_string);
39
40 // Parses the string with the cookie time (very forgivingly).
41 NET_EXPORT base::Time ParseCookieTime(const std::string& time_string);
42
43 // Convenience for converting a cookie origin (domain and https pair) to a URL.
44 NET_EXPORT GURL CookieOriginToURL(const std::string& domain, bool is_https);
45
46 // A ParsedRequestCookie consists of the key and value of the cookie.
47 typedef std::pair<base::StringPiece, base::StringPiece> ParsedRequestCookie;
48 typedef std::vector<ParsedRequestCookie> ParsedRequestCookies;
49
50 // Assumes that |header_value| is the cookie header value of a HTTP Request
51 // following the cookie-string schema of RFC 6265, section 4.2.1, and returns
52 // cookie name/value pairs. If cookie values are presented in double quotes,
53 // these will appear in |parsed_cookies| as well. Assumes that the cookie
54 // header is written by Chromium and therefore well-formed.
55 NET_EXPORT void ParseRequestCookieLine(const std::string& header_value,
56 ParsedRequestCookies* parsed_cookies);
57
58 // Writes all cookies of |parsed_cookies| into a HTTP Request header value
59 // that belongs to the "Cookie" header. The entries of |parsed_cookies| must
60 // already be appropriately escaped.
61 NET_EXPORT std::string SerializeRequestCookieLine(
62 const ParsedRequestCookies& parsed_cookies);
63
64 } // namespace cookie_util
65 } // namespace net
66
67 #endif // NET_COOKIES_COOKIE_UTIL_H_
OLDNEW
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698