| Index: components/password_manager/core/browser/login_database.cc
|
| diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc
|
| index 50861a350e51625e7fde29cae1fd40f803fab3ef..8426ded4b6e2e8397319b1c285330605049f7435 100644
|
| --- a/components/password_manager/core/browser/login_database.cc
|
| +++ b/components/password_manager/core/browser/login_database.cc
|
| @@ -829,15 +829,21 @@ void LoginDatabase::ReportMetrics(const std::string& sync_username,
|
| }
|
|
|
| PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) {
|
| + VLOG(0) << "LoginDatabase::AddLogin: Started.";
|
| PasswordStoreChangeList list;
|
| - if (!DoesMatchConstraints(form))
|
| + if (!DoesMatchConstraints(form)) {
|
| + VLOG(0) << "LoginDatabase::AddLogin: Constraints not matching.";
|
| return list;
|
| + }
|
| std::string encrypted_password;
|
| if (EncryptedString(
|
| clear_password_values_ ? base::string16() : form.password_value,
|
| - &encrypted_password) != ENCRYPTION_RESULT_SUCCESS)
|
| + &encrypted_password) != ENCRYPTION_RESULT_SUCCESS) {
|
| + VLOG(0) << "LoginDatabase::AddLogin: Encryption failed.";
|
| return list;
|
| + }
|
|
|
| + VLOG(0) << "LoginDatabase::AddLogin: Preparing INSERT SQL statement.";
|
| // You *must* change LoginTableColumns if this query changes.
|
| sql::Statement s(db_.GetCachedStatement(
|
| SQL_FROM_HERE,
|
| @@ -849,15 +855,22 @@ PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) {
|
| " date_synced, display_name, icon_url,"
|
| " federation_url, skip_zero_click, generation_upload_status) VALUES "
|
| "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
|
| + VLOG(0) << "LoginDatabase::AddLogin: Binding INSERT SQL parameters.";
|
| BindAddStatement(form, encrypted_password, &s);
|
| db_.set_error_callback(base::Bind(&AddCallback));
|
| + VLOG(0) << "LoginDatabase::AddLogin: Running INSERT SQL statement.";
|
| const bool success = s.Run();
|
| db_.reset_error_callback();
|
| if (success) {
|
| + VLOG(0) << "LoginDatabase::AddLogin: INSERT SQL operation succeeded.";
|
| list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
|
| return list;
|
| }
|
| // Repeat the same statement but with REPLACE semantic.
|
| + VLOG(0)
|
| + << "LoginDatabase::AddLogin: Adding failed -- trying REPLACE semantics.";
|
| +
|
| + VLOG(0) << "LoginDatabase::AddLogin: Preparing REPLACE SQL statement.";
|
| s.Assign(db_.GetCachedStatement(
|
| SQL_FROM_HERE,
|
| "INSERT OR REPLACE INTO logins "
|
| @@ -868,11 +881,16 @@ PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) {
|
| " date_synced, display_name, icon_url,"
|
| " federation_url, skip_zero_click, generation_upload_status) VALUES "
|
| "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
|
| +
|
| + VLOG(0) << "LoginDatabase::AddLogin: Binding REPLACE SQL parameters.";
|
| BindAddStatement(form, encrypted_password, &s);
|
| + VLOG(0) << "LoginDatabase::AddLogin: Running REPLACE SQL statement.";
|
| if (s.Run()) {
|
| + VLOG(0) << "LoginDatabase::AddLogin: REPLACE SQL operation succeeded.";
|
| list.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form));
|
| list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
|
| }
|
| + VLOG(0) << "LoginDatabase::AddLogin: Returning result.";
|
| return list;
|
| }
|
|
|
| @@ -950,14 +968,18 @@ PasswordStoreChangeList LoginDatabase::UpdateLogin(const PasswordForm& form) {
|
| }
|
|
|
| bool LoginDatabase::RemoveLogin(const PasswordForm& form) {
|
| + VLOG(0) << "LoginDatabase::RemoveLogin: Started.";
|
| +
|
| if (form.is_public_suffix_match) {
|
| // TODO(dvadym): Discuss whether we should allow to remove PSL matched
|
| // credentials.
|
| + VLOG(0) << "LoginDatabase::RemoveLogin: Public suffix match exists.";
|
| return false;
|
| }
|
| #if defined(OS_IOS)
|
| DeleteEncryptedPassword(form);
|
| #endif
|
| + VLOG(0) << "LoginDatabase::RemoveLogin: Preparing SQL statement.";
|
| // Remove a login by UNIQUE-constrained fields.
|
| sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "DELETE FROM logins WHERE "
|
| @@ -967,6 +989,8 @@ bool LoginDatabase::RemoveLogin(const PasswordForm& form) {
|
| "password_element = ? AND "
|
| "submit_element = ? AND "
|
| "signon_realm = ? "));
|
| +
|
| + VLOG(0) << "LoginDatabase::RemoveLogin: Binding SQL parameters.";
|
| s.BindString(0, form.origin.spec());
|
| s.BindString16(1, form.username_element);
|
| s.BindString16(2, form.username_value);
|
| @@ -974,6 +998,7 @@ bool LoginDatabase::RemoveLogin(const PasswordForm& form) {
|
| s.BindString16(4, form.submit_element);
|
| s.BindString(5, form.signon_realm);
|
|
|
| + VLOG(0) << "LoginDatabase::RemoveLogin: Running SQL statement.";
|
| return s.Run() && db_.GetLastChangeCount() > 0;
|
| }
|
|
|
| @@ -1147,7 +1172,9 @@ bool LoginDatabase::GetLoginsCreatedBetween(
|
| const base::Time begin,
|
| const base::Time end,
|
| ScopedVector<autofill::PasswordForm>* forms) const {
|
| + VLOG(0) << "LoginDatabase::GetLoginsCreatedBetween: Started.";
|
| DCHECK(forms);
|
| + VLOG(0) << "LoginDatabase::GetLoginsCreatedBetween: Preparing SQL statement.";
|
| sql::Statement s(db_.GetCachedStatement(
|
| SQL_FROM_HERE,
|
| "SELECT origin_url, action_url, "
|
| @@ -1159,10 +1186,12 @@ bool LoginDatabase::GetLoginsCreatedBetween(
|
| "federation_url, skip_zero_click, generation_upload_status FROM logins "
|
| "WHERE date_created >= ? AND date_created < ?"
|
| "ORDER BY origin_url"));
|
| + VLOG(0) << "LoginDatabase::GetLoginsCreatedBetween: Binding SQL parameters.";
|
| s.BindInt64(0, begin.ToInternalValue());
|
| s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max()
|
| : end.ToInternalValue());
|
|
|
| + VLOG(0) << "LoginDatabase::GetLoginsCreatedBetween: Running SQL statement.";
|
| return StatementToForms(&s, nullptr, forms);
|
| }
|
|
|
|
|