Chromium Code Reviews| 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 "content/browser/net/sqlite_persistent_cookie_store.h" | 5 #include "content/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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/sequenced_task_runner.h" | 23 #include "base/sequenced_task_runner.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
| 27 #include "base/threading/sequenced_worker_pool.h" | 27 #include "base/threading/sequenced_worker_pool.h" |
| 28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 29 #include "components/webdata/encryptor/encryptor.h" | |
| 29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/cookie_store_factory.h" | 31 #include "content/public/browser/cookie_store_factory.h" |
| 31 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 32 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 32 #include "net/cookies/canonical_cookie.h" | 33 #include "net/cookies/canonical_cookie.h" |
| 33 #include "net/cookies/cookie_constants.h" | 34 #include "net/cookies/cookie_constants.h" |
| 34 #include "net/cookies/cookie_util.h" | 35 #include "net/cookies/cookie_util.h" |
| 35 #include "sql/error_delegate_util.h" | 36 #include "sql/error_delegate_util.h" |
| 36 #include "sql/meta_table.h" | 37 #include "sql/meta_table.h" |
| 37 #include "sql/statement.h" | 38 #include "sql/statement.h" |
| 38 #include "sql/transaction.h" | 39 #include "sql/transaction.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 // than 1. | 271 // than 1. |
| 271 base::TimeDelta priority_wait_duration_; | 272 base::TimeDelta priority_wait_duration_; |
| 272 | 273 |
| 273 DISALLOW_COPY_AND_ASSIGN(Backend); | 274 DISALLOW_COPY_AND_ASSIGN(Backend); |
| 274 }; | 275 }; |
| 275 | 276 |
| 276 namespace { | 277 namespace { |
| 277 | 278 |
| 278 // Version number of the database. | 279 // Version number of the database. |
| 279 // | 280 // |
| 281 // Version 7 adds encrypted values. Old values will continue to be used but | |
| 282 // all new values written will be encrypted on selected operating systems. | |
| 283 // | |
| 280 // Version 6 adds cookie priorities. This allows developers to influence the | 284 // Version 6 adds cookie priorities. This allows developers to influence the |
| 281 // order in which cookies are evicted in order to meet domain cookie limits. | 285 // order in which cookies are evicted in order to meet domain cookie limits. |
| 282 // | 286 // |
| 283 // Version 5 adds the columns has_expires and is_persistent, so that the | 287 // Version 5 adds the columns has_expires and is_persistent, so that the |
| 284 // database can store session cookies as well as persistent cookies. Databases | 288 // database can store session cookies as well as persistent cookies. Databases |
| 285 // of version 5 are incompatible with older versions of code. If a database of | 289 // of version 5 are incompatible with older versions of code. If a database of |
| 286 // version 5 is read by older code, session cookies will be treated as normal | 290 // version 5 is read by older code, session cookies will be treated as normal |
| 287 // cookies. Currently, these fields are written, but not read anymore. | 291 // cookies. Currently, these fields are written, but not read anymore. |
| 288 // | 292 // |
| 289 // In version 4, we migrated the time epoch. If you open the DB with an older | 293 // In version 4, we migrated the time epoch. If you open the DB with an older |
| 290 // version on Mac or Linux, the times will look wonky, but the file will likely | 294 // version on Mac or Linux, the times will look wonky, but the file will likely |
| 291 // be usable. On Windows version 3 and 4 are the same. | 295 // be usable. On Windows version 3 and 4 are the same. |
| 292 // | 296 // |
| 293 // Version 3 updated the database to include the last access time, so we can | 297 // Version 3 updated the database to include the last access time, so we can |
| 294 // expire them in decreasing order of use when we've reached the maximum | 298 // expire them in decreasing order of use when we've reached the maximum |
| 295 // number of cookies. | 299 // number of cookies. |
| 296 const int kCurrentVersionNumber = 6; | 300 const int kCurrentVersionNumber = 7; |
| 297 const int kCompatibleVersionNumber = 5; | 301 const int kCompatibleVersionNumber = 5; |
| 298 | 302 |
| 299 // Possible values for the 'priority' column. | 303 // Possible values for the 'priority' column. |
| 300 enum DBCookiePriority { | 304 enum DBCookiePriority { |
| 301 kCookiePriorityLow = 0, | 305 kCookiePriorityLow = 0, |
| 302 kCookiePriorityMedium = 1, | 306 kCookiePriorityMedium = 1, |
| 303 kCookiePriorityHigh = 2, | 307 kCookiePriorityHigh = 2, |
| 304 }; | 308 }; |
| 305 | 309 |
| 306 DBCookiePriority CookiePriorityToDBCookiePriority(net::CookiePriority value) { | 310 DBCookiePriority CookiePriorityToDBCookiePriority(net::CookiePriority value) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 360 |
| 357 // Initializes the cookies table, returning true on success. | 361 // Initializes the cookies table, returning true on success. |
| 358 bool InitTable(sql::Connection* db) { | 362 bool InitTable(sql::Connection* db) { |
| 359 if (!db->DoesTableExist("cookies")) { | 363 if (!db->DoesTableExist("cookies")) { |
| 360 std::string stmt(base::StringPrintf( | 364 std::string stmt(base::StringPrintf( |
| 361 "CREATE TABLE cookies (" | 365 "CREATE TABLE cookies (" |
| 362 "creation_utc INTEGER NOT NULL UNIQUE PRIMARY KEY," | 366 "creation_utc INTEGER NOT NULL UNIQUE PRIMARY KEY," |
| 363 "host_key TEXT NOT NULL," | 367 "host_key TEXT NOT NULL," |
| 364 "name TEXT NOT NULL," | 368 "name TEXT NOT NULL," |
| 365 "value TEXT NOT NULL," | 369 "value TEXT NOT NULL," |
| 370 "encrypted_value BLOB NOT NULL," | |
|
Scott Hess - ex-Googler
2013/09/27 23:07:12
Put the encrypted_value at the end so that the cre
bcwhite
2013/09/30 15:04:29
Done.
| |
| 366 "path TEXT NOT NULL," | 371 "path TEXT NOT NULL," |
| 367 "expires_utc INTEGER NOT NULL," | 372 "expires_utc INTEGER NOT NULL," |
| 368 "secure INTEGER NOT NULL," | 373 "secure INTEGER NOT NULL," |
| 369 "httponly INTEGER NOT NULL," | 374 "httponly INTEGER NOT NULL," |
| 370 "last_access_utc INTEGER NOT NULL, " | 375 "last_access_utc INTEGER NOT NULL, " |
| 371 "has_expires INTEGER NOT NULL DEFAULT 1, " | 376 "has_expires INTEGER NOT NULL DEFAULT 1, " |
| 372 "persistent INTEGER NOT NULL DEFAULT 1," | 377 "persistent INTEGER NOT NULL DEFAULT 1," |
| 373 "priority INTEGER NOT NULL DEFAULT %d)", | 378 "priority INTEGER NOT NULL DEFAULT %d)", |
| 374 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); | 379 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); |
| 375 if (!db->Execute(stmt.c_str())) | 380 if (!db->Execute(stmt.c_str())) |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 } | 677 } |
| 673 | 678 |
| 674 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( | 679 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( |
| 675 const std::set<std::string>& domains) { | 680 const std::set<std::string>& domains) { |
| 676 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); | 681 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); |
| 677 | 682 |
| 678 sql::Statement smt; | 683 sql::Statement smt; |
| 679 if (restore_old_session_cookies_) { | 684 if (restore_old_session_cookies_) { |
| 680 smt.Assign(db_->GetCachedStatement( | 685 smt.Assign(db_->GetCachedStatement( |
| 681 SQL_FROM_HERE, | 686 SQL_FROM_HERE, |
| 682 "SELECT creation_utc, host_key, name, value, path, expires_utc, " | 687 "SELECT creation_utc, host_key, name, value, encrypted_value, path, " |
| 683 "secure, httponly, last_access_utc, has_expires, persistent, priority " | 688 "expires_utc, secure, httponly, last_access_utc, has_expires, " |
| 684 "FROM cookies WHERE host_key = ?")); | 689 "persistent, priority FROM cookies WHERE host_key = ?")); |
| 685 } else { | 690 } else { |
| 686 smt.Assign(db_->GetCachedStatement( | 691 smt.Assign(db_->GetCachedStatement( |
| 687 SQL_FROM_HERE, | 692 SQL_FROM_HERE, |
| 688 "SELECT creation_utc, host_key, name, value, path, expires_utc, " | 693 "SELECT creation_utc, host_key, name, value, encrypted_value, path, " |
| 689 "secure, httponly, last_access_utc, has_expires, persistent, priority " | 694 "expires_utc, secure, httponly, last_access_utc, has_expires, " |
| 690 "FROM cookies WHERE host_key = ? AND persistent = 1")); | 695 "persistent, priority FROM cookies WHERE host_key = ? " |
| 696 "AND persistent = 1")); | |
| 691 } | 697 } |
| 692 if (!smt.is_valid()) { | 698 if (!smt.is_valid()) { |
| 693 smt.Clear(); // Disconnect smt_ref from db_. | 699 smt.Clear(); // Disconnect smt_ref from db_. |
| 694 meta_table_.Reset(); | 700 meta_table_.Reset(); |
| 695 db_.reset(); | 701 db_.reset(); |
| 696 return false; | 702 return false; |
| 697 } | 703 } |
| 698 | 704 |
| 699 std::vector<net::CanonicalCookie*> cookies; | 705 std::vector<net::CanonicalCookie*> cookies; |
| 700 std::set<std::string>::const_iterator it = domains.begin(); | 706 std::set<std::string>::const_iterator it = domains.begin(); |
| 701 for (; it != domains.end(); ++it) { | 707 for (; it != domains.end(); ++it) { |
| 702 smt.BindString(0, *it); | 708 smt.BindString(0, *it); |
| 703 while (smt.Step()) { | 709 while (smt.Step()) { |
| 710 std::string value = smt.ColumnString(3); | |
|
erikwright (departed)
2013/10/07 20:39:25
I suppose it's possible that there's a hit for rea
bcwhite
2013/10/08 16:10:25
Done.
Scott Hess - ex-Googler
2013/10/08 17:11:53
The big hit is I/O, and how SQLite stores things m
bcwhite
2013/10/08 18:23:36
So... Yes or no? Personally I prefer the previou
Scott Hess - ex-Googler
2013/10/08 19:13:51
I don't care either way, so defer to Erik.
| |
| 711 std::string encrypted_value = smt.ColumnString(4); | |
| 712 if (!encrypted_value.empty()) | |
| 713 Encryptor::DecryptString(encrypted_value, &value); | |
| 704 scoped_ptr<net::CanonicalCookie> cc(new net::CanonicalCookie( | 714 scoped_ptr<net::CanonicalCookie> cc(new net::CanonicalCookie( |
| 705 // The "source" URL is not used with persisted cookies. | 715 // The "source" URL is not used with persisted cookies. |
| 706 GURL(), // Source | 716 GURL(), // Source |
| 707 smt.ColumnString(2), // name | 717 smt.ColumnString(2), // name |
| 708 smt.ColumnString(3), // value | 718 value, // value |
| 709 smt.ColumnString(1), // domain | 719 smt.ColumnString(1), // domain |
| 710 smt.ColumnString(4), // path | 720 smt.ColumnString(5), // path |
| 711 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc | 721 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc |
| 712 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc | 722 Time::FromInternalValue(smt.ColumnInt64(6)), // expires_utc |
| 713 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc | 723 Time::FromInternalValue(smt.ColumnInt64(9)), // last_access_utc |
| 714 smt.ColumnInt(6) != 0, // secure | 724 smt.ColumnInt(7) != 0, // secure |
| 715 smt.ColumnInt(7) != 0, // httponly | 725 smt.ColumnInt(8) != 0, // httponly |
| 716 DBCookiePriorityToCookiePriority( | 726 DBCookiePriorityToCookiePriority( |
| 717 static_cast<DBCookiePriority>(smt.ColumnInt(11))))); // priority | 727 static_cast<DBCookiePriority>(smt.ColumnInt(12))))); // priority |
| 718 DLOG_IF(WARNING, | 728 DLOG_IF(WARNING, |
| 719 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; | 729 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; |
| 720 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++; | 730 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++; |
| 721 cookies.push_back(cc.release()); | 731 cookies.push_back(cc.release()); |
| 722 ++num_cookies_read_; | 732 ++num_cookies_read_; |
| 723 } | 733 } |
| 724 smt.Reset(true); | 734 smt.Reset(true); |
| 725 } | 735 } |
| 726 { | 736 { |
| 727 base::AutoLock locked(lock_); | 737 base::AutoLock locked(lock_); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 } | 840 } |
| 831 ++cur_version; | 841 ++cur_version; |
| 832 meta_table_.SetVersionNumber(cur_version); | 842 meta_table_.SetVersionNumber(cur_version); |
| 833 meta_table_.SetCompatibleVersionNumber( | 843 meta_table_.SetCompatibleVersionNumber( |
| 834 std::min(cur_version, kCompatibleVersionNumber)); | 844 std::min(cur_version, kCompatibleVersionNumber)); |
| 835 transaction.Commit(); | 845 transaction.Commit(); |
| 836 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV6", | 846 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV6", |
| 837 base::TimeTicks::Now() - start_time); | 847 base::TimeTicks::Now() - start_time); |
| 838 } | 848 } |
| 839 | 849 |
| 850 if (cur_version == 6) { | |
| 851 const base::TimeTicks start_time = base::TimeTicks::Now(); | |
| 852 sql::Transaction transaction(db_.get()); | |
| 853 if (!transaction.Begin()) | |
| 854 return false; | |
| 855 // Alter the table to add empty "encrypted value" column. | |
| 856 std::string stmt(base::StringPrintf( | |
| 857 "ALTER TABLE cookies ADD COLUMN encrypted_value BLOB DEFAULT ''")); | |
| 858 if (!db_->Execute(stmt.c_str())) { | |
| 859 LOG(WARNING) << "Unable to update cookie database to version 7."; | |
| 860 return false; | |
| 861 } | |
| 862 ++cur_version; | |
| 863 meta_table_.SetVersionNumber(cur_version); | |
| 864 meta_table_.SetCompatibleVersionNumber( | |
| 865 std::min(cur_version, kCompatibleVersionNumber)); | |
| 866 transaction.Commit(); | |
| 867 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV7", | |
| 868 base::TimeTicks::Now() - start_time); | |
| 869 } | |
| 870 | |
| 840 // Put future migration cases here. | 871 // Put future migration cases here. |
| 841 | 872 |
| 842 if (cur_version < kCurrentVersionNumber) { | 873 if (cur_version < kCurrentVersionNumber) { |
| 843 UMA_HISTOGRAM_COUNTS_100("Cookie.CorruptMetaTable", 1); | 874 UMA_HISTOGRAM_COUNTS_100("Cookie.CorruptMetaTable", 1); |
| 844 | 875 |
| 845 meta_table_.Reset(); | 876 meta_table_.Reset(); |
| 846 db_.reset(new sql::Connection); | 877 db_.reset(new sql::Connection); |
| 847 if (!base::DeleteFile(path_, false) || | 878 if (!base::DeleteFile(path_, false) || |
| 848 !db_->Open(path_) || | 879 !db_->Open(path_) || |
| 849 !meta_table_.Init( | 880 !meta_table_.Init( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 base::AutoLock locked(lock_); | 945 base::AutoLock locked(lock_); |
| 915 pending_.swap(ops); | 946 pending_.swap(ops); |
| 916 num_pending_ = 0; | 947 num_pending_ = 0; |
| 917 } | 948 } |
| 918 | 949 |
| 919 // Maybe an old timer fired or we are already Close()'ed. | 950 // Maybe an old timer fired or we are already Close()'ed. |
| 920 if (!db_.get() || ops.empty()) | 951 if (!db_.get() || ops.empty()) |
| 921 return; | 952 return; |
| 922 | 953 |
| 923 sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 954 sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 924 "INSERT INTO cookies (creation_utc, host_key, name, value, path, " | 955 "INSERT INTO cookies (creation_utc, host_key, name, value, " |
| 925 "expires_utc, secure, httponly, last_access_utc, has_expires, " | 956 "encrypted_value, path, expires_utc, secure, httponly, last_access_utc, " |
| 926 "persistent, priority) " | 957 "has_expires, persistent, priority) " |
| 927 "VALUES (?,?,?,?,?,?,?,?,?,?,?,?)")); | 958 "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)")); |
| 928 if (!add_smt.is_valid()) | 959 if (!add_smt.is_valid()) |
| 929 return; | 960 return; |
| 930 | 961 |
| 931 sql::Statement update_access_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 962 sql::Statement update_access_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 932 "UPDATE cookies SET last_access_utc=? WHERE creation_utc=?")); | 963 "UPDATE cookies SET last_access_utc=? WHERE creation_utc=?")); |
| 933 if (!update_access_smt.is_valid()) | 964 if (!update_access_smt.is_valid()) |
| 934 return; | 965 return; |
| 935 | 966 |
| 936 sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 967 sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 937 "DELETE FROM cookies WHERE creation_utc=?")); | 968 "DELETE FROM cookies WHERE creation_utc=?")); |
| 938 if (!del_smt.is_valid()) | 969 if (!del_smt.is_valid()) |
| 939 return; | 970 return; |
| 940 | 971 |
| 941 sql::Transaction transaction(db_.get()); | 972 sql::Transaction transaction(db_.get()); |
| 942 if (!transaction.Begin()) | 973 if (!transaction.Begin()) |
| 943 return; | 974 return; |
| 944 | 975 |
| 976 std::string value, encrypted_value; // Only one will ever get a value below. | |
|
Scott Hess - ex-Googler
2013/09/27 23:07:12
I would put this inside the loop. Since the code
bcwhite
2013/09/30 15:04:29
Sure. I was trying to avoid re-constructing the o
| |
| 945 for (PendingOperationsList::iterator it = ops.begin(); | 977 for (PendingOperationsList::iterator it = ops.begin(); |
| 946 it != ops.end(); ++it) { | 978 it != ops.end(); ++it) { |
| 947 // Free the cookies as we commit them to the database. | 979 // Free the cookies as we commit them to the database. |
| 948 scoped_ptr<PendingOperation> po(*it); | 980 scoped_ptr<PendingOperation> po(*it); |
| 949 switch (po->op()) { | 981 switch (po->op()) { |
| 950 case PendingOperation::COOKIE_ADD: | 982 case PendingOperation::COOKIE_ADD: |
| 983 // On operating systems that support an encryption API but don't | |
| 984 // automatically protect all user data, encrypt the cookie. | |
| 985 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 986 Encryptor::EncryptString(po->cc().Value(), &encrypted_value); | |
| 987 #else | |
| 988 value = po->cc().Value(); | |
| 989 #endif | |
| 951 cookies_per_origin_[ | 990 cookies_per_origin_[ |
| 952 CookieOrigin(po->cc().Domain(), po->cc().IsSecure())]++; | 991 CookieOrigin(po->cc().Domain(), po->cc().IsSecure())]++; |
| 953 add_smt.Reset(true); | 992 add_smt.Reset(true); |
| 954 add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue()); | 993 add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue()); |
| 955 add_smt.BindString(1, po->cc().Domain()); | 994 add_smt.BindString(1, po->cc().Domain()); |
| 956 add_smt.BindString(2, po->cc().Name()); | 995 add_smt.BindString(2, po->cc().Name()); |
| 957 add_smt.BindString(3, po->cc().Value()); | 996 add_smt.BindString(3, value); |
| 958 add_smt.BindString(4, po->cc().Path()); | 997 add_smt.BindBlob(4, encrypted_value.data(), |
| 959 add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue()); | 998 static_cast<int>(encrypted_value.length())); |
| 960 add_smt.BindInt(6, po->cc().IsSecure()); | 999 add_smt.BindString(5, po->cc().Path()); |
| 961 add_smt.BindInt(7, po->cc().IsHttpOnly()); | 1000 add_smt.BindInt64(6, po->cc().ExpiryDate().ToInternalValue()); |
| 962 add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue()); | 1001 add_smt.BindInt(7, po->cc().IsSecure()); |
| 963 add_smt.BindInt(9, po->cc().IsPersistent()); | 1002 add_smt.BindInt(8, po->cc().IsHttpOnly()); |
| 1003 add_smt.BindInt64(9, po->cc().LastAccessDate().ToInternalValue()); | |
| 964 add_smt.BindInt(10, po->cc().IsPersistent()); | 1004 add_smt.BindInt(10, po->cc().IsPersistent()); |
| 1005 add_smt.BindInt(11, po->cc().IsPersistent()); | |
| 965 add_smt.BindInt( | 1006 add_smt.BindInt( |
| 966 11, CookiePriorityToDBCookiePriority(po->cc().Priority())); | 1007 12, CookiePriorityToDBCookiePriority(po->cc().Priority())); |
| 967 if (!add_smt.Run()) | 1008 if (!add_smt.Run()) |
| 968 NOTREACHED() << "Could not add a cookie to the DB."; | 1009 NOTREACHED() << "Could not add a cookie to the DB."; |
| 969 break; | 1010 break; |
| 970 | 1011 |
| 971 case PendingOperation::COOKIE_UPDATEACCESS: | 1012 case PendingOperation::COOKIE_UPDATEACCESS: |
| 972 update_access_smt.Reset(true); | 1013 update_access_smt.Reset(true); |
| 973 update_access_smt.BindInt64(0, | 1014 update_access_smt.BindInt64(0, |
| 974 po->cc().LastAccessDate().ToInternalValue()); | 1015 po->cc().LastAccessDate().ToInternalValue()); |
| 975 update_access_smt.BindInt64(1, | 1016 update_access_smt.BindInt64(1, |
| 976 po->cc().CreationDate().ToInternalValue()); | 1017 po->cc().CreationDate().ToInternalValue()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1214 | 1255 |
| 1215 const std::string cookie_priority_experiment_group = | 1256 const std::string cookie_priority_experiment_group = |
| 1216 base::FieldTrialList::FindFullName("CookieRetentionPriorityStudy"); | 1257 base::FieldTrialList::FindFullName("CookieRetentionPriorityStudy"); |
| 1217 cookie_monster->SetPriorityAwareGarbageCollection( | 1258 cookie_monster->SetPriorityAwareGarbageCollection( |
| 1218 cookie_priority_experiment_group == "ExperimentOn"); | 1259 cookie_priority_experiment_group == "ExperimentOn"); |
| 1219 | 1260 |
| 1220 return cookie_monster; | 1261 return cookie_monster; |
| 1221 } | 1262 } |
| 1222 | 1263 |
| 1223 } // namespace content | 1264 } // namespace content |
| OLD | NEW |