Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 10694093: Remove the force_session cookie option, as it's not used anymore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 DISALLOW_COPY_AND_ASSIGN(Backend); 247 DISALLOW_COPY_AND_ASSIGN(Backend);
248 }; 248 };
249 249
250 // Version number of the database. 250 // Version number of the database.
251 // 251 //
252 // Version 5 adds the columns has_expires and is_persistent, so that the 252 // Version 5 adds the columns has_expires and is_persistent, so that the
253 // database can store session cookies as well as persistent cookies. Databases 253 // database can store session cookies as well as persistent cookies. Databases
254 // of version 5 are incompatible with older versions of code. If a database of 254 // of version 5 are incompatible with older versions of code. If a database of
255 // version 5 is read by older code, session cookies will be treated as normal 255 // version 5 is read by older code, session cookies will be treated as normal
256 // cookies. 256 // cookies. Currently, these fields are written, but not read anymore.
257 // 257 //
258 // In version 4, we migrated the time epoch. If you open the DB with an older 258 // In version 4, we migrated the time epoch. If you open the DB with an older
259 // version on Mac or Linux, the times will look wonky, but the file will likely 259 // version on Mac or Linux, the times will look wonky, but the file will likely
260 // be usable. On Windows version 3 and 4 are the same. 260 // be usable. On Windows version 3 and 4 are the same.
261 // 261 //
262 // Version 3 updated the database to include the last access time, so we can 262 // Version 3 updated the database to include the last access time, so we can
263 // expire them in decreasing order of use when we've reached the maximum 263 // expire them in decreasing order of use when we've reached the maximum
264 // number of cookies. 264 // number of cookies.
265 static const int kCurrentVersionNumber = 5; 265 static const int kCurrentVersionNumber = 5;
266 static const int kCompatibleVersionNumber = 5; 266 static const int kCompatibleVersionNumber = 5;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 smt.ColumnString(2), // name 620 smt.ColumnString(2), // name
621 smt.ColumnString(3), // value 621 smt.ColumnString(3), // value
622 smt.ColumnString(1), // domain 622 smt.ColumnString(1), // domain
623 smt.ColumnString(4), // path 623 smt.ColumnString(4), // path
624 std::string(), // TODO(abarth): Persist mac_key 624 std::string(), // TODO(abarth): Persist mac_key
625 std::string(), // TODO(abarth): Persist mac_algorithm 625 std::string(), // TODO(abarth): Persist mac_algorithm
626 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc 626 Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc
627 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc 627 Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc
628 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc 628 Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
629 smt.ColumnInt(6) != 0, // secure 629 smt.ColumnInt(6) != 0, // secure
630 smt.ColumnInt(7) != 0, // httponly 630 smt.ColumnInt(7) != 0)); // httponly
631 smt.ColumnInt(9) != 0, // has_expires
632 smt.ColumnInt(10) != 0)); // is_persistent
633 DLOG_IF(WARNING, 631 DLOG_IF(WARNING,
634 cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; 632 cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
635 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++; 633 cookies_per_origin_[CookieOrigin(cc->Domain(), cc->IsSecure())]++;
636 cookies.push_back(cc.release()); 634 cookies.push_back(cc.release());
637 ++num_cookies_read_; 635 ++num_cookies_read_;
638 } 636 }
639 smt.Reset(true); 637 smt.Reset(true);
640 } 638 }
641 { 639 {
642 base::AutoLock locked(lock_); 640 base::AutoLock locked(lock_);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 add_smt.Reset(true); 845 add_smt.Reset(true);
848 add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue()); 846 add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
849 add_smt.BindString(1, po->cc().Domain()); 847 add_smt.BindString(1, po->cc().Domain());
850 add_smt.BindString(2, po->cc().Name()); 848 add_smt.BindString(2, po->cc().Name());
851 add_smt.BindString(3, po->cc().Value()); 849 add_smt.BindString(3, po->cc().Value());
852 add_smt.BindString(4, po->cc().Path()); 850 add_smt.BindString(4, po->cc().Path());
853 add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue()); 851 add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue());
854 add_smt.BindInt(6, po->cc().IsSecure()); 852 add_smt.BindInt(6, po->cc().IsSecure());
855 add_smt.BindInt(7, po->cc().IsHttpOnly()); 853 add_smt.BindInt(7, po->cc().IsHttpOnly());
856 add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue()); 854 add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue());
857 add_smt.BindInt(9, po->cc().DoesExpire()); 855 add_smt.BindInt(9, po->cc().IsPersistent());
858 add_smt.BindInt(10, po->cc().IsPersistent()); 856 add_smt.BindInt(10, po->cc().IsPersistent());
859 if (!add_smt.Run()) 857 if (!add_smt.Run())
860 NOTREACHED() << "Could not add a cookie to the DB."; 858 NOTREACHED() << "Could not add a cookie to the DB.";
861 break; 859 break;
862 860
863 case PendingOperation::COOKIE_UPDATEACCESS: 861 case PendingOperation::COOKIE_UPDATEACCESS:
864 update_access_smt.Reset(true); 862 update_access_smt.Reset(true);
865 update_access_smt.BindInt64(0, 863 update_access_smt.BindInt64(0,
866 po->cc().LastAccessDate().ToInternalValue()); 864 po->cc().LastAccessDate().ToInternalValue());
867 update_access_smt.BindInt64(1, 865 update_access_smt.BindInt64(1,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 } 1028 }
1031 1029
1032 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { 1030 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
1033 if (backend_.get()) { 1031 if (backend_.get()) {
1034 backend_->Close(); 1032 backend_->Close();
1035 // Release our reference, it will probably still have a reference if the 1033 // Release our reference, it will probably still have a reference if the
1036 // background thread has not run Close() yet. 1034 // background thread has not run Close() yet.
1037 backend_ = NULL; 1035 backend_ = NULL;
1038 } 1036 }
1039 } 1037 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698