| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // crbug.com/349138 for details. | 355 // crbug.com/349138 for details. |
| 356 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 356 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 357 "UPDATE OR REPLACE logins SET " | 357 "UPDATE OR REPLACE logins SET " |
| 358 "action_url = ?, " | 358 "action_url = ?, " |
| 359 "password_value = ?, " | 359 "password_value = ?, " |
| 360 "ssl_valid = ?, " | 360 "ssl_valid = ?, " |
| 361 "preferred = ?, " | 361 "preferred = ?, " |
| 362 "possible_usernames = ?, " | 362 "possible_usernames = ?, " |
| 363 "times_used = ?, " | 363 "times_used = ?, " |
| 364 "submit_element = ?, " | 364 "submit_element = ?, " |
| 365 "date_synced = ? " | 365 "date_synced = ?, " |
| 366 "date_created = ?, " |
| 367 "blacklisted_by_user = ?, " |
| 368 "scheme = ?, " |
| 369 "password_type = ? " |
| 366 "WHERE origin_url = ? AND " | 370 "WHERE origin_url = ? AND " |
| 367 "username_element = ? AND " | 371 "username_element = ? AND " |
| 368 "username_value = ? AND " | 372 "username_value = ? AND " |
| 369 "password_element = ? AND " | 373 "password_element = ? AND " |
| 370 "signon_realm = ?")); | 374 "signon_realm = ?")); |
| 371 s.BindString(0, form.action.spec()); | 375 s.BindString(0, form.action.spec()); |
| 372 s.BindBlob(1, encrypted_password.data(), | 376 s.BindBlob(1, encrypted_password.data(), |
| 373 static_cast<int>(encrypted_password.length())); | 377 static_cast<int>(encrypted_password.length())); |
| 374 s.BindInt(2, form.ssl_valid); | 378 s.BindInt(2, form.ssl_valid); |
| 375 s.BindInt(3, form.preferred); | 379 s.BindInt(3, form.preferred); |
| 376 Pickle pickle = SerializeVector(form.other_possible_usernames); | 380 Pickle pickle = SerializeVector(form.other_possible_usernames); |
| 377 s.BindBlob(4, pickle.data(), pickle.size()); | 381 s.BindBlob(4, pickle.data(), pickle.size()); |
| 378 s.BindInt(5, form.times_used); | 382 s.BindInt(5, form.times_used); |
| 379 s.BindString16(6, form.submit_element); | 383 s.BindString16(6, form.submit_element); |
| 380 s.BindInt64(7, form.date_synced.ToInternalValue()); | 384 s.BindInt64(7, form.date_synced.ToInternalValue()); |
| 385 s.BindInt64(8, form.date_created.ToTimeT()); |
| 386 s.BindInt(9, form.blacklisted_by_user); |
| 387 s.BindInt(10, form.scheme); |
| 388 s.BindInt(11, form.type); |
| 381 | 389 |
| 382 s.BindString(8, form.origin.spec()); | 390 s.BindString(12, form.origin.spec()); |
| 383 s.BindString16(9, form.username_element); | 391 s.BindString16(13, form.username_element); |
| 384 s.BindString16(10, form.username_value); | 392 s.BindString16(14, form.username_value); |
| 385 s.BindString16(11, form.password_element); | 393 s.BindString16(15, form.password_element); |
| 386 s.BindString(12, form.signon_realm); | 394 s.BindString(16, form.signon_realm); |
| 387 | 395 |
| 388 if (!s.Run()) | 396 if (!s.Run()) |
| 389 return PasswordStoreChangeList(); | 397 return PasswordStoreChangeList(); |
| 390 | 398 |
| 391 PasswordStoreChangeList list; | 399 PasswordStoreChangeList list; |
| 392 if (db_.GetLastChangeCount()) | 400 if (db_.GetLastChangeCount()) |
| 393 list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); | 401 list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); |
| 394 | 402 |
| 395 return list; | 403 return list; |
| 396 } | 404 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 697 |
| 690 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { | 698 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { |
| 691 DCHECK(db_.is_open()); | 699 DCHECK(db_.is_open()); |
| 692 meta_table_.Reset(); | 700 meta_table_.Reset(); |
| 693 db_.Close(); | 701 db_.Close(); |
| 694 sql::Connection::Delete(db_path_); | 702 sql::Connection::Delete(db_path_); |
| 695 return Init(db_path_); | 703 return Init(db_path_); |
| 696 } | 704 } |
| 697 | 705 |
| 698 } // namespace password_manager | 706 } // namespace password_manager |
| OLD | NEW |