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> |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 "priority INTEGER NOT NULL DEFAULT %d," | 425 "priority INTEGER NOT NULL DEFAULT %d," |
426 "encrypted_value BLOB DEFAULT ''," | 426 "encrypted_value BLOB DEFAULT ''," |
427 "firstpartyonly INTEGER NOT NULL DEFAULT 0)", | 427 "firstpartyonly INTEGER NOT NULL DEFAULT 0)", |
428 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); | 428 CookiePriorityToDBCookiePriority(net::COOKIE_PRIORITY_DEFAULT))); |
429 if (!db->Execute(stmt.c_str())) | 429 if (!db->Execute(stmt.c_str())) |
430 return false; | 430 return false; |
431 | 431 |
432 if (!db->Execute("CREATE INDEX domain ON cookies(host_key)")) | 432 if (!db->Execute("CREATE INDEX domain ON cookies(host_key)")) |
433 return false; | 433 return false; |
434 | 434 |
435 #if defined(OS_IOS) | |
436 if (!db->Execute("CREATE INDEX is_transient ON cookies(persistent)")) { | |
437 return false; | |
438 } | |
439 #else | |
435 if (!db->Execute( | 440 if (!db->Execute( |
436 "CREATE INDEX is_transient ON cookies(persistent) " | 441 "CREATE INDEX is_transient ON cookies(persistent) " |
437 "where persistent != 1")) { | 442 "where persistent != 1")) { |
438 return false; | 443 return false; |
439 } | 444 } |
445 #endif | |
440 | 446 |
441 return true; | 447 return true; |
442 } | 448 } |
443 | 449 |
444 } // namespace | 450 } // namespace |
445 | 451 |
446 void SQLitePersistentCookieStore::Backend::Load( | 452 void SQLitePersistentCookieStore::Backend::Load( |
447 const LoadedCallback& loaded_callback) { | 453 const LoadedCallback& loaded_callback) { |
448 // This function should be called only once per instance. | 454 // This function should be called only once per instance. |
449 DCHECK(!db_.get()); | 455 DCHECK(!db_.get()); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 return false; | 984 return false; |
979 } | 985 } |
980 | 986 |
981 if (!db_->Execute( | 987 if (!db_->Execute( |
982 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) { | 988 "CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)")) { |
983 LOG(WARNING) << "Unable to create index domain in update to version 9."; | 989 LOG(WARNING) << "Unable to create index domain in update to version 9."; |
984 return false; | 990 return false; |
985 } | 991 } |
986 | 992 |
987 if (!db_->Execute( | 993 if (!db_->Execute( |
988 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) " | 994 "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) " |
rohitrao (ping after 24h)
2015/04/24 17:22:28
Also here?
erikchen
2015/04/24 17:30:18
Done.
| |
989 "where persistent != 1")) { | 995 "where persistent != 1")) { |
990 LOG(WARNING) | 996 LOG(WARNING) |
991 << "Unable to create index is_transient in update to version 9."; | 997 << "Unable to create index is_transient in update to version 9."; |
992 return false; | 998 return false; |
993 } | 999 } |
994 ++cur_version; | 1000 ++cur_version; |
995 meta_table_.SetVersionNumber(cur_version); | 1001 meta_table_.SetVersionNumber(cur_version); |
996 meta_table_.SetCompatibleVersionNumber( | 1002 meta_table_.SetCompatibleVersionNumber( |
997 std::min(cur_version, kCompatibleVersionNumber)); | 1003 std::min(cur_version, kCompatibleVersionNumber)); |
998 transaction.Commit(); | 1004 transaction.Commit(); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1440 (config.session_cookie_mode == | 1446 (config.session_cookie_mode == |
1441 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { | 1447 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { |
1442 cookie_monster->SetPersistSessionCookies(true); | 1448 cookie_monster->SetPersistSessionCookies(true); |
1443 } | 1449 } |
1444 } | 1450 } |
1445 | 1451 |
1446 return cookie_monster; | 1452 return cookie_monster; |
1447 } | 1453 } |
1448 | 1454 |
1449 } // namespace content | 1455 } // namespace content |
OLD | NEW |