| 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_COOKIE_UTIL_H_ | 5 #ifndef NET_COOKIES_COOKIE_UTIL_H_ |
| 6 #define NET_COOKIES_COOKIE_UTIL_H_ | 6 #define NET_COOKIES_COOKIE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time.h" |
| 10 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 11 | 12 |
| 12 class GURL; | 13 class GURL; |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 namespace cookie_util { | 16 namespace cookie_util { |
| 16 | 17 |
| 17 // Returns the effective TLD+1 for a given host. This only makes sense for http | 18 // Returns the effective TLD+1 for a given host. This only makes sense for http |
| 18 // and https schemes. For other schemes, the host will be returned unchanged | 19 // and https schemes. For other schemes, the host will be returned unchanged |
| 19 // (minus any leading period). | 20 // (minus any leading period). |
| 20 NET_EXPORT std::string GetEffectiveDomain(const std::string& scheme, | 21 NET_EXPORT std::string GetEffectiveDomain(const std::string& scheme, |
| 21 const std::string& host); | 22 const std::string& host); |
| 22 | 23 |
| 23 // Determine the actual cookie domain based on the domain string passed | 24 // Determine the actual cookie domain based on the domain string passed |
| 24 // (if any) and the URL from which the cookie came. | 25 // (if any) and the URL from which the cookie came. |
| 25 // On success returns true, and sets cookie_domain to either a | 26 // On success returns true, and sets cookie_domain to either a |
| 26 // -host cookie domain (ex: "google.com") | 27 // -host cookie domain (ex: "google.com") |
| 27 // -domain cookie domain (ex: ".google.com") | 28 // -domain cookie domain (ex: ".google.com") |
| 28 NET_EXPORT bool GetCookieDomainWithString(const GURL& url, | 29 NET_EXPORT bool GetCookieDomainWithString(const GURL& url, |
| 29 const std::string& domain_string, | 30 const std::string& domain_string, |
| 30 std::string* result); | 31 std::string* result); |
| 31 | 32 |
| 32 // Returns true if a domain string represents a host-only cookie, | 33 // Returns true if a domain string represents a host-only cookie, |
| 33 // i.e. it doesn't begin with a leading '.' character. | 34 // i.e. it doesn't begin with a leading '.' character. |
| 34 NET_EXPORT bool DomainIsHostOnly(const std::string& domain_string); | 35 NET_EXPORT bool DomainIsHostOnly(const std::string& domain_string); |
| 35 | 36 |
| 37 // Parses the string with the cookie time (very forgivingly). |
| 38 NET_EXPORT base::Time ParseCookieTime(const std::string& time_string); |
| 39 |
| 36 } // namspace cookie_util | 40 } // namspace cookie_util |
| 37 } // namespace net | 41 } // namespace net |
| 38 | 42 |
| 39 #endif // NET_COOKIES_COOKIE_UTIL_H_ | 43 #endif // NET_COOKIES_COOKIE_UTIL_H_ |
| OLD | NEW |