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

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

Issue 2652243002: Implement Federated PSL Matches in Native Backends (Closed)
Patch Set: Addressed comments. Created 3 years, 11 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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 forms->clear(); 1210 forms->clear();
1211 while (statement->Step()) { 1211 while (statement->Step()) {
1212 auto new_form = base::MakeUnique<PasswordForm>(); 1212 auto new_form = base::MakeUnique<PasswordForm>();
1213 EncryptionResult result = 1213 EncryptionResult result =
1214 InitPasswordFormFromStatement(new_form.get(), *statement); 1214 InitPasswordFormFromStatement(new_form.get(), *statement);
1215 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) 1215 if (result == ENCRYPTION_RESULT_SERVICE_FAILURE)
1216 return false; 1216 return false;
1217 if (result == ENCRYPTION_RESULT_ITEM_FAILURE) 1217 if (result == ENCRYPTION_RESULT_ITEM_FAILURE)
1218 continue; 1218 continue;
1219 DCHECK_EQ(ENCRYPTION_RESULT_SUCCESS, result); 1219 DCHECK_EQ(ENCRYPTION_RESULT_SUCCESS, result);
1220 if (matched_form && matched_form->signon_realm != new_form->signon_realm) {
1221 if (new_form->scheme != PasswordForm::SCHEME_HTML)
1222 continue; // Ignore non-HTML matches.
1223 1220
1224 if (IsPublicSuffixDomainMatch(new_form->signon_realm, 1221 if (matched_form) {
1225 matched_form->signon_realm)) { 1222 switch (GetMatchResult(*new_form, *matched_form)) {
1226 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND; 1223 case MatchResult::NO_MATCH:
1227 new_form->is_public_suffix_match = true; 1224 continue;
1228 } else if (!new_form->federation_origin.unique() && 1225 case MatchResult::EXACT_MATCH:
1229 IsFederatedMatch(new_form->signon_realm, 1226 break;
1230 matched_form->origin)) { 1227 case MatchResult::PSL_MATCH:
1231 } else if (!new_form->federation_origin.unique() && 1228 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND;
1232 IsFederatedPSLMatch(new_form->signon_realm, 1229 new_form->is_public_suffix_match = true;
1233 matched_form->origin)) { 1230 break;
1234 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND_FEDERATED; 1231 case MatchResult::FEDERATED_MATCH:
1235 new_form->is_public_suffix_match = true; 1232 break;
1236 } else { 1233 case MatchResult::FEDERATED_PSL_MATCH:
1237 continue; 1234 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND_FEDERATED;
1235 new_form->is_public_suffix_match = true;
1236 break;
1238 } 1237 }
1239 } 1238 }
1239
1240 forms->push_back(std::move(new_form)); 1240 forms->push_back(std::move(new_form));
1241 } 1241 }
1242 1242
1243 if (matched_form) { 1243 if (matched_form) {
1244 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", 1244 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering",
1245 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); 1245 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT);
1246 } 1246 }
1247 1247
1248 if (!statement->Succeeded()) 1248 if (!statement->Succeeded())
1249 return false; 1249 return false;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 DCHECK(blacklisted_statement_.empty()); 1310 DCHECK(blacklisted_statement_.empty());
1311 blacklisted_statement_ = 1311 blacklisted_statement_ =
1312 "SELECT " + all_column_names + 1312 "SELECT " + all_column_names +
1313 " FROM logins WHERE blacklisted_by_user == ? ORDER BY origin_url"; 1313 " FROM logins WHERE blacklisted_by_user == ? ORDER BY origin_url";
1314 DCHECK(encrypted_statement_.empty()); 1314 DCHECK(encrypted_statement_.empty());
1315 encrypted_statement_ = 1315 encrypted_statement_ =
1316 "SELECT password_value FROM logins WHERE " + all_unique_key_column_names; 1316 "SELECT password_value FROM logins WHERE " + all_unique_key_column_names;
1317 } 1317 }
1318 1318
1319 } // namespace password_manager 1319 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698