| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return false; | 288 return false; |
| 289 | 289 |
| 290 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, | 290 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, |
| 291 "UPDATE logins SET " | 291 "UPDATE logins SET " |
| 292 "action_url = ?, " | 292 "action_url = ?, " |
| 293 "password_value = ?, " | 293 "password_value = ?, " |
| 294 "ssl_valid = ?, " | 294 "ssl_valid = ?, " |
| 295 "preferred = ?, " | 295 "preferred = ?, " |
| 296 "possible_usernames = ?, " | 296 "possible_usernames = ?, " |
| 297 "times_used = ?, " | 297 "times_used = ?, " |
| 298 "use_additional_auth = ? " | 298 "username_element = ?, " |
| 299 "password_element = ?, " |
| 300 "submit_element = ? " |
| 299 "WHERE origin_url = ? AND " | 301 "WHERE origin_url = ? AND " |
| 300 "username_element = ? AND " | 302 "(username_element = ? OR username_element = '') AND " |
| 301 "username_value = ? AND " | 303 "username_value = ? AND " |
| 302 "password_element = ? AND " | 304 "(password_element = ? OR password_element = '') AND " |
| 305 "(submit_element = ? OR submit_element = '') AND " |
| 303 "signon_realm = ?")); | 306 "signon_realm = ?")); |
| 304 s.BindString(0, form.action.spec()); | 307 s.BindString(0, form.action.spec()); |
| 305 s.BindBlob(1, encrypted_password.data(), | 308 s.BindBlob(1, encrypted_password.data(), |
| 306 static_cast<int>(encrypted_password.length())); | 309 static_cast<int>(encrypted_password.length())); |
| 307 s.BindInt(2, form.ssl_valid); | 310 s.BindInt(2, form.ssl_valid); |
| 308 s.BindInt(3, form.preferred); | 311 s.BindInt(3, form.preferred); |
| 309 Pickle pickle = SerializeVector(form.other_possible_usernames); | 312 Pickle pickle = SerializeVector(form.other_possible_usernames); |
| 310 s.BindBlob(4, pickle.data(), pickle.size()); | 313 s.BindBlob(4, pickle.data(), pickle.size()); |
| 311 s.BindInt(5, form.times_used); | 314 s.BindInt(5, form.times_used); |
| 312 s.BindInt(6, form.use_additional_authentication); | 315 s.BindString16(6, form.username_element); |
| 313 s.BindString(7, form.origin.spec()); | 316 s.BindString16(7, form.password_element); |
| 314 s.BindString16(8, form.username_element); | 317 s.BindString16(8, form.submit_element); |
| 315 s.BindString16(9, form.username_value); | 318 |
| 316 s.BindString16(10, form.password_element); | 319 s.BindString(9, form.origin.spec()); |
| 317 s.BindString(11, form.signon_realm); | 320 s.BindString16(10, form.username_element); |
| 321 s.BindString16(11, form.username_value); |
| 322 s.BindString16(12, form.password_element); |
| 323 s.BindString16(13, form.submit_element); |
| 324 s.BindString(14, form.signon_realm); |
| 318 | 325 |
| 319 if (!s.Run()) | 326 if (!s.Run()) |
| 320 return false; | 327 return false; |
| 321 | 328 |
| 322 if (items_changed) | 329 if (items_changed) |
| 323 *items_changed = db_.GetLastChangeCount(); | 330 *items_changed = db_.GetLastChangeCount(); |
| 324 | 331 |
| 325 return true; | 332 return true; |
| 326 } | 333 } |
| 327 | 334 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 const Pickle& p) const { | 588 const Pickle& p) const { |
| 582 std::vector<base::string16> ret; | 589 std::vector<base::string16> ret; |
| 583 base::string16 str; | 590 base::string16 str; |
| 584 | 591 |
| 585 PickleIterator iterator(p); | 592 PickleIterator iterator(p); |
| 586 while (iterator.ReadString16(&str)) { | 593 while (iterator.ReadString16(&str)) { |
| 587 ret.push_back(str); | 594 ret.push_back(str); |
| 588 } | 595 } |
| 589 return ret; | 596 return ret; |
| 590 } | 597 } |
| OLD | NEW |