| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 return s.Run(); | 281 return s.Run(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) { | 284 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) { |
| 285 std::string encrypted_password; | 285 std::string encrypted_password; |
| 286 if (EncryptedString(form.password_value, &encrypted_password) != | 286 if (EncryptedString(form.password_value, &encrypted_password) != |
| 287 ENCRYPTION_RESULT_SUCCESS) | 287 ENCRYPTION_RESULT_SUCCESS) |
| 288 return false; | 288 return false; |
| 289 | 289 |
| 290 // Replacement is necessary to deal with updating imported credentials. See |
| 291 // crbug.com/349138 for details. |
| 290 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 292 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 291 "UPDATE logins SET " | 293 "UPDATE OR REPLACE logins SET " |
| 292 "action_url = ?, " | 294 "action_url = ?, " |
| 293 "password_value = ?, " | 295 "password_value = ?, " |
| 294 "ssl_valid = ?, " | 296 "ssl_valid = ?, " |
| 295 "preferred = ?, " | 297 "preferred = ?, " |
| 296 "possible_usernames = ?, " | 298 "possible_usernames = ?, " |
| 297 "times_used = ?, " | 299 "times_used = ?, " |
| 298 "username_element = ?, " | 300 "username_element = ?, " |
| 299 "password_element = ?, " | 301 "password_element = ?, " |
| 300 "submit_element = ? " | 302 "submit_element = ? " |
| 301 "WHERE origin_url = ? AND " | 303 "WHERE origin_url = ? AND " |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 const Pickle& p) const { | 594 const Pickle& p) const { |
| 593 std::vector<base::string16> ret; | 595 std::vector<base::string16> ret; |
| 594 base::string16 str; | 596 base::string16 str; |
| 595 | 597 |
| 596 PickleIterator iterator(p); | 598 PickleIterator iterator(p); |
| 597 while (iterator.ReadString16(&str)) { | 599 while (iterator.ReadString16(&str)) { |
| 598 ret.push_back(str); | 600 ret.push_back(str); |
| 599 } | 601 } |
| 600 return ret; | 602 return ret; |
| 601 } | 603 } |
| OLD | NEW |