| Index: net/extras/sqlite/sqlite_persistent_cookie_store.cc
|
| diff --git a/content/browser/net/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
|
| similarity index 87%
|
| rename from content/browser/net/sqlite_persistent_cookie_store.cc
|
| rename to net/extras/sqlite/sqlite_persistent_cookie_store.cc
|
| index 50b7a667d7a445d1bb966aff68c2d516764a9b2f..cc20ff0ad615d5190902c3bc188e87e4a91e0e09 100644
|
| --- a/content/browser/net/sqlite_persistent_cookie_store.cc
|
| +++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/net/sqlite_persistent_cookie_store.h"
|
| +#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
|
|
|
| #include <list>
|
| #include <map>
|
| @@ -27,9 +27,6 @@
|
| #include "base/synchronization/lock.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "base/time/time.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/cookie_store_factory.h"
|
| -#include "content/public/common/content_switches.h"
|
| #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
| #include "net/cookies/canonical_cookie.h"
|
| #include "net/cookies/cookie_constants.h"
|
| @@ -39,7 +36,6 @@
|
| #include "sql/meta_table.h"
|
| #include "sql/statement.h"
|
| #include "sql/transaction.h"
|
| -#include "storage/browser/quota/special_storage_policy.h"
|
| #include "third_party/sqlite/sqlite3.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -54,7 +50,7 @@ const int kLoadDelayMilliseconds = 200;
|
|
|
| } // namespace
|
|
|
| -namespace content {
|
| +namespace net {
|
|
|
| // This class is designed to be shared between any client thread and the
|
| // background task runner. It batches operations and commits them on a timer.
|
| @@ -86,15 +82,13 @@ class SQLitePersistentCookieStore::Backend
|
| const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
|
| const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
|
| bool restore_old_session_cookies,
|
| - storage::SpecialStoragePolicy* special_storage_policy,
|
| - net::CookieCryptoDelegate* crypto_delegate)
|
| + CookieCryptoDelegate* crypto_delegate)
|
| : path_(path),
|
| num_pending_(0),
|
| force_keep_session_state_(false),
|
| initialized_(false),
|
| corruption_detected_(false),
|
| restore_old_session_cookies_(restore_old_session_cookies),
|
| - special_storage_policy_(special_storage_policy),
|
| num_cookies_read_(0),
|
| client_task_runner_(client_task_runner),
|
| background_task_runner_(background_task_runner),
|
| @@ -110,19 +104,18 @@ class SQLitePersistentCookieStore::Backend
|
| const LoadedCallback& loaded_callback);
|
|
|
| // Steps through all results of |smt|, makes a cookie from each, and adds the
|
| - // cookie to |cookies|. This method also updates |cookies_per_origin_| and
|
| - // |num_cookies_read_|.
|
| - void MakeCookiesFromSQLStatement(std::vector<net::CanonicalCookie*>* cookies,
|
| + // cookie to |cookies|. This method also updates |num_cookies_read_|.
|
| + void MakeCookiesFromSQLStatement(std::vector<CanonicalCookie*>* cookies,
|
| sql::Statement* statement);
|
|
|
| // Batch a cookie addition.
|
| - void AddCookie(const net::CanonicalCookie& cc);
|
| + void AddCookie(const CanonicalCookie& cc);
|
|
|
| // Batch a cookie access time update.
|
| - void UpdateCookieAccessTime(const net::CanonicalCookie& cc);
|
| + void UpdateCookieAccessTime(const CanonicalCookie& cc);
|
|
|
| // Batch a cookie deletion.
|
| - void DeleteCookie(const net::CanonicalCookie& cc);
|
| + void DeleteCookie(const CanonicalCookie& cc);
|
|
|
| // Commit pending operations as soon as possible.
|
| void Flush(const base::Closure& callback);
|
| @@ -133,13 +126,17 @@ class SQLitePersistentCookieStore::Backend
|
|
|
| void SetForceKeepSessionState();
|
|
|
| + // Post background delete of all cookies that match |cookies|.
|
| + void DeleteAllInList(const std::list<CookieOrigin> cookies);
|
| +
|
| private:
|
| friend class base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend>;
|
|
|
| // You should call Close() before destructing this object.
|
| ~Backend() {
|
| DCHECK(!db_.get()) << "Close should have already been called.";
|
| - DCHECK(num_pending_ == 0 && pending_.empty());
|
| + DCHECK_EQ(0u, num_pending_);
|
| + DCHECK(pending_.empty());
|
| }
|
|
|
| // Database upgrade statements.
|
| @@ -147,21 +144,21 @@ class SQLitePersistentCookieStore::Backend
|
|
|
| class PendingOperation {
|
| public:
|
| - typedef enum {
|
| + enum OperationType {
|
| COOKIE_ADD,
|
| COOKIE_UPDATEACCESS,
|
| COOKIE_DELETE,
|
| - } OperationType;
|
| + };
|
|
|
| - PendingOperation(OperationType op, const net::CanonicalCookie& cc)
|
| + PendingOperation(OperationType op, const CanonicalCookie& cc)
|
| : op_(op), cc_(cc) { }
|
|
|
| OperationType op() const { return op_; }
|
| - const net::CanonicalCookie& cc() const { return cc_; }
|
| + const CanonicalCookie& cc() const { return cc_; }
|
|
|
| private:
|
| OperationType op_;
|
| - net::CanonicalCookie cc_;
|
| + CanonicalCookie cc_;
|
| };
|
|
|
| private:
|
| @@ -212,7 +209,7 @@ class SQLitePersistentCookieStore::Backend
|
|
|
| // Batch a cookie operation (add or delete)
|
| void BatchOperation(PendingOperation::OperationType op,
|
| - const net::CanonicalCookie& cc);
|
| + const CanonicalCookie& cc);
|
| // Commit our pending operations to the database.
|
| void Commit();
|
| // Close() executed on the background runner.
|
| @@ -220,7 +217,7 @@ class SQLitePersistentCookieStore::Backend
|
|
|
| void DeleteSessionCookiesOnStartup();
|
|
|
| - void DeleteSessionCookiesOnShutdown();
|
| + void BackgroundDeleteAllInList(const std::list<CookieOrigin> cookies);
|
|
|
| void DatabaseErrorCallback(int error, sql::Statement* stmt);
|
| void KillDatabase();
|
| @@ -235,7 +232,7 @@ class SQLitePersistentCookieStore::Backend
|
| void FinishedLoadingCookies(const LoadedCallback& loaded_callback,
|
| bool success);
|
|
|
| - base::FilePath path_;
|
| + const base::FilePath path_;
|
| scoped_ptr<sql::Connection> db_;
|
| sql::MetaTable meta_table_;
|
|
|
| @@ -250,17 +247,11 @@ class SQLitePersistentCookieStore::Backend
|
| // Temporary buffer for cookies loaded from DB. Accumulates cookies to reduce
|
| // the number of messages sent to the client runner. Sent back in response to
|
| // individual load requests for domain keys or when all loading completes.
|
| - std::vector<net::CanonicalCookie*> cookies_;
|
| + std::vector<CanonicalCookie*> cookies_;
|
|
|
| // Map of domain keys(eTLD+1) to domains/hosts that are to be loaded from DB.
|
| std::map<std::string, std::set<std::string> > keys_to_load_;
|
|
|
| - // Map of (domain keys(eTLD+1), is secure cookie) to number of cookies in the
|
| - // database.
|
| - typedef std::pair<std::string, bool> CookieOrigin;
|
| - typedef std::map<CookieOrigin, int> CookiesPerOriginMap;
|
| - CookiesPerOriginMap cookies_per_origin_;
|
| -
|
| // Indicates if DB has been initialized.
|
| bool initialized_;
|
|
|
| @@ -270,9 +261,6 @@ class SQLitePersistentCookieStore::Backend
|
| // If false, we should filter out session cookies when reading the DB.
|
| bool restore_old_session_cookies_;
|
|
|
| - // Policy defining what data is deleted on shutdown.
|
| - scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
|
| -
|
| // The cumulative time spent loading the cookies on the background runner.
|
| // Incremented and reported from the background runner.
|
| base::TimeDelta cookie_load_duration_;
|
| @@ -299,7 +287,7 @@ class SQLitePersistentCookieStore::Backend
|
| // cookies stored persistently).
|
| //
|
| // Not owned.
|
| - net::CookieCryptoDelegate* crypto_;
|
| + CookieCryptoDelegate* crypto_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Backend);
|
| };
|
| @@ -343,13 +331,13 @@ enum DBCookiePriority {
|
| kCookiePriorityHigh = 2,
|
| };
|
|
|
| -DBCookiePriority CookiePriorityToDBCookiePriority(net::CookiePriority value) {
|
| +DBCookiePriority CookiePriorityToDBCookiePriority(CookiePriority value) {
|
| switch (value) {
|
| - case net::COOKIE_PRIORITY_LOW:
|
| + case COOKIE_PRIORITY_LOW:
|
| return kCookiePriorityLow;
|
| - case net::COOKIE_PRIORITY_MEDIUM:
|
| + case COOKIE_PRIORITY_MEDIUM:
|
| return kCookiePriorityMedium;
|
| - case net::COOKIE_PRIORITY_HIGH:
|
| + case COOKIE_PRIORITY_HIGH:
|
| return kCookiePriorityHigh;
|
| }
|
|
|
| @@ -357,18 +345,18 @@ DBCookiePriority CookiePriorityToDBCookiePriority(net::CookiePriority value) {
|
| return kCookiePriorityMedium;
|
| }
|
|
|
| -net::CookiePriority DBCookiePriorityToCookiePriority(DBCookiePriority value) {
|
| +CookiePriority DBCookiePriorityToCookiePriority(DBCookiePriority value) {
|
| switch (value) {
|
| case kCookiePriorityLow:
|
| - return net::COOKIE_PRIORITY_LOW;
|
| + return COOKIE_PRIORITY_LOW;
|
| case kCookiePriorityMedium:
|
| - return net::COOKIE_PRIORITY_MEDIUM;
|
| + return COOKIE_PRIORITY_MEDIUM;
|
| case kCookiePriorityHigh:
|
| - return net::COOKIE_PRIORITY_HIGH;
|
| + return COOKIE_PRIORITY_HIGH;
|
| }
|
|
|
| NOTREACHED();
|
| - return net::COOKIE_PRIORITY_DEFAULT;
|
| + return COOKIE_PRIORITY_DEFAULT;
|
| }
|
|
|
| // Increments a specified TimeDelta by the duration between this object's
|
| @@ -413,7 +401,7 @@ bool InitTable(sql::Connection* db) {
|
| "priority INTEGER NOT NULL DEFAULT %d,"
|
| "encrypted_value BLOB DEFAULT '',"
|
| "firstpartyonly INTEGER NOT NULL DEFAULT 0)",
|
| - CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT)));
|
| + CookiePriorityToDBCookiePriority(COOKIE_PRIORITY_DEFAULT)));
|
| if (!db->Execute(stmt.c_str()))
|
| return false;
|
| }
|
| @@ -573,7 +561,7 @@ void SQLitePersistentCookieStore::Backend::Notify(
|
| bool load_success) {
|
| DCHECK(client_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| - std::vector<net::CanonicalCookie*> cookies;
|
| + std::vector<CanonicalCookie*> cookies;
|
| {
|
| base::AutoLock locked(lock_);
|
| cookies.swap(cookies_);
|
| @@ -664,9 +652,9 @@ bool SQLitePersistentCookieStore::Backend::InitializeDatabase() {
|
| for (size_t idx = 0; idx < host_keys.size(); ++idx) {
|
| const std::string& domain = host_keys[idx];
|
| std::string key =
|
| - net::registry_controlled_domains::GetDomainAndRegistry(
|
| + registry_controlled_domains::GetDomainAndRegistry(
|
| domain,
|
| - net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
|
| + registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
|
|
|
| keys_to_load_[key].insert(domain);
|
| }
|
| @@ -748,7 +736,7 @@ bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
|
| return false;
|
| }
|
|
|
| - std::vector<net::CanonicalCookie*> cookies;
|
| + std::vector<CanonicalCookie*> cookies;
|
| std::set<std::string>::const_iterator it = domains.begin();
|
| for (; it != domains.end(); ++it) {
|
| smt.BindString(0, *it);
|
| @@ -763,7 +751,7 @@ bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
|
| }
|
|
|
| void SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
|
| - std::vector<net::CanonicalCookie*>* cookies,
|
| + std::vector<CanonicalCookie*>* cookies,
|
| sql::Statement* statement) {
|
| sql::Statement& smt = *statement;
|
| while (smt.Step()) {
|
| @@ -775,7 +763,7 @@ void SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
|
| DCHECK(encrypted_value.empty());
|
| value = smt.ColumnString(3);
|
| }
|
| - scoped_ptr<net::CanonicalCookie> cc(new net::CanonicalCookie(
|
| + scoped_ptr<CanonicalCookie> cc(new CanonicalCookie(
|
| // The "source" URL is not used with persisted cookies.
|
| GURL(), // Source
|
| smt.ColumnString(2), // name
|
| @@ -792,7 +780,6 @@ void SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement(
|
| static_cast<DBCookiePriority>(smt.ColumnInt(13))))); // priority
|
| DLOG_IF(WARNING, cc->CreationDate() > Time::Now())
|
| << L"CreationDate too recent";
|
| - cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++;
|
| cookies->push_back(cc.release());
|
| ++num_cookies_read_;
|
| }
|
| @@ -891,7 +878,7 @@ bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
|
| // Alter the table to add the priority column with a default value.
|
| std::string stmt(base::StringPrintf(
|
| "ALTER TABLE cookies ADD COLUMN priority INTEGER DEFAULT %d",
|
| - CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT)));
|
| + CookiePriorityToDBCookiePriority(COOKIE_PRIORITY_DEFAULT)));
|
| if (!db_->Execute(stmt.c_str())) {
|
| LOG(WARNING) << "Unable to update cookie database to version 6.";
|
| return false;
|
| @@ -969,23 +956,23 @@ bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
|
| }
|
|
|
| void SQLitePersistentCookieStore::Backend::AddCookie(
|
| - const net::CanonicalCookie& cc) {
|
| + const CanonicalCookie& cc) {
|
| BatchOperation(PendingOperation::COOKIE_ADD, cc);
|
| }
|
|
|
| void SQLitePersistentCookieStore::Backend::UpdateCookieAccessTime(
|
| - const net::CanonicalCookie& cc) {
|
| + const CanonicalCookie& cc) {
|
| BatchOperation(PendingOperation::COOKIE_UPDATEACCESS, cc);
|
| }
|
|
|
| void SQLitePersistentCookieStore::Backend::DeleteCookie(
|
| - const net::CanonicalCookie& cc) {
|
| + const CanonicalCookie& cc) {
|
| BatchOperation(PendingOperation::COOKIE_DELETE, cc);
|
| }
|
|
|
| void SQLitePersistentCookieStore::Backend::BatchOperation(
|
| PendingOperation::OperationType op,
|
| - const net::CanonicalCookie& cc) {
|
| + const CanonicalCookie& cc) {
|
| // Commit every 30 seconds.
|
| static const int kCommitIntervalMs = 30 * 1000;
|
| // Commit right away if we have more than 512 outstanding operations.
|
| @@ -1058,8 +1045,6 @@ void SQLitePersistentCookieStore::Backend::Commit() {
|
| scoped_ptr<PendingOperation> po(*it);
|
| switch (po->op()) {
|
| case PendingOperation::COOKIE_ADD:
|
| - cookies_per_origin_[
|
| - CookieOrigin(po->cc().Domain(), po->cc().IsSecure())]++;
|
| add_smt.Reset(true);
|
| add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
|
| add_smt.BindString(1, po->cc().Domain());
|
| @@ -1100,8 +1085,6 @@ void SQLitePersistentCookieStore::Backend::Commit() {
|
| break;
|
|
|
| case PendingOperation::COOKIE_DELETE:
|
| - cookies_per_origin_[
|
| - CookieOrigin(po->cc().Domain(), po->cc().IsSecure())]--;
|
| del_smt.Reset(true);
|
| del_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
|
| if (!del_smt.Run())
|
| @@ -1149,59 +1132,17 @@ void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
|
| // Commit any pending operations
|
| Commit();
|
|
|
| +#if 0
|
| if (!force_keep_session_state_ && special_storage_policy_.get() &&
|
| special_storage_policy_->HasSessionOnlyOrigins()) {
|
| DeleteSessionCookiesOnShutdown();
|
| }
|
| +#endif
|
|
|
| meta_table_.Reset();
|
| db_.reset();
|
| }
|
|
|
| -void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnShutdown() {
|
| - DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
|
| -
|
| - if (!db_)
|
| - return;
|
| -
|
| - if (!special_storage_policy_.get())
|
| - return;
|
| -
|
| - sql::Statement del_smt(db_->GetCachedStatement(
|
| - SQL_FROM_HERE, "DELETE FROM cookies WHERE host_key=? AND secure=?"));
|
| - if (!del_smt.is_valid()) {
|
| - LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| - return;
|
| - }
|
| -
|
| - sql::Transaction transaction(db_.get());
|
| - if (!transaction.Begin()) {
|
| - LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| - return;
|
| - }
|
| -
|
| - for (CookiesPerOriginMap::iterator it = cookies_per_origin_.begin();
|
| - it != cookies_per_origin_.end(); ++it) {
|
| - if (it->second <= 0) {
|
| - DCHECK_EQ(0, it->second);
|
| - continue;
|
| - }
|
| - const GURL url(net::cookie_util::CookieOriginToURL(it->first.first,
|
| - it->first.second));
|
| - if (!url.is_valid() || !special_storage_policy_->IsStorageSessionOnly(url))
|
| - continue;
|
| -
|
| - del_smt.Reset(true);
|
| - del_smt.BindString(0, it->first.first);
|
| - del_smt.BindInt(1, it->first.second);
|
| - if (!del_smt.Run())
|
| - NOTREACHED() << "Could not delete a cookie from the DB.";
|
| - }
|
| -
|
| - if (!transaction.Commit())
|
| - LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| -}
|
| -
|
| void SQLitePersistentCookieStore::Backend::DatabaseErrorCallback(
|
| int error,
|
| sql::Statement* stmt) {
|
| @@ -1243,12 +1184,57 @@ void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() {
|
| force_keep_session_state_ = true;
|
| }
|
|
|
| +void SQLitePersistentCookieStore::Backend::DeleteAllInList(
|
| + const std::list<CookieOrigin> cookies) {
|
| + if (cookies.empty())
|
| + return;
|
| +
|
| + // Perform deletion on background task runner.
|
| + background_task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &Backend::BackgroundDeleteAllInList, this, cookies));
|
| +}
|
| +
|
| void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() {
|
| DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
|
| if (!db_->Execute("DELETE FROM cookies WHERE persistent == 0"))
|
| LOG(WARNING) << "Unable to delete session cookies.";
|
| }
|
|
|
| +void SQLitePersistentCookieStore::Backend::BackgroundDeleteAllInList(
|
| + const std::list<CookieOrigin> cookies) {
|
| + DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
|
| +
|
| + if (!db_)
|
| + return;
|
| +
|
| + sql::Statement del_smt(db_->GetCachedStatement(
|
| + SQL_FROM_HERE, "DELETE FROM cookies WHERE host_key=? AND secure=?"));
|
| + if (!del_smt.is_valid()) {
|
| + LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| + return;
|
| + }
|
| +
|
| + sql::Transaction transaction(db_.get());
|
| + if (!transaction.Begin()) {
|
| + LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| + return;
|
| + }
|
| +
|
| + for (auto it = cookies.begin(); it != cookies.end(); ++it) {
|
| + const GURL url(cookie_util::CookieOriginToURL(it->first, it->second));
|
| + del_smt.Reset(true);
|
| + del_smt.BindString(0, it->first);
|
| + del_smt.BindInt(1, it->second);
|
| + if (!del_smt.Run())
|
| + NOTREACHED() << "Could not delete a cookie from the DB.";
|
| + }
|
| +
|
| + if (!transaction.Commit())
|
| + LOG(WARNING) << "Unable to delete cookies on shutdown.";
|
| +}
|
| +
|
| void SQLitePersistentCookieStore::Backend::PostBackgroundTask(
|
| const tracked_objects::Location& origin, const base::Closure& task) {
|
| if (!background_task_runner_->PostTask(origin, task)) {
|
| @@ -1279,16 +1265,19 @@ SQLitePersistentCookieStore::SQLitePersistentCookieStore(
|
| const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
|
| const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
|
| bool restore_old_session_cookies,
|
| - storage::SpecialStoragePolicy* special_storage_policy,
|
| - net::CookieCryptoDelegate* crypto_delegate)
|
| + CookieCryptoDelegate* crypto_delegate)
|
| : backend_(new Backend(path,
|
| client_task_runner,
|
| background_task_runner,
|
| restore_old_session_cookies,
|
| - special_storage_policy,
|
| crypto_delegate)) {
|
| }
|
|
|
| +void SQLitePersistentCookieStore::DeleteAllInList(
|
| + std::list<CookieOrigin> cookies) {
|
| + backend_->DeleteAllInList(cookies);
|
| +}
|
| +
|
| void SQLitePersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
|
| backend_->Load(loaded_callback);
|
| }
|
| @@ -1299,16 +1288,16 @@ void SQLitePersistentCookieStore::LoadCookiesForKey(
|
| backend_->LoadCookiesForKey(key, loaded_callback);
|
| }
|
|
|
| -void SQLitePersistentCookieStore::AddCookie(const net::CanonicalCookie& cc) {
|
| +void SQLitePersistentCookieStore::AddCookie(const CanonicalCookie& cc) {
|
| backend_->AddCookie(cc);
|
| }
|
|
|
| void SQLitePersistentCookieStore::UpdateCookieAccessTime(
|
| - const net::CanonicalCookie& cc) {
|
| + const CanonicalCookie& cc) {
|
| backend_->UpdateCookieAccessTime(cc);
|
| }
|
|
|
| -void SQLitePersistentCookieStore::DeleteCookie(const net::CanonicalCookie& cc) {
|
| +void SQLitePersistentCookieStore::DeleteCookie(const CanonicalCookie& cc) {
|
| backend_->DeleteCookie(cc);
|
| }
|
|
|
| @@ -1326,77 +1315,4 @@ SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
|
| // a reference if the background runner has not run Close() yet.
|
| }
|
|
|
| -CookieStoreConfig::CookieStoreConfig()
|
| - : session_cookie_mode(EPHEMERAL_SESSION_COOKIES),
|
| - crypto_delegate(NULL) {
|
| - // Default to an in-memory cookie store.
|
| -}
|
| -
|
| -CookieStoreConfig::CookieStoreConfig(
|
| - const base::FilePath& path,
|
| - SessionCookieMode session_cookie_mode,
|
| - storage::SpecialStoragePolicy* storage_policy,
|
| - net::CookieMonsterDelegate* cookie_delegate)
|
| - : path(path),
|
| - session_cookie_mode(session_cookie_mode),
|
| - storage_policy(storage_policy),
|
| - cookie_delegate(cookie_delegate),
|
| - crypto_delegate(NULL) {
|
| - CHECK(!path.empty() || session_cookie_mode == EPHEMERAL_SESSION_COOKIES);
|
| -}
|
| -
|
| -CookieStoreConfig::~CookieStoreConfig() {
|
| -}
|
| -
|
| -net::CookieStore* CreateCookieStore(const CookieStoreConfig& config) {
|
| - net::CookieMonster* cookie_monster = NULL;
|
| -
|
| - if (config.path.empty()) {
|
| - // Empty path means in-memory store.
|
| - cookie_monster = new net::CookieMonster(NULL, config.cookie_delegate.get());
|
| - } else {
|
| - scoped_refptr<base::SequencedTaskRunner> client_task_runner =
|
| - config.client_task_runner;
|
| - scoped_refptr<base::SequencedTaskRunner> background_task_runner =
|
| - config.background_task_runner;
|
| -
|
| - if (!client_task_runner.get()) {
|
| - client_task_runner =
|
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
|
| - }
|
| -
|
| - if (!background_task_runner.get()) {
|
| - background_task_runner =
|
| - BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
|
| - BrowserThread::GetBlockingPool()->GetSequenceToken());
|
| - }
|
| -
|
| - SQLitePersistentCookieStore* persistent_store =
|
| - new SQLitePersistentCookieStore(
|
| - config.path,
|
| - client_task_runner,
|
| - background_task_runner,
|
| - (config.session_cookie_mode ==
|
| - CookieStoreConfig::RESTORED_SESSION_COOKIES),
|
| - config.storage_policy.get(),
|
| - config.crypto_delegate);
|
| -
|
| - cookie_monster =
|
| - new net::CookieMonster(persistent_store, config.cookie_delegate.get());
|
| - if ((config.session_cookie_mode ==
|
| - CookieStoreConfig::PERSISTANT_SESSION_COOKIES) ||
|
| - (config.session_cookie_mode ==
|
| - CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
|
| - cookie_monster->SetPersistSessionCookies(true);
|
| - }
|
| - }
|
| -
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableFileCookies)) {
|
| - cookie_monster->SetEnableFileScheme(true);
|
| - }
|
| -
|
| - return cookie_monster;
|
| -}
|
| -
|
| -} // namespace content
|
| +} // namespace net
|
|
|