| 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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 | 1366 |
| 1367 cookieable_schemes_.clear(); | 1367 cookieable_schemes_.clear(); |
| 1368 cookieable_schemes_.insert(cookieable_schemes_.end(), | 1368 cookieable_schemes_.insert(cookieable_schemes_.end(), |
| 1369 schemes, schemes + num_schemes); | 1369 schemes, schemes + num_schemes); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 void CookieMonster::SetKeepExpiredCookies() { | 1372 void CookieMonster::SetKeepExpiredCookies() { |
| 1373 keep_expired_cookies_ = true; | 1373 keep_expired_cookies_ = true; |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void CookieMonster::SetClearPersistentStoreOnExit(bool clear_local_store) { | |
| 1377 if (store_) | |
| 1378 store_->SetClearLocalStateOnExit(clear_local_store); | |
| 1379 } | |
| 1380 | |
| 1381 // static | 1376 // static |
| 1382 void CookieMonster::EnableFileScheme() { | 1377 void CookieMonster::EnableFileScheme() { |
| 1383 enable_file_scheme_ = true; | 1378 enable_file_scheme_ = true; |
| 1384 } | 1379 } |
| 1385 | 1380 |
| 1386 void CookieMonster::FlushStore(const base::Closure& callback) { | 1381 void CookieMonster::FlushStore(const base::Closure& callback) { |
| 1387 base::AutoLock autolock(lock_); | 1382 base::AutoLock autolock(lock_); |
| 1388 if (initialized_ && store_) | 1383 if (initialized_ && store_) |
| 1389 store_->Flush(callback); | 1384 store_->Flush(callback); |
| 1390 else if (!callback.is_null()) | 1385 else if (!callback.is_null()) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 } | 1503 } |
| 1509 | 1504 |
| 1510 void CookieMonster::SetPersistSessionCookies(bool persist_session_cookies) { | 1505 void CookieMonster::SetPersistSessionCookies(bool persist_session_cookies) { |
| 1511 // This function must be called before the CookieMonster is used. | 1506 // This function must be called before the CookieMonster is used. |
| 1512 DCHECK(!initialized_); | 1507 DCHECK(!initialized_); |
| 1513 persist_session_cookies_ = persist_session_cookies; | 1508 persist_session_cookies_ = persist_session_cookies; |
| 1514 } | 1509 } |
| 1515 | 1510 |
| 1516 void CookieMonster::SaveSessionCookies() { | 1511 void CookieMonster::SaveSessionCookies() { |
| 1517 if (store_) { | 1512 if (store_) { |
| 1518 store_->SetClearLocalStateOnExit(false); | 1513 store_->SetKeepSessionCookies(); |
| 1519 } | 1514 } |
| 1520 } | 1515 } |
| 1521 | 1516 |
| 1522 CookieMonster::~CookieMonster() { | 1517 CookieMonster::~CookieMonster() { |
| 1523 DeleteAll(false); | 1518 DeleteAll(false); |
| 1524 } | 1519 } |
| 1525 | 1520 |
| 1526 bool CookieMonster::SetCookieWithCreationTime(const GURL& url, | 1521 bool CookieMonster::SetCookieWithCreationTime(const GURL& url, |
| 1527 const std::string& cookie_line, | 1522 const std::string& cookie_line, |
| 1528 const base::Time& creation_time) { | 1523 const base::Time& creation_time) { |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 std::string CookieMonster::CanonicalCookie::DebugString() const { | 2840 std::string CookieMonster::CanonicalCookie::DebugString() const { |
| 2846 return base::StringPrintf( | 2841 return base::StringPrintf( |
| 2847 "name: %s value: %s domain: %s path: %s creation: %" | 2842 "name: %s value: %s domain: %s path: %s creation: %" |
| 2848 PRId64, | 2843 PRId64, |
| 2849 name_.c_str(), value_.c_str(), | 2844 name_.c_str(), value_.c_str(), |
| 2850 domain_.c_str(), path_.c_str(), | 2845 domain_.c_str(), path_.c_str(), |
| 2851 static_cast<int64>(creation_date_.ToTimeT())); | 2846 static_cast<int64>(creation_date_.ToTimeT())); |
| 2852 } | 2847 } |
| 2853 | 2848 |
| 2854 } // namespace | 2849 } // namespace |
| OLD | NEW |