| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 const GURL& url, const std::string& name, const std::string& value, | 604 const GURL& url, const std::string& name, const std::string& value, |
| 605 const std::string& domain, const std::string& path, | 605 const std::string& domain, const std::string& path, |
| 606 const base::Time& expiration_time, bool secure, bool http_only, | 606 const base::Time& expiration_time, bool secure, bool http_only, |
| 607 const SetCookiesCallback& callback) { | 607 const SetCookiesCallback& callback) { |
| 608 bool success_ = SetCookieWithDetails(url, name, value, domain, path, | 608 bool success_ = SetCookieWithDetails(url, name, value, domain, path, |
| 609 expiration_time, secure, http_only); | 609 expiration_time, secure, http_only); |
| 610 if (!callback.is_null()) | 610 if (!callback.is_null()) |
| 611 callback.Run(success_); | 611 callback.Run(success_); |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool CookieMonster::InitializeFrom(CookieMonster* cookie_monster) { | 614 bool CookieMonster::InitializeFrom(const CookieList& list) { |
| 615 net::CookieList list = cookie_monster->GetAllCookies(); | |
| 616 | |
| 617 base::AutoLock autolock(lock_); | 615 base::AutoLock autolock(lock_); |
| 618 InitIfNecessary(); | 616 InitIfNecessary(); |
| 619 for (net::CookieList::const_iterator iter = list.begin(); | 617 for (net::CookieList::const_iterator iter = list.begin(); |
| 620 iter != list.end(); ++iter) { | 618 iter != list.end(); ++iter) { |
| 621 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie; | 619 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie; |
| 622 cookie.reset(new net::CookieMonster::CanonicalCookie(*iter)); | 620 cookie.reset(new net::CookieMonster::CanonicalCookie(*iter)); |
| 623 net::CookieOptions options; | 621 net::CookieOptions options; |
| 624 options.set_include_httponly(); | 622 options.set_include_httponly(); |
| 625 if (!SetCanonicalCookie(&cookie, cookie->CreationDate(), | 623 if (!SetCanonicalCookie(&cookie, cookie->CreationDate(), |
| 626 options)) { | 624 options)) { |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 std::string CookieMonster::CanonicalCookie::DebugString() const { | 2274 std::string CookieMonster::CanonicalCookie::DebugString() const { |
| 2277 return base::StringPrintf( | 2275 return base::StringPrintf( |
| 2278 "name: %s value: %s domain: %s path: %s creation: %" | 2276 "name: %s value: %s domain: %s path: %s creation: %" |
| 2279 PRId64, | 2277 PRId64, |
| 2280 name_.c_str(), value_.c_str(), | 2278 name_.c_str(), value_.c_str(), |
| 2281 domain_.c_str(), path_.c_str(), | 2279 domain_.c_str(), path_.c_str(), |
| 2282 static_cast<int64>(creation_date_.ToTimeT())); | 2280 static_cast<int64>(creation_date_.ToTimeT())); |
| 2283 } | 2281 } |
| 2284 | 2282 |
| 2285 } // namespace | 2283 } // namespace |
| OLD | NEW |