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

Unified Diff: chrome/browser/password_manager/login_database.cc

Issue 1567022: Implement LoginDatabase on all platforms. (Closed)
Patch Set: Update Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/login_database.cc
diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc
index 7f31372e2fab88d7a9682d58b8c64b9a962fad4b..02d2fb6cb0f320c7d6312cae7100c4571cc2076b 100644
--- a/chrome/browser/password_manager/login_database.cc
+++ b/chrome/browser/password_manager/login_database.cc
@@ -298,6 +298,38 @@ bool LoginDatabase::GetLogins(const PasswordForm& form,
return result == SQLITE_DONE;
}
+bool LoginDatabase::GetLoginsCreatedBetween(
+ const base::Time begin,
+ const base::Time end,
+ std::vector<webkit_glue::PasswordForm*>* forms) const {
+ DCHECK(forms);
+ SQLStatement s;
+ std::string stmt = "SELECT origin_url, action_url, "
+ "username_element, username_value, "
+ "password_element, password_value, "
+ "submit_element, signon_realm, ssl_valid, preferred, "
+ "date_created, blacklisted_by_user, scheme FROM logins "
+ "WHERE date_created >= ? AND date_created < ?"
+ "ORDER BY origin_url";
+
+ if (s.prepare(db_, stmt.c_str()) != SQLITE_OK) {
+ NOTREACHED() << "Statement prepare failed";
+ return false;
+ }
+ s.bind_int64(0, begin.ToTimeT());
+ s.bind_int64(1, end.is_null() ? std::numeric_limits<int64>::max()
+ : end.ToTimeT());
+
+ int result;
+ while ((result = s.step()) == SQLITE_ROW) {
+ PasswordForm* new_form = new PasswordForm();
+ InitPasswordFormFromStatement(new_form, &s);
+
+ forms->push_back(new_form);
+ }
+ return result == SQLITE_DONE;
+}
+
bool LoginDatabase::GetAutofillableLogins(
std::vector<PasswordForm*>* forms) const {
return GetAllLoginsWithBlacklistSetting(false, forms);
« no previous file with comments | « chrome/browser/password_manager/login_database.h ('k') | chrome/browser/password_manager/login_database_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698