OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/password_manager/login_database.h" | 5 #include "chrome/browser/password_manager/login_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 int result; | 291 int result; |
292 while ((result = s.step()) == SQLITE_ROW) { | 292 while ((result = s.step()) == SQLITE_ROW) { |
293 PasswordForm* new_form = new PasswordForm(); | 293 PasswordForm* new_form = new PasswordForm(); |
294 InitPasswordFormFromStatement(new_form, &s); | 294 InitPasswordFormFromStatement(new_form, &s); |
295 | 295 |
296 forms->push_back(new_form); | 296 forms->push_back(new_form); |
297 } | 297 } |
298 return result == SQLITE_DONE; | 298 return result == SQLITE_DONE; |
299 } | 299 } |
300 | 300 |
| 301 bool LoginDatabase::GetLoginsCreatedBetween( |
| 302 const base::Time begin, |
| 303 const base::Time end, |
| 304 std::vector<webkit_glue::PasswordForm*>* forms) const { |
| 305 DCHECK(forms); |
| 306 SQLStatement s; |
| 307 std::string stmt = "SELECT origin_url, action_url, " |
| 308 "username_element, username_value, " |
| 309 "password_element, password_value, " |
| 310 "submit_element, signon_realm, ssl_valid, preferred, " |
| 311 "date_created, blacklisted_by_user, scheme FROM logins " |
| 312 "WHERE date_created >= ? AND date_created < ?" |
| 313 "ORDER BY origin_url"; |
| 314 |
| 315 if (s.prepare(db_, stmt.c_str()) != SQLITE_OK) { |
| 316 NOTREACHED() << "Statement prepare failed"; |
| 317 return false; |
| 318 } |
| 319 s.bind_int64(0, begin.ToTimeT()); |
| 320 s.bind_int64(1, end.is_null() ? std::numeric_limits<int64>::max() |
| 321 : end.ToTimeT()); |
| 322 |
| 323 int result; |
| 324 while ((result = s.step()) == SQLITE_ROW) { |
| 325 PasswordForm* new_form = new PasswordForm(); |
| 326 InitPasswordFormFromStatement(new_form, &s); |
| 327 |
| 328 forms->push_back(new_form); |
| 329 } |
| 330 return result == SQLITE_DONE; |
| 331 } |
| 332 |
301 bool LoginDatabase::GetAutofillableLogins( | 333 bool LoginDatabase::GetAutofillableLogins( |
302 std::vector<PasswordForm*>* forms) const { | 334 std::vector<PasswordForm*>* forms) const { |
303 return GetAllLoginsWithBlacklistSetting(false, forms); | 335 return GetAllLoginsWithBlacklistSetting(false, forms); |
304 } | 336 } |
305 | 337 |
306 bool LoginDatabase::GetBlacklistLogins( | 338 bool LoginDatabase::GetBlacklistLogins( |
307 std::vector<PasswordForm*>* forms) const { | 339 std::vector<PasswordForm*>* forms) const { |
308 return GetAllLoginsWithBlacklistSetting(true, forms); | 340 return GetAllLoginsWithBlacklistSetting(true, forms); |
309 } | 341 } |
310 | 342 |
(...skipping 18 matching lines...) Expand all Loading... |
329 | 361 |
330 int result; | 362 int result; |
331 while ((result = s.step()) == SQLITE_ROW) { | 363 while ((result = s.step()) == SQLITE_ROW) { |
332 PasswordForm* new_form = new PasswordForm(); | 364 PasswordForm* new_form = new PasswordForm(); |
333 InitPasswordFormFromStatement(new_form, &s); | 365 InitPasswordFormFromStatement(new_form, &s); |
334 | 366 |
335 forms->push_back(new_form); | 367 forms->push_back(new_form); |
336 } | 368 } |
337 return result == SQLITE_DONE; | 369 return result == SQLITE_DONE; |
338 } | 370 } |
OLD | NEW |