OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |