OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ | 5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ |
6 #define NET_COOKIES_CANONICAL_COOKIE_H_ | 6 #define NET_COOKIES_CANONICAL_COOKIE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // account, but the RFC doesn't specify this. | 103 // account, but the RFC doesn't specify this. |
104 // NOTE: Keep this logic in-sync with TrimDuplicateCookiesForHost(). | 104 // NOTE: Keep this logic in-sync with TrimDuplicateCookiesForHost(). |
105 return (name_ == ecc.Name() && domain_ == ecc.Domain() | 105 return (name_ == ecc.Name() && domain_ == ecc.Domain() |
106 && path_ == ecc.Path()); | 106 && path_ == ecc.Path()); |
107 } | 107 } |
108 | 108 |
109 void SetLastAccessDate(const base::Time& date) { | 109 void SetLastAccessDate(const base::Time& date) { |
110 last_access_date_ = date; | 110 last_access_date_ = date; |
111 } | 111 } |
112 | 112 |
| 113 // Returns true if the given |url_path| path-matches the cookie-path as |
| 114 // described in section 5.1.4 in RFC 6265. |
113 bool IsOnPath(const std::string& url_path) const; | 115 bool IsOnPath(const std::string& url_path) const; |
| 116 |
| 117 // Returns true if the cookie domain matches the given |host| as described in |
| 118 // section 5.1.3 of RFC 6265. |
114 bool IsDomainMatch(const std::string& host) const; | 119 bool IsDomainMatch(const std::string& host) const; |
115 | 120 |
| 121 // Returns true if the cookie should be included for the given request |url|. |
| 122 // HTTP only cookies can be filter by using appropriate cookie |options|. |
| 123 // PLEASE NOTE that this method does not check whether a cookie is expired or |
| 124 // not! |
| 125 bool IncludeForRequestURL(const GURL& url, |
| 126 const CookieOptions& options) const; |
| 127 |
116 std::string DebugString() const; | 128 std::string DebugString() const; |
117 | 129 |
118 // Returns the cookie source when cookies are set for |url|. This function | 130 // Returns the cookie source when cookies are set for |url|. This function |
119 // is public for unit test purposes only. | 131 // is public for unit test purposes only. |
120 static std::string GetCookieSourceFromURL(const GURL& url); | 132 static std::string GetCookieSourceFromURL(const GURL& url); |
121 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); | 133 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); |
122 static base::Time CanonExpiration(const ParsedCookie& pc, | 134 static base::Time CanonExpiration(const ParsedCookie& pc, |
123 const base::Time& current, | 135 const base::Time& current, |
124 const base::Time& server_time); | 136 const base::Time& server_time); |
125 | 137 |
126 private: | 138 private: |
127 // The source member of a canonical cookie is the origin of the URL that tried | 139 // The source member of a canonical cookie is the origin of the URL that tried |
128 // to set this cookie, minus the port number if any. This field is not | 140 // to set this cookie, minus the port number if any. This field is not |
(...skipping 16 matching lines...) Expand all Loading... |
145 base::Time last_access_date_; | 157 base::Time last_access_date_; |
146 bool secure_; | 158 bool secure_; |
147 bool httponly_; | 159 bool httponly_; |
148 }; | 160 }; |
149 | 161 |
150 typedef std::vector<CanonicalCookie> CookieList; | 162 typedef std::vector<CanonicalCookie> CookieList; |
151 | 163 |
152 } // namespace net | 164 } // namespace net |
153 | 165 |
154 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 166 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |