| 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 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 5 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 if (!db_->Execute("DELETE FROM cookies WHERE persistent == 0")) | 918 if (!db_->Execute("DELETE FROM cookies WHERE persistent == 0")) |
| 919 LOG(WARNING) << "Unable to delete session cookies."; | 919 LOG(WARNING) << "Unable to delete session cookies."; |
| 920 } | 920 } |
| 921 | 921 |
| 922 SQLitePersistentCookieStore::SQLitePersistentCookieStore( | 922 SQLitePersistentCookieStore::SQLitePersistentCookieStore( |
| 923 const FilePath& path, | 923 const FilePath& path, |
| 924 bool restore_old_session_cookies) | 924 bool restore_old_session_cookies) |
| 925 : backend_(new Backend(path, restore_old_session_cookies)) { | 925 : backend_(new Backend(path, restore_old_session_cookies)) { |
| 926 } | 926 } |
| 927 | 927 |
| 928 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { | |
| 929 if (backend_.get()) { | |
| 930 backend_->Close(); | |
| 931 // Release our reference, it will probably still have a reference if the | |
| 932 // background thread has not run Close() yet. | |
| 933 backend_ = NULL; | |
| 934 } | |
| 935 } | |
| 936 | |
| 937 void SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) { | 928 void SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) { |
| 938 backend_->Load(loaded_callback); | 929 backend_->Load(loaded_callback); |
| 939 } | 930 } |
| 940 | 931 |
| 941 void SQLitePersistentCookieStore::LoadCookiesForKey( | 932 void SQLitePersistentCookieStore::LoadCookiesForKey( |
| 942 const std::string& key, | 933 const std::string& key, |
| 943 const LoadedCallback& loaded_callback) { | 934 const LoadedCallback& loaded_callback) { |
| 944 backend_->LoadCookiesForKey(key, loaded_callback); | 935 backend_->LoadCookiesForKey(key, loaded_callback); |
| 945 } | 936 } |
| 946 | 937 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 967 if (backend_.get()) | 958 if (backend_.get()) |
| 968 backend_->SetClearLocalStateOnExit(clear_local_state); | 959 backend_->SetClearLocalStateOnExit(clear_local_state); |
| 969 } | 960 } |
| 970 | 961 |
| 971 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { | 962 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { |
| 972 if (backend_.get()) | 963 if (backend_.get()) |
| 973 backend_->Flush(callback); | 964 backend_->Flush(callback); |
| 974 else if (!callback.is_null()) | 965 else if (!callback.is_null()) |
| 975 MessageLoop::current()->PostTask(FROM_HERE, callback); | 966 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 976 } | 967 } |
| 968 |
| 969 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { |
| 970 if (backend_.get()) { |
| 971 backend_->Close(); |
| 972 // Release our reference, it will probably still have a reference if the |
| 973 // background thread has not run Close() yet. |
| 974 backend_ = NULL; |
| 975 } |
| 976 } |
| OLD | NEW |