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

Side by Side Diff: components/password_manager/core/browser/login_database.cc

Issue 2133953002: PasswordForm -> FormDigest for GetLogins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@413020_ssl_valid
Patch Set: Nits 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 unified diff | Download patch
OLDNEW
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 #include "components/password_manager/core/browser/login_database.h" 5 #include "components/password_manager/core/browser/login_database.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 s.ColumnInt(COLUMN_GENERATION_UPLOAD_STATUS); 1021 s.ColumnInt(COLUMN_GENERATION_UPLOAD_STATUS);
1022 DCHECK(generation_upload_status_int >= 0 && 1022 DCHECK(generation_upload_status_int >= 0 &&
1023 generation_upload_status_int <= PasswordForm::UNKNOWN_STATUS); 1023 generation_upload_status_int <= PasswordForm::UNKNOWN_STATUS);
1024 form->generation_upload_status = 1024 form->generation_upload_status =
1025 static_cast<PasswordForm::GenerationUploadStatus>( 1025 static_cast<PasswordForm::GenerationUploadStatus>(
1026 generation_upload_status_int); 1026 generation_upload_status_int);
1027 return ENCRYPTION_RESULT_SUCCESS; 1027 return ENCRYPTION_RESULT_SUCCESS;
1028 } 1028 }
1029 1029
1030 bool LoginDatabase::GetLogins( 1030 bool LoginDatabase::GetLogins(
1031 const PasswordForm& form, 1031 const PasswordStore::FormDigest& form,
1032 ScopedVector<autofill::PasswordForm>* forms) const { 1032 ScopedVector<autofill::PasswordForm>* forms) const {
1033 DCHECK(forms); 1033 DCHECK(forms);
1034 const GURL signon_realm(form.signon_realm); 1034 const GURL signon_realm(form.signon_realm);
1035 std::string registered_domain = GetRegistryControlledDomain(signon_realm); 1035 std::string registered_domain = GetRegistryControlledDomain(signon_realm);
1036 const bool should_PSL_matching_apply = 1036 const bool should_PSL_matching_apply =
1037 form.scheme == PasswordForm::SCHEME_HTML && 1037 form.scheme == PasswordForm::SCHEME_HTML &&
1038 ShouldPSLDomainMatchingApply(registered_domain); 1038 ShouldPSLDomainMatchingApply(registered_domain);
1039 const bool should_federated_apply = form.scheme == PasswordForm::SCHEME_HTML; 1039 const bool should_federated_apply = form.scheme == PasswordForm::SCHEME_HTML;
1040 DCHECK(!get_statement_.empty()); 1040 DCHECK(!get_statement_.empty());
1041 DCHECK(!get_statement_psl_.empty()); 1041 DCHECK(!get_statement_psl_.empty());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 std::string encrypted_password; 1174 std::string encrypted_password;
1175 if (s.Step()) { 1175 if (s.Step()) {
1176 s.ColumnBlobAsString(0, &encrypted_password); 1176 s.ColumnBlobAsString(0, &encrypted_password);
1177 } 1177 }
1178 return encrypted_password; 1178 return encrypted_password;
1179 } 1179 }
1180 1180
1181 // static 1181 // static
1182 bool LoginDatabase::StatementToForms( 1182 bool LoginDatabase::StatementToForms(
1183 sql::Statement* statement, 1183 sql::Statement* statement,
1184 const autofill::PasswordForm* matched_form, 1184 const PasswordStore::FormDigest* matched_form,
1185 ScopedVector<autofill::PasswordForm>* forms) { 1185 ScopedVector<autofill::PasswordForm>* forms) {
1186 PSLDomainMatchMetric psl_domain_match_metric = PSL_DOMAIN_MATCH_NONE; 1186 PSLDomainMatchMetric psl_domain_match_metric = PSL_DOMAIN_MATCH_NONE;
1187 1187
1188 forms->clear(); 1188 forms->clear();
1189 while (statement->Step()) { 1189 while (statement->Step()) {
1190 std::unique_ptr<PasswordForm> new_form(new PasswordForm()); 1190 std::unique_ptr<PasswordForm> new_form(new PasswordForm());
1191 EncryptionResult result = 1191 EncryptionResult result =
1192 InitPasswordFormFromStatement(new_form.get(), *statement); 1192 InitPasswordFormFromStatement(new_form.get(), *statement);
1193 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) 1193 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE)
1194 return false; 1194 return false;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 DCHECK(blacklisted_statement_.empty()); 1281 DCHECK(blacklisted_statement_.empty());
1282 blacklisted_statement_ = 1282 blacklisted_statement_ =
1283 "SELECT " + all_column_names + 1283 "SELECT " + all_column_names +
1284 " FROM logins WHERE blacklisted_by_user == ? ORDER BY origin_url"; 1284 " FROM logins WHERE blacklisted_by_user == ? ORDER BY origin_url";
1285 DCHECK(encrypted_statement_.empty()); 1285 DCHECK(encrypted_statement_.empty());
1286 encrypted_statement_ = 1286 encrypted_statement_ =
1287 "SELECT password_value FROM logins WHERE " + all_unique_key_column_names; 1287 "SELECT password_value FROM logins WHERE " + all_unique_key_column_names;
1288 } 1288 }
1289 1289
1290 } // namespace password_manager 1290 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698