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

Unified Diff: components/password_manager/core/browser/login_database.h

Issue 2126713006: Refactor LoginDatabase migration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/login_database.h
diff --git a/components/password_manager/core/browser/login_database.h b/components/password_manager/core/browser/login_database.h
index 13a7eaa75d7407e56d4b43c45ff6574a5721a8fd..c6bc208632306b44bf25fcc694206b2a270624a1 100644
--- a/components/password_manager/core/browser/login_database.h
+++ b/components/password_manager/core/browser/login_database.h
@@ -28,6 +28,8 @@
namespace password_manager {
+class SQLTableBuilder;
+
extern const int kCurrentVersionNumber;
extern const int kCompatibleVersionNumber;
@@ -170,9 +172,6 @@ class LoginDatabase {
static EncryptionResult DecryptedString(const std::string& cipher_text,
base::string16* plain_text);
- bool InitLoginsTable();
- bool MigrateOldVersionsAsNeeded();
-
// Fills |form| from the values in the given statement (which is assumed to
// be of the form used by the Get*Logins methods).
// Returns the EncryptionResult from decrypting the password in |s|; if not
@@ -195,6 +194,10 @@ class LoginDatabase {
const autofill::PasswordForm* matched_form,
ScopedVector<autofill::PasswordForm>* forms);
+ // Initializes all the *_statement_ data members with appropriate SQL
+ // fragments based on |builder|.
+ void InitializeStatementStrings(const SQLTableBuilder& builder);
+
base::FilePath db_path_;
mutable sql::Connection db_;
sql::MetaTable meta_table_;
@@ -207,6 +210,21 @@ class LoginDatabase {
// crbug.com/466638
bool clear_password_values_;
+ // These cached strings are used to build SQL statements.
+ std::string add_statement_;
+ std::string add_replace_statement_;
+ std::string update_statement_;
+ std::string delete_statement_;
+ std::string autosignin_statement_;
+ std::string get_statement_;
+ std::string get_statement_psl_;
+ std::string get_statement_federated_;
+ std::string get_statement_psl_federated_;
+ std::string created_statement_;
+ std::string synced_statement_;
+ std::string blacklisted_statement_;
+ std::string encrypted_statement_;
+
DISALLOW_COPY_AND_ASSIGN(LoginDatabase);
};
« no previous file with comments | « components/password_manager/core/browser/BUILD.gn ('k') | components/password_manager/core/browser/login_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698