OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // Deletes the login database file on disk, and creates a new, empty database. | 105 // Deletes the login database file on disk, and creates a new, empty database. |
106 // This can be used after migrating passwords to some other store, to ensure | 106 // This can be used after migrating passwords to some other store, to ensure |
107 // that SQLite doesn't leave fragments of passwords in the database file. | 107 // that SQLite doesn't leave fragments of passwords in the database file. |
108 // Returns true on success; otherwise, whether the file was deleted and | 108 // Returns true on success; otherwise, whether the file was deleted and |
109 // whether further use of this login database will succeed is unspecified. | 109 // whether further use of this login database will succeed is unspecified. |
110 bool DeleteAndRecreateDatabaseFile(); | 110 bool DeleteAndRecreateDatabaseFile(); |
111 | 111 |
112 StatisticsTable& stats_table() { return stats_table_; } | 112 StatisticsTable& stats_table() { return stats_table_; } |
113 | 113 |
| 114 void set_clear_password_values(bool val) { clear_password_values_ = val; } |
| 115 |
114 private: | 116 private: |
115 // Result values for encryption/decryption actions. | 117 // Result values for encryption/decryption actions. |
116 enum EncryptionResult { | 118 enum EncryptionResult { |
117 // Success. | 119 // Success. |
118 ENCRYPTION_RESULT_SUCCESS, | 120 ENCRYPTION_RESULT_SUCCESS, |
119 // Failure for a specific item (e.g., the encrypted value was manually | 121 // Failure for a specific item (e.g., the encrypted value was manually |
120 // moved from another machine, and can't be decrypted on this machine). | 122 // moved from another machine, and can't be decrypted on this machine). |
121 // This is presumed to be a permanent failure. | 123 // This is presumed to be a permanent failure. |
122 ENCRYPTION_RESULT_ITEM_FAILURE, | 124 ENCRYPTION_RESULT_ITEM_FAILURE, |
123 // A service-level failure (e.g., on a platform using a keyring, the keyring | 125 // A service-level failure (e.g., on a platform using a keyring, the keyring |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // |*psl_match|. On success returns true. | 165 // |*psl_match|. On success returns true. |
164 static bool StatementToForms(sql::Statement* statement, | 166 static bool StatementToForms(sql::Statement* statement, |
165 const autofill::PasswordForm* psl_match, | 167 const autofill::PasswordForm* psl_match, |
166 ScopedVector<autofill::PasswordForm>* forms); | 168 ScopedVector<autofill::PasswordForm>* forms); |
167 | 169 |
168 base::FilePath db_path_; | 170 base::FilePath db_path_; |
169 mutable sql::Connection db_; | 171 mutable sql::Connection db_; |
170 sql::MetaTable meta_table_; | 172 sql::MetaTable meta_table_; |
171 StatisticsTable stats_table_; | 173 StatisticsTable stats_table_; |
172 | 174 |
| 175 // If set to 'true', then the password values are cleared before encrypting |
| 176 // and storing in the database. At the same time AddLogin/UpdateLogin return |
| 177 // PasswordStoreChangeList containing the real password. |
| 178 // This is a temporary measure for migration the Keychain on Mac. |
| 179 // crbug.com/466638 |
| 180 bool clear_password_values_; |
| 181 |
173 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); | 182 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); |
174 }; | 183 }; |
175 | 184 |
176 } // namespace password_manager | 185 } // namespace password_manager |
177 | 186 |
178 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 187 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
OLD | NEW |