| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Returns true on success; otherwise, whether the file was deleted and | 140 // Returns true on success; otherwise, whether the file was deleted and |
| 141 // whether further use of this login database will succeed is unspecified. | 141 // whether further use of this login database will succeed is unspecified. |
| 142 bool DeleteAndRecreateDatabaseFile(); | 142 bool DeleteAndRecreateDatabaseFile(); |
| 143 | 143 |
| 144 // Returns the encrypted password value for the specified |form|. Returns an | 144 // Returns the encrypted password value for the specified |form|. Returns an |
| 145 // empty string if the row for this |form| is not found. | 145 // empty string if the row for this |form| is not found. |
| 146 std::string GetEncryptedPassword(const autofill::PasswordForm& form) const; | 146 std::string GetEncryptedPassword(const autofill::PasswordForm& form) const; |
| 147 | 147 |
| 148 StatisticsTable& stats_table() { return stats_table_; } | 148 StatisticsTable& stats_table() { return stats_table_; } |
| 149 | 149 |
| 150 void set_clear_password_values(bool val) { clear_password_values_ = val; } | |
| 151 | |
| 152 private: | 150 private: |
| 153 #if defined(OS_IOS) | 151 #if defined(OS_IOS) |
| 154 friend class LoginDatabaseIOSTest; | 152 friend class LoginDatabaseIOSTest; |
| 155 FRIEND_TEST_ALL_PREFIXES(LoginDatabaseIOSTest, KeychainStorage); | 153 FRIEND_TEST_ALL_PREFIXES(LoginDatabaseIOSTest, KeychainStorage); |
| 156 | 154 |
| 157 // On iOS, removes the keychain item that is used to store the | 155 // On iOS, removes the keychain item that is used to store the |
| 158 // encrypted password for the supplied |form|. | 156 // encrypted password for the supplied |form|. |
| 159 void DeleteEncryptedPassword(const autofill::PasswordForm& form); | 157 void DeleteEncryptedPassword(const autofill::PasswordForm& form); |
| 160 #endif | 158 #endif |
| 161 | 159 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 210 |
| 213 // Initializes all the *_statement_ data members with appropriate SQL | 211 // Initializes all the *_statement_ data members with appropriate SQL |
| 214 // fragments based on |builder|. | 212 // fragments based on |builder|. |
| 215 void InitializeStatementStrings(const SQLTableBuilder& builder); | 213 void InitializeStatementStrings(const SQLTableBuilder& builder); |
| 216 | 214 |
| 217 base::FilePath db_path_; | 215 base::FilePath db_path_; |
| 218 mutable sql::Connection db_; | 216 mutable sql::Connection db_; |
| 219 sql::MetaTable meta_table_; | 217 sql::MetaTable meta_table_; |
| 220 StatisticsTable stats_table_; | 218 StatisticsTable stats_table_; |
| 221 | 219 |
| 222 // If set to 'true', then the password values are cleared before encrypting | |
| 223 // and storing in the database. At the same time AddLogin/UpdateLogin return | |
| 224 // PasswordStoreChangeList containing the real password. | |
| 225 // This is a temporary measure for migration the Keychain on Mac. | |
| 226 // crbug.com/466638 | |
| 227 bool clear_password_values_; | |
| 228 | |
| 229 // These cached strings are used to build SQL statements. | 220 // These cached strings are used to build SQL statements. |
| 230 std::string add_statement_; | 221 std::string add_statement_; |
| 231 std::string add_replace_statement_; | 222 std::string add_replace_statement_; |
| 232 std::string update_statement_; | 223 std::string update_statement_; |
| 233 std::string delete_statement_; | 224 std::string delete_statement_; |
| 234 std::string autosignin_statement_; | 225 std::string autosignin_statement_; |
| 235 std::string get_statement_; | 226 std::string get_statement_; |
| 236 std::string get_statement_psl_; | 227 std::string get_statement_psl_; |
| 237 std::string get_statement_federated_; | 228 std::string get_statement_federated_; |
| 238 std::string get_statement_psl_federated_; | 229 std::string get_statement_psl_federated_; |
| 239 std::string get_same_organization_name_logins_statement_; | 230 std::string get_same_organization_name_logins_statement_; |
| 240 std::string created_statement_; | 231 std::string created_statement_; |
| 241 std::string synced_statement_; | 232 std::string synced_statement_; |
| 242 std::string blacklisted_statement_; | 233 std::string blacklisted_statement_; |
| 243 std::string encrypted_statement_; | 234 std::string encrypted_statement_; |
| 244 | 235 |
| 245 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); | 236 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); |
| 246 }; | 237 }; |
| 247 | 238 |
| 248 } // namespace password_manager | 239 } // namespace password_manager |
| 249 | 240 |
| 250 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 241 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
| OLD | NEW |