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

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

Issue 779183003: LoginDatabase should allow retrieveing credentials with IP addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 6 years 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
« no previous file with comments | « no previous file | components/password_manager/core/browser/login_database_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 "password_element, password_value, submit_element, " 652 "password_element, password_value, submit_element, "
653 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " 653 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, "
654 "scheme, password_type, possible_usernames, times_used, form_data, " 654 "scheme, password_type, possible_usernames, times_used, form_data, "
655 "date_synced, display_name, avatar_url, " 655 "date_synced, display_name, avatar_url, "
656 "federation_url, is_zero_click FROM logins WHERE signon_realm == ? "; 656 "federation_url, is_zero_click FROM logins WHERE signon_realm == ? ";
657 sql::Statement s; 657 sql::Statement s;
658 const GURL signon_realm(form.signon_realm); 658 const GURL signon_realm(form.signon_realm);
659 std::string registered_domain = GetRegistryControlledDomain(signon_realm); 659 std::string registered_domain = GetRegistryControlledDomain(signon_realm);
660 PSLDomainMatchMetric psl_domain_match_metric = PSL_DOMAIN_MATCH_NONE; 660 PSLDomainMatchMetric psl_domain_match_metric = PSL_DOMAIN_MATCH_NONE;
661 const bool should_PSL_matching_apply = 661 const bool should_PSL_matching_apply =
662 form.scheme == PasswordForm::SCHEME_HTML &&
662 ShouldPSLDomainMatchingApply(registered_domain); 663 ShouldPSLDomainMatchingApply(registered_domain);
663 // PSL matching only applies to HTML forms. 664 // PSL matching only applies to HTML forms.
664 if (form.scheme == PasswordForm::SCHEME_HTML && should_PSL_matching_apply) { 665 if (should_PSL_matching_apply) {
665 // We are extending the original SQL query with one that includes more 666 // We are extending the original SQL query with one that includes more
666 // possible matches based on public suffix domain matching. Using a regexp 667 // possible matches based on public suffix domain matching. Using a regexp
667 // here is just an optimization to not have to parse all the stored entries 668 // here is just an optimization to not have to parse all the stored entries
668 // in the |logins| table. The result (scheme, domain and port) is verified 669 // in the |logins| table. The result (scheme, domain and port) is verified
669 // further down using GURL. See the functions SchemeMatches, 670 // further down using GURL. See the functions SchemeMatches,
670 // RegistryControlledDomainMatches and PortMatches. 671 // RegistryControlledDomainMatches and PortMatches.
671 const std::string extended_sql_query = 672 const std::string extended_sql_query =
672 sql_query + "OR signon_realm REGEXP ? "; 673 sql_query + "OR signon_realm REGEXP ? ";
673 // TODO(nyquist) Re-enable usage of GetCachedStatement when 674 // TODO(nyquist) Re-enable usage of GetCachedStatement when
674 // http://crbug.com/248608 is fixed. 675 // http://crbug.com/248608 is fixed.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 849
849 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { 850 bool LoginDatabase::DeleteAndRecreateDatabaseFile() {
850 DCHECK(db_.is_open()); 851 DCHECK(db_.is_open());
851 meta_table_.Reset(); 852 meta_table_.Reset();
852 db_.Close(); 853 db_.Close();
853 sql::Connection::Delete(db_path_); 854 sql::Connection::Delete(db_path_);
854 return Init(db_path_); 855 return Init(db_path_);
855 } 856 }
856 857
857 } // namespace password_manager 858 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/core/browser/login_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698