| 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/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/sequenced_task_runner.h" | 22 #include "base/sequenced_task_runner.h" |
| 23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 24 #include "base/stringprintf.h" |
| 24 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
| 26 #include "base/time.h" | 27 #include "base/time.h" |
| 27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/cookie_store_factory.h" | 29 #include "content/public/browser/cookie_store_factory.h" |
| 29 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
| 30 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 31 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 31 #include "net/cookies/canonical_cookie.h" | 32 #include "net/cookies/canonical_cookie.h" |
| 32 #include "net/cookies/cookie_constants.h" | 33 #include "net/cookies/cookie_constants.h" |
| 33 #include "net/cookies/cookie_util.h" | 34 #include "net/cookies/cookie_util.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // it is unlikely that a second time will be successful. | 308 // it is unlikely that a second time will be successful. |
| 308 if (!attempted_to_kill_database_ && sql::IsErrorCatastrophic(error)) { | 309 if (!attempted_to_kill_database_ && sql::IsErrorCatastrophic(error)) { |
| 309 attempted_to_kill_database_ = true; | 310 attempted_to_kill_database_ = true; |
| 310 | 311 |
| 311 backend_->ScheduleKillDatabase(); | 312 backend_->ScheduleKillDatabase(); |
| 312 } | 313 } |
| 313 | 314 |
| 314 return error; | 315 return error; |
| 315 } | 316 } |
| 316 | 317 |
| 318 namespace { |
| 319 |
| 317 // Version number of the database. | 320 // Version number of the database. |
| 318 // | 321 // |
| 322 // Version 6 adds cookie priorities. This allows developers to influence the |
| 323 // order in which cookies are evicted in order to meet domain cookie limits. |
| 324 // |
| 319 // Version 5 adds the columns has_expires and is_persistent, so that the | 325 // Version 5 adds the columns has_expires and is_persistent, so that the |
| 320 // database can store session cookies as well as persistent cookies. Databases | 326 // database can store session cookies as well as persistent cookies. Databases |
| 321 // of version 5 are incompatible with older versions of code. If a database of | 327 // of version 5 are incompatible with older versions of code. If a database of |
| 322 // version 5 is read by older code, session cookies will be treated as normal | 328 // version 5 is read by older code, session cookies will be treated as normal |
| 323 // cookies. Currently, these fields are written, but not read anymore. | 329 // cookies. Currently, these fields are written, but not read anymore. |
| 324 // | 330 // |
| 325 // In version 4, we migrated the time epoch. If you open the DB with an older | 331 // In version 4, we migrated the time epoch. If you open the DB with an older |
| 326 // version on Mac or Linux, the times will look wonky, but the file will likely | 332 // version on Mac or Linux, the times will look wonky, but the file will likely |
| 327 // be usable. On Windows version 3 and 4 are the same. | 333 // be usable. On Windows version 3 and 4 are the same. |
| 328 // | 334 // |
| 329 // Version 3 updated the database to include the last access time, so we can | 335 // Version 3 updated the database to include the last access time, so we can |
| 330 // expire them in decreasing order of use when we've reached the maximum | 336 // expire them in decreasing order of use when we've reached the maximum |
| 331 // number of cookies. | 337 // number of cookies. |
| 332 static const int kCurrentVersionNumber = 5; | 338 const int kCurrentVersionNumber = 6; |
| 333 static const int kCompatibleVersionNumber = 5; | 339 const int kCompatibleVersionNumber = 5; |
| 334 | 340 |
| 335 namespace { | 341 // Possible values for the 'priority' column. |
| 342 enum DBCookiePriority { |
| 343 kCookiePriorityLow = 0, |
| 344 kCookiePriorityMedium = 1, |
| 345 kCookiePriorityHigh = 2, |
| 346 }; |
| 347 |
| 348 DBCookiePriority CookiePriorityToDBCookiePriority(net::CookiePriority value) { |
| 349 switch (value) { |
| 350 case net::COOKIE_PRIORITY_LOW: |
| 351 return kCookiePriorityLow; |
| 352 case net::COOKIE_PRIORITY_MEDIUM: |
| 353 return kCookiePriorityMedium; |
| 354 case net::COOKIE_PRIORITY_HIGH: |
| 355 return kCookiePriorityHigh; |
| 356 } |
| 357 |
| 358 NOTREACHED(); |
| 359 return kCookiePriorityMedium; |
| 360 } |
| 361 |
| 362 net::CookiePriority DBCookiePriorityToCookiePriority(DBCookiePriority value) { |
| 363 switch (value) { |
| 364 case kCookiePriorityLow: |
| 365 return net::COOKIE_PRIORITY_LOW; |
| 366 case kCookiePriorityMedium: |
| 367 return net::COOKIE_PRIORITY_MEDIUM; |
| 368 case kCookiePriorityHigh: |
| 369 return net::COOKIE_PRIORITY_HIGH; |
| 370 } |
| 371 |
| 372 NOTREACHED(); |
| 373 return net::COOKIE_PRIORITY_DEFAULT; |
| 374 } |
| 336 | 375 |
| 337 // Increments a specified TimeDelta by the duration between this object's | 376 // Increments a specified TimeDelta by the duration between this object's |
| 338 // constructor and destructor. Not thread safe. Multiple instances may be | 377 // constructor and destructor. Not thread safe. Multiple instances may be |
| 339 // created with the same delta instance as long as their lifetimes are nested. | 378 // created with the same delta instance as long as their lifetimes are nested. |
| 340 // The shortest lived instances have no impact. | 379 // The shortest lived instances have no impact. |
| 341 class IncrementTimeDelta { | 380 class IncrementTimeDelta { |
| 342 public: | 381 public: |
| 343 explicit IncrementTimeDelta(base::TimeDelta* delta) : | 382 explicit IncrementTimeDelta(base::TimeDelta* delta) : |
| 344 delta_(delta), | 383 delta_(delta), |
| 345 original_value_(*delta), | 384 original_value_(*delta), |
| 346 start_(base::Time::Now()) {} | 385 start_(base::Time::Now()) {} |
| 347 | 386 |
| 348 ~IncrementTimeDelta() { | 387 ~IncrementTimeDelta() { |
| 349 *delta_ = original_value_ + base::Time::Now() - start_; | 388 *delta_ = original_value_ + base::Time::Now() - start_; |
| 350 } | 389 } |
| 351 | 390 |
| 352 private: | 391 private: |
| 353 base::TimeDelta* delta_; | 392 base::TimeDelta* delta_; |
| 354 base::TimeDelta original_value_; | 393 base::TimeDelta original_value_; |
| 355 base::Time start_; | 394 base::Time start_; |
| 356 | 395 |
| 357 DISALLOW_COPY_AND_ASSIGN(IncrementTimeDelta); | 396 DISALLOW_COPY_AND_ASSIGN(IncrementTimeDelta); |
| 358 }; | 397 }; |
| 359 | 398 |
| 360 // Initializes the cookies table, returning true on success. | 399 // Initializes the cookies table, returning true on success. |
| 361 bool InitTable(sql::Connection* db) { | 400 bool InitTable(sql::Connection* db) { |
| 362 if (!db->DoesTableExist("cookies")) { | 401 if (!db->DoesTableExist("cookies")) { |
| 363 if (!db->Execute("CREATE TABLE cookies (" | 402 std::string stmt(base::StringPrintf( |
| 364 "creation_utc INTEGER NOT NULL UNIQUE PRIMARY KEY," | 403 "CREATE TABLE cookies (" |
| 365 "host_key TEXT NOT NULL," | 404 "creation_utc INTEGER NOT NULL UNIQUE PRIMARY KEY," |
| 366 "name TEXT NOT NULL," | 405 "host_key TEXT NOT NULL," |
| 367 "value TEXT NOT NULL," | 406 "name TEXT NOT NULL," |
| 368 "path TEXT NOT NULL," | 407 "value TEXT NOT NULL," |
| 369 "expires_utc INTEGER NOT NULL," | 408 "path TEXT NOT NULL," |
| 370 "secure INTEGER NOT NULL," | 409 "expires_utc INTEGER NOT NULL," |
| 371 "httponly INTEGER NOT NULL," | 410 "secure INTEGER NOT NULL," |
| 372 "last_access_utc INTEGER NOT NULL, " | 411 "httponly INTEGER NOT NULL," |
| 373 "has_expires INTEGER NOT NULL DEFAULT 1, " | 412 "last_access_utc INTEGER NOT NULL, " |
| 374 "persistent INTEGER NOT NULL DEFAULT 1)")) { | 413 "has_expires INTEGER NOT NULL DEFAULT 1, " |
| 375 // TODO(rogerm): Add priority. | 414 "persistent INTEGER NOT NULL DEFAULT 1," |
| 415 "priority INTEGER NOT NULL DEFAULT %d)", |
| 416 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); |
| 417 if (!db->Execute(stmt.c_str())) |
| 376 return false; | 418 return false; |
| 377 } | |
| 378 } | 419 } |
| 379 | 420 |
| 380 // Older code created an index on creation_utc, which is already | 421 // Older code created an index on creation_utc, which is already |
| 381 // primary key for the table. | 422 // primary key for the table. |
| 382 if (!db->Execute("DROP INDEX IF EXISTS cookie_times")) | 423 if (!db->Execute("DROP INDEX IF EXISTS cookie_times")) |
| 383 return false; | 424 return false; |
| 384 | 425 |
| 385 if (!db->Execute("CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) | 426 if (!db->Execute("CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) |
| 386 return false; | 427 return false; |
| 387 | 428 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 } | 694 } |
| 654 } | 695 } |
| 655 | 696 |
| 656 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( | 697 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( |
| 657 const std::set<std::string>& domains) { | 698 const std::set<std::string>& domains) { |
| 658 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); | 699 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); |
| 659 | 700 |
| 660 sql::Statement smt; | 701 sql::Statement smt; |
| 661 if (restore_old_session_cookies_) { | 702 if (restore_old_session_cookies_) { |
| 662 smt.Assign(db_->GetCachedStatement( | 703 smt.Assign(db_->GetCachedStatement( |
| 663 SQL_FROM_HERE, | 704 SQL_FROM_HERE, |
| 664 "SELECT creation_utc, host_key, name, value, path, expires_utc, " | 705 "SELECT creation_utc, host_key, name, value, path, expires_utc, " |
| 665 "secure, httponly, last_access_utc, has_expires, persistent " | 706 "secure, httponly, last_access_utc, has_expires, persistent, priority " |
| 666 "FROM cookies WHERE host_key = ?")); | 707 "FROM cookies WHERE host_key = ?")); |
| 667 // TODO(rogerm): Add priority. | |
| 668 } else { | 708 } else { |
| 669 smt.Assign(db_->GetCachedStatement( | 709 smt.Assign(db_->GetCachedStatement( |
| 670 SQL_FROM_HERE, | 710 SQL_FROM_HERE, |
| 671 "SELECT creation_utc, host_key, name, value, path, expires_utc, " | 711 "SELECT creation_utc, host_key, name, value, path, expires_utc, " |
| 672 "secure, httponly, last_access_utc, has_expires, persistent " | 712 "secure, httponly, last_access_utc, has_expires, persistent, priority " |
| 673 "FROM cookies WHERE host_key = ? AND persistent = 1")); | 713 "FROM cookies WHERE host_key = ? AND persistent = 1")); |
| 674 // TODO(rogerm): Add priority. | |
| 675 } | 714 } |
| 676 if (!smt.is_valid()) { | 715 if (!smt.is_valid()) { |
| 677 smt.Clear(); // Disconnect smt_ref from db_. | 716 smt.Clear(); // Disconnect smt_ref from db_. |
| 678 meta_table_.Reset(); | 717 meta_table_.Reset(); |
| 679 db_.reset(); | 718 db_.reset(); |
| 680 return false; | 719 return false; |
| 681 } | 720 } |
| 682 | 721 |
| 683 std::vector<net::CanonicalCookie*> cookies; | 722 std::vector<net::CanonicalCookie*> cookies; |
| 684 std::set<std::string>::const_iterator it = domains.begin(); | 723 std::set<std::string>::const_iterator it = domains.begin(); |
| 685 for (; it != domains.end(); ++it) { | 724 for (; it != domains.end(); ++it) { |
| 686 smt.BindString(0, *it); | 725 smt.BindString(0, *it); |
| 687 while (smt.Step()) { | 726 while (smt.Step()) { |
| 688 scoped_ptr<net::CanonicalCookie> cc( | 727 scoped_ptr<net::CanonicalCookie> cc(new net::CanonicalCookie( |
| 689 new net::CanonicalCookie( | 728 // The "source" URL is not used with persisted cookies. |
| 690 // The "source" URL is not used with persisted cookies. | 729 GURL(), // Source |
| 691 GURL(), // Source | 730 smt.ColumnString(2), // name |
| 692 smt.ColumnString(2), // name | 731 smt.ColumnString(3), // value |
| 693 smt.ColumnString(3), // value | 732 smt.ColumnString(1), // domain |
| 694 smt.ColumnString(1), // domain | 733 smt.ColumnString(4), // path |
| 695 smt.ColumnString(4), // path | 734 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc |
| 696 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc | 735 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc |
| 697 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc | 736 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc |
| 698 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc | 737 smt.ColumnInt(6) != 0, // secure |
| 699 smt.ColumnInt(6) != 0, // secure | 738 smt.ColumnInt(7) != 0, // httponly |
| 700 smt.ColumnInt(7) != 0, // httponly | 739 DBCookiePriorityToCookiePriority( |
| 701 net::COOKIE_PRIORITY_DEFAULT)); // priority | 740 static_cast<DBCookiePriority>(smt.ColumnInt(11))))); // priority |
| 702 // TODO(rogerm): Change net::COOKIE_PRIORITY_DEFAULT above to | |
| 703 // net::StringToCookiePriority(smt.ColumnString(9))? | |
| 704 DLOG_IF(WARNING, | 741 DLOG_IF(WARNING, |
| 705 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; | 742 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; |
| 706 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++; | 743 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++; |
| 707 cookies.push_back(cc.release()); | 744 cookies.push_back(cc.release()); |
| 708 ++num_cookies_read_; | 745 ++num_cookies_read_; |
| 709 } | 746 } |
| 710 smt.Reset(true); | 747 smt.Reset(true); |
| 711 } | 748 } |
| 712 { | 749 { |
| 713 base::AutoLock locked(lock_); | 750 base::AutoLock locked(lock_); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 } | 831 } |
| 795 ++cur_version; | 832 ++cur_version; |
| 796 meta_table_.SetVersionNumber(cur_version); | 833 meta_table_.SetVersionNumber(cur_version); |
| 797 meta_table_.SetCompatibleVersionNumber( | 834 meta_table_.SetCompatibleVersionNumber( |
| 798 std::min(cur_version, kCompatibleVersionNumber)); | 835 std::min(cur_version, kCompatibleVersionNumber)); |
| 799 transaction.Commit(); | 836 transaction.Commit(); |
| 800 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV5", | 837 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV5", |
| 801 base::TimeTicks::Now() - start_time); | 838 base::TimeTicks::Now() - start_time); |
| 802 } | 839 } |
| 803 | 840 |
| 841 if (cur_version == 5) { |
| 842 const base::TimeTicks start_time = base::TimeTicks::Now(); |
| 843 sql::Transaction transaction(db_.get()); |
| 844 if (!transaction.Begin()) |
| 845 return false; |
| 846 // Alter the table to add the priority column with a default value. |
| 847 std::string stmt(base::StringPrintf( |
| 848 "ALTER TABLE cookies ADD COLUMN priority INTEGER DEFAULT %d", |
| 849 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); |
| 850 if (!db_->Execute(stmt.c_str())) { |
| 851 LOG(WARNING) << "Unable to update cookie database to version 6."; |
| 852 return false; |
| 853 } |
| 854 ++cur_version; |
| 855 meta_table_.SetVersionNumber(cur_version); |
| 856 meta_table_.SetCompatibleVersionNumber( |
| 857 std::min(cur_version, kCompatibleVersionNumber)); |
| 858 transaction.Commit(); |
| 859 UMA_HISTOGRAM_TIMES("Cookie.TimeDatabaseMigrationToV6", |
| 860 base::TimeTicks::Now() - start_time); |
| 861 } |
| 862 |
| 804 // Put future migration cases here. | 863 // Put future migration cases here. |
| 805 | 864 |
| 806 if (cur_version < kCurrentVersionNumber) { | 865 if (cur_version < kCurrentVersionNumber) { |
| 807 UMA_HISTOGRAM_COUNTS_100("Cookie.CorruptMetaTable", 1); | 866 UMA_HISTOGRAM_COUNTS_100("Cookie.CorruptMetaTable", 1); |
| 808 | 867 |
| 809 meta_table_.Reset(); | 868 meta_table_.Reset(); |
| 810 db_.reset(new sql::Connection); | 869 db_.reset(new sql::Connection); |
| 811 if (!file_util::Delete(path_, false) || | 870 if (!file_util::Delete(path_, false) || |
| 812 !db_->Open(path_) || | 871 !db_->Open(path_) || |
| 813 !meta_table_.Init( | 872 !meta_table_.Init( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 { | 936 { |
| 878 base::AutoLock locked(lock_); | 937 base::AutoLock locked(lock_); |
| 879 pending_.swap(ops); | 938 pending_.swap(ops); |
| 880 num_pending_ = 0; | 939 num_pending_ = 0; |
| 881 } | 940 } |
| 882 | 941 |
| 883 // Maybe an old timer fired or we are already Close()'ed. | 942 // Maybe an old timer fired or we are already Close()'ed. |
| 884 if (!db_.get() || ops.empty()) | 943 if (!db_.get() || ops.empty()) |
| 885 return; | 944 return; |
| 886 | 945 |
| 887 // TODO(rogerm): Add priority. | |
| 888 sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 946 sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 889 "INSERT INTO cookies (creation_utc, host_key, name, value, path, " | 947 "INSERT INTO cookies (creation_utc, host_key, name, value, path, " |
| 890 "expires_utc, secure, httponly, last_access_utc, has_expires, " | 948 "expires_utc, secure, httponly, last_access_utc, has_expires, " |
| 891 "persistent) " | 949 "persistent, priority) " |
| 892 "VALUES (?,?,?,?,?,?,?,?,?,?,?)")); | 950 "VALUES (?,?,?,?,?,?,?,?,?,?,?,?)")); |
| 893 if (!add_smt.is_valid()) | 951 if (!add_smt.is_valid()) |
| 894 return; | 952 return; |
| 895 | 953 |
| 896 sql::Statement update_access_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 954 sql::Statement update_access_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 897 "UPDATE cookies SET last_access_utc=? WHERE creation_utc=?")); | 955 "UPDATE cookies SET last_access_utc=? WHERE creation_utc=?")); |
| 898 if (!update_access_smt.is_valid()) | 956 if (!update_access_smt.is_valid()) |
| 899 return; | 957 return; |
| 900 | 958 |
| 901 sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE, | 959 sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| 902 "DELETE FROM cookies WHERE creation_utc=?")); | 960 "DELETE FROM cookies WHERE creation_utc=?")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 920 add_smt.BindString(1, po->cc().Domain()); | 978 add_smt.BindString(1, po->cc().Domain()); |
| 921 add_smt.BindString(2, po->cc().Name()); | 979 add_smt.BindString(2, po->cc().Name()); |
| 922 add_smt.BindString(3, po->cc().Value()); | 980 add_smt.BindString(3, po->cc().Value()); |
| 923 add_smt.BindString(4, po->cc().Path()); | 981 add_smt.BindString(4, po->cc().Path()); |
| 924 add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue()); | 982 add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue()); |
| 925 add_smt.BindInt(6, po->cc().IsSecure()); | 983 add_smt.BindInt(6, po->cc().IsSecure()); |
| 926 add_smt.BindInt(7, po->cc().IsHttpOnly()); | 984 add_smt.BindInt(7, po->cc().IsHttpOnly()); |
| 927 add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue()); | 985 add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue()); |
| 928 add_smt.BindInt(9, po->cc().IsPersistent()); | 986 add_smt.BindInt(9, po->cc().IsPersistent()); |
| 929 add_smt.BindInt(10, po->cc().IsPersistent()); | 987 add_smt.BindInt(10, po->cc().IsPersistent()); |
| 930 // TODO(rogerm): Add priority. | 988 add_smt.BindInt( |
| 989 11, CookiePriorityToDBCookiePriority(po->cc().Priority())); |
| 931 if (!add_smt.Run()) | 990 if (!add_smt.Run()) |
| 932 NOTREACHED() << "Could not add a cookie to the DB."; | 991 NOTREACHED() << "Could not add a cookie to the DB."; |
| 933 break; | 992 break; |
| 934 | 993 |
| 935 case PendingOperation::COOKIE_UPDATEACCESS: | 994 case PendingOperation::COOKIE_UPDATEACCESS: |
| 936 update_access_smt.Reset(true); | 995 update_access_smt.Reset(true); |
| 937 update_access_smt.BindInt64(0, | 996 update_access_smt.BindInt64(0, |
| 938 po->cc().LastAccessDate().ToInternalValue()); | 997 po->cc().LastAccessDate().ToInternalValue()); |
| 939 update_access_smt.BindInt64(1, | 998 update_access_smt.BindInt64(1, |
| 940 po->cc().CreationDate().ToInternalValue()); | 999 po->cc().CreationDate().ToInternalValue()); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 path, | 1214 path, |
| 1156 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 1215 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 1157 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 1216 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
| 1158 BrowserThread::GetBlockingPool()->GetSequenceToken()), | 1217 BrowserThread::GetBlockingPool()->GetSequenceToken()), |
| 1159 restore_old_session_cookies, | 1218 restore_old_session_cookies, |
| 1160 storage_policy); | 1219 storage_policy); |
| 1161 return new net::CookieMonster(persistent_store, cookie_monster_delegate); | 1220 return new net::CookieMonster(persistent_store, cookie_monster_delegate); |
| 1162 } | 1221 } |
| 1163 | 1222 |
| 1164 } // namespace content | 1223 } // namespace content |
| OLD | NEW |