| 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 "chrome/browser/password_manager/login_database.h" | 5 #include "chrome/browser/password_manager/login_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 LoginDatabase::~LoginDatabase() { | 91 LoginDatabase::~LoginDatabase() { |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool LoginDatabase::Init(const base::FilePath& db_path) { | 94 bool LoginDatabase::Init(const base::FilePath& db_path) { |
| 95 // Set pragmas for a small, private database (based on WebDatabase). | 95 // Set pragmas for a small, private database (based on WebDatabase). |
| 96 db_.set_page_size(2048); | 96 db_.set_page_size(2048); |
| 97 db_.set_cache_size(32); | 97 db_.set_cache_size(32); |
| 98 db_.set_exclusive_locking(); | 98 db_.set_exclusive_locking(); |
| 99 db_.set_restrict_to_user(); |
| 99 | 100 |
| 100 if (!db_.Open(db_path)) { | 101 if (!db_.Open(db_path)) { |
| 101 LOG(WARNING) << "Unable to open the password store database."; | 102 LOG(WARNING) << "Unable to open the password store database."; |
| 102 return false; | 103 return false; |
| 103 } | 104 } |
| 104 | 105 |
| 105 sql::Transaction transaction(&db_); | 106 sql::Transaction transaction(&db_); |
| 106 transaction.Begin(); | 107 transaction.Begin(); |
| 107 | 108 |
| 108 // Check the database version. | 109 // Check the database version. |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 std::vector<string16> LoginDatabase::DeserializeVector(const Pickle& p) const { | 550 std::vector<string16> LoginDatabase::DeserializeVector(const Pickle& p) const { |
| 550 std::vector<string16> ret; | 551 std::vector<string16> ret; |
| 551 string16 str; | 552 string16 str; |
| 552 | 553 |
| 553 PickleIterator iterator(p); | 554 PickleIterator iterator(p); |
| 554 while (iterator.ReadString16(&str)) { | 555 while (iterator.ReadString16(&str)) { |
| 555 ret.push_back(str); | 556 ret.push_back(str); |
| 556 } | 557 } |
| 557 return ret; | 558 return ret; |
| 558 } | 559 } |
| OLD | NEW |