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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 "federation_url, skip_zero_click, generation_upload_status FROM logins " | 861 "federation_url, skip_zero_click, generation_upload_status FROM logins " |
862 "WHERE date_created >= ? AND date_created < ?" | 862 "WHERE date_created >= ? AND date_created < ?" |
863 "ORDER BY origin_url")); | 863 "ORDER BY origin_url")); |
864 s.BindInt64(0, begin.ToInternalValue()); | 864 s.BindInt64(0, begin.ToInternalValue()); |
865 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() | 865 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() |
866 : end.ToInternalValue()); | 866 : end.ToInternalValue()); |
867 | 867 |
868 return StatementToForms(&s, nullptr, forms); | 868 return StatementToForms(&s, nullptr, forms); |
869 } | 869 } |
870 | 870 |
| 871 int LoginDatabase::GetCountOfLogins() const { |
| 872 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 873 "SELECT COUNT(*) FROM logins " |
| 874 "WHERE blacklisted_by_user = 0")); |
| 875 |
| 876 s.Step(); |
| 877 return s.ColumnInt(0); |
| 878 } |
| 879 |
871 bool LoginDatabase::GetLoginsSyncedBetween( | 880 bool LoginDatabase::GetLoginsSyncedBetween( |
872 const base::Time begin, | 881 const base::Time begin, |
873 const base::Time end, | 882 const base::Time end, |
874 ScopedVector<autofill::PasswordForm>* forms) const { | 883 ScopedVector<autofill::PasswordForm>* forms) const { |
875 DCHECK(forms); | 884 DCHECK(forms); |
876 sql::Statement s(db_.GetCachedStatement( | 885 sql::Statement s(db_.GetCachedStatement( |
877 SQL_FROM_HERE, | 886 SQL_FROM_HERE, |
878 "SELECT origin_url, action_url, username_element, username_value, " | 887 "SELECT origin_url, action_url, username_element, username_value, " |
879 "password_element, password_value, submit_element, signon_realm, " | 888 "password_element, password_value, submit_element, signon_realm, " |
880 "ssl_valid, preferred, date_created, blacklisted_by_user, " | 889 "ssl_valid, preferred, date_created, blacklisted_by_user, " |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 983 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
975 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); | 984 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); |
976 } | 985 } |
977 | 986 |
978 if (!statement->Succeeded()) | 987 if (!statement->Succeeded()) |
979 return false; | 988 return false; |
980 return true; | 989 return true; |
981 } | 990 } |
982 | 991 |
983 } // namespace password_manager | 992 } // namespace password_manager |
OLD | NEW |