| Index: net/cookies/canonical_cookie.cc
|
| diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
|
| index 6c81a55dc7df1d768618d9d76b338a0b0fd79974..4ed5c7c1724383c0024332abdaaca9fd478366fb 100644
|
| --- a/net/cookies/canonical_cookie.cc
|
| +++ b/net/cookies/canonical_cookie.cc
|
| @@ -50,10 +50,12 @@
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| +#include "net/base/url_util.h"
|
| #include "net/cookies/cookie_util.h"
|
| #include "net/cookies/parsed_cookie.h"
|
| #include "url/gurl.h"
|
| #include "url/url_canon.h"
|
| +#include "url/url_util.h"
|
|
|
| using base::Time;
|
| using base::TimeDelta;
|
| @@ -224,6 +226,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
|
| if (options.has_server_time())
|
| server_time = options.server_time();
|
|
|
| + DCHECK(!creation_time.is_null());
|
| Time cookie_expires = CanonicalCookie::CanonExpiration(parsed_cookie,
|
| creation_time,
|
| server_time);
|
| @@ -399,6 +402,34 @@ bool CanonicalCookie::FullCompare(const CanonicalCookie& other) const {
|
| return Priority() < other.Priority();
|
| }
|
|
|
| +bool CanonicalCookie::IsCanonical() const {
|
| + if (name_.empty())
|
| + return false;
|
| +
|
| + if (ParsedCookie::ParseTokenString(name_) != name_ ||
|
| + ParsedCookie::ParseValueString(value_) != value_ ||
|
| + ParsedCookie::ParseValueString(domain_) != domain_ ||
|
| + ParsedCookie::ParseValueString(path_) != path_) {
|
| + return false;
|
| + }
|
| +
|
| + url::CanonHostInfo ignored;
|
| + if (!url::HostIsIPAddress(domain_) &&
|
| + CanonicalizeHost(domain_, &ignored).empty()) {
|
| + return false;
|
| + }
|
| +
|
| + if (path_[0] != '/')
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void CanonicalCookie::SetCreationDate(base::Time new_creation_date) {
|
| + DCHECK(CreationDate().is_null());
|
| + creation_date_ = new_creation_date;
|
| +}
|
| +
|
| // static
|
| CanonicalCookie::CookiePrefix CanonicalCookie::GetCookiePrefix(
|
| const std::string& name) {
|
|
|