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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <limits> | 11 #include <limits> |
9 | 12 |
10 #include "base/bind.h" | 13 #include "base/bind.h" |
11 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" |
13 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
14 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
15 #include "base/pickle.h" | 19 #include "base/pickle.h" |
16 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
17 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
19 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "build/build_config.h" |
20 #include "components/autofill/core/common/password_form.h" | 25 #include "components/autofill/core/common/password_form.h" |
21 #include "components/password_manager/core/browser/affiliation_utils.h" | 26 #include "components/password_manager/core/browser/affiliation_utils.h" |
22 #include "components/password_manager/core/browser/password_manager_client.h" | 27 #include "components/password_manager/core/browser/password_manager_client.h" |
23 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 28 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
24 #include "google_apis/gaia/gaia_auth_util.h" | 29 #include "google_apis/gaia/gaia_auth_util.h" |
25 #include "google_apis/gaia/gaia_urls.h" | 30 #include "google_apis/gaia/gaia_urls.h" |
26 #include "sql/connection.h" | 31 #include "sql/connection.h" |
27 #include "sql/statement.h" | 32 #include "sql/statement.h" |
28 #include "sql/transaction.h" | 33 #include "sql/transaction.h" |
29 #include "url/url_constants.h" | 34 #include "url/url_constants.h" |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 for (size_t i = 0; i < forms.size(); i++) { | 990 for (size_t i = 0; i < forms.size(); i++) { |
986 DeleteEncryptedPassword(*forms[i]); | 991 DeleteEncryptedPassword(*forms[i]); |
987 } | 992 } |
988 } | 993 } |
989 #endif | 994 #endif |
990 | 995 |
991 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 996 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
992 "DELETE FROM logins WHERE " | 997 "DELETE FROM logins WHERE " |
993 "date_created >= ? AND date_created < ?")); | 998 "date_created >= ? AND date_created < ?")); |
994 s.BindInt64(0, delete_begin.ToInternalValue()); | 999 s.BindInt64(0, delete_begin.ToInternalValue()); |
995 s.BindInt64(1, delete_end.is_null() ? std::numeric_limits<int64>::max() | 1000 s.BindInt64(1, delete_end.is_null() ? std::numeric_limits<int64_t>::max() |
996 : delete_end.ToInternalValue()); | 1001 : delete_end.ToInternalValue()); |
997 | 1002 |
998 return s.Run(); | 1003 return s.Run(); |
999 } | 1004 } |
1000 | 1005 |
1001 bool LoginDatabase::RemoveLoginsSyncedBetween(base::Time delete_begin, | 1006 bool LoginDatabase::RemoveLoginsSyncedBetween(base::Time delete_begin, |
1002 base::Time delete_end) { | 1007 base::Time delete_end) { |
1003 sql::Statement s(db_.GetCachedStatement( | 1008 sql::Statement s(db_.GetCachedStatement( |
1004 SQL_FROM_HERE, | 1009 SQL_FROM_HERE, |
1005 "DELETE FROM logins WHERE date_synced >= ? AND date_synced < ?")); | 1010 "DELETE FROM logins WHERE date_synced >= ? AND date_synced < ?")); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 "SELECT origin_url, action_url, " | 1158 "SELECT origin_url, action_url, " |
1154 "username_element, username_value, " | 1159 "username_element, username_value, " |
1155 "password_element, password_value, submit_element, " | 1160 "password_element, password_value, submit_element, " |
1156 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " | 1161 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, " |
1157 "scheme, password_type, possible_usernames, times_used, form_data, " | 1162 "scheme, password_type, possible_usernames, times_used, form_data, " |
1158 "date_synced, display_name, icon_url, " | 1163 "date_synced, display_name, icon_url, " |
1159 "federation_url, skip_zero_click, generation_upload_status FROM logins " | 1164 "federation_url, skip_zero_click, generation_upload_status FROM logins " |
1160 "WHERE date_created >= ? AND date_created < ?" | 1165 "WHERE date_created >= ? AND date_created < ?" |
1161 "ORDER BY origin_url")); | 1166 "ORDER BY origin_url")); |
1162 s.BindInt64(0, begin.ToInternalValue()); | 1167 s.BindInt64(0, begin.ToInternalValue()); |
1163 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() | 1168 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64_t>::max() |
1164 : end.ToInternalValue()); | 1169 : end.ToInternalValue()); |
1165 | 1170 |
1166 return StatementToForms(&s, nullptr, forms); | 1171 return StatementToForms(&s, nullptr, forms); |
1167 } | 1172 } |
1168 | 1173 |
1169 bool LoginDatabase::GetLoginsSyncedBetween( | 1174 bool LoginDatabase::GetLoginsSyncedBetween( |
1170 const base::Time begin, | 1175 const base::Time begin, |
1171 const base::Time end, | 1176 const base::Time end, |
1172 ScopedVector<autofill::PasswordForm>* forms) const { | 1177 ScopedVector<autofill::PasswordForm>* forms) const { |
1173 DCHECK(forms); | 1178 DCHECK(forms); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 1294 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
1290 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); | 1295 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); |
1291 } | 1296 } |
1292 | 1297 |
1293 if (!statement->Succeeded()) | 1298 if (!statement->Succeeded()) |
1294 return false; | 1299 return false; |
1295 return true; | 1300 return true; |
1296 } | 1301 } |
1297 | 1302 |
1298 } // namespace password_manager | 1303 } // namespace password_manager |
OLD | NEW |