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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 // algorithm dependent on the scheme, and make sure that the scheme is | 1898 // algorithm dependent on the scheme, and make sure that the scheme is |
1899 // available everywhere the key must be obtained (specfically at backing | 1899 // available everywhere the key must be obtained (specfically at backing |
1900 // store load time). This would require either changing the backing store | 1900 // store load time). This would require either changing the backing store |
1901 // database schema to include the scheme (far more trouble than it's worth), or | 1901 // database schema to include the scheme (far more trouble than it's worth), or |
1902 // separating out file cookies into their own CookieMonster instance and | 1902 // separating out file cookies into their own CookieMonster instance and |
1903 // thus restricting each scheme to a single cookie monster (which might | 1903 // thus restricting each scheme to a single cookie monster (which might |
1904 // be worth it, but is still too much trouble to solve what is currently a | 1904 // be worth it, but is still too much trouble to solve what is currently a |
1905 // non-problem). | 1905 // non-problem). |
1906 std::string CookieMonster::GetKey(const std::string& domain) const { | 1906 std::string CookieMonster::GetKey(const std::string& domain) const { |
1907 std::string effective_domain( | 1907 std::string effective_domain( |
1908 RegistryControlledDomainService::GetDomainAndRegistry(domain)); | 1908 RegistryControlledDomainService::GetDomainAndRegistry( |
| 1909 domain, RCDS::EXCLUDE_PRIVATE_REGISTRIES)); |
1909 if (effective_domain.empty()) | 1910 if (effective_domain.empty()) |
1910 effective_domain = domain; | 1911 effective_domain = domain; |
1911 | 1912 |
1912 if (!effective_domain.empty() && effective_domain[0] == '.') | 1913 if (!effective_domain.empty() && effective_domain[0] == '.') |
1913 return effective_domain.substr(1); | 1914 return effective_domain.substr(1); |
1914 return effective_domain; | 1915 return effective_domain; |
1915 } | 1916 } |
1916 | 1917 |
1917 bool CookieMonster::IsCookieableScheme(const std::string& scheme) { | 1918 bool CookieMonster::IsCookieableScheme(const std::string& scheme) { |
1918 base::AutoLock autolock(lock_); | 1919 base::AutoLock autolock(lock_); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 | 2069 |
2069 // The system resolution is not high enough, so we can have multiple | 2070 // The system resolution is not high enough, so we can have multiple |
2070 // set cookies that result in the same system time. When this happens, we | 2071 // set cookies that result in the same system time. When this happens, we |
2071 // increment by one Time unit. Let's hope computers don't get too fast. | 2072 // increment by one Time unit. Let's hope computers don't get too fast. |
2072 Time CookieMonster::CurrentTime() { | 2073 Time CookieMonster::CurrentTime() { |
2073 return std::max(Time::Now(), | 2074 return std::max(Time::Now(), |
2074 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); | 2075 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); |
2075 } | 2076 } |
2076 | 2077 |
2077 } // namespace net | 2078 } // namespace net |
OLD | NEW |