| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/password_store_x.h" | 5 #include "chrome/browser/password_manager/password_store_x.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 if (ok) { | 215 if (ok) { |
| 216 for (size_t i = 0; i < forms.size(); ++i) { | 216 for (size_t i = 0; i < forms.size(); ++i) { |
| 217 // If even one of these calls to RemoveLoginImpl() succeeds, then we | 217 // If even one of these calls to RemoveLoginImpl() succeeds, then we |
| 218 // should prefer the native backend to the now-incomplete login | 218 // should prefer the native backend to the now-incomplete login |
| 219 // database. Thus we want to return a success status even in the case | 219 // database. Thus we want to return a success status even in the case |
| 220 // where some fail. The only real problem with this is that we might | 220 // where some fail. The only real problem with this is that we might |
| 221 // leave passwords in the login database and never come back to clean | 221 // leave passwords in the login database and never come back to clean |
| 222 // them out if any of these calls do fail. | 222 // them out if any of these calls do fail. |
| 223 // TODO(mdm): Really we should just delete the login database file. | |
| 224 PasswordStoreDefault::RemoveLoginImpl(*forms[i]); | 223 PasswordStoreDefault::RemoveLoginImpl(*forms[i]); |
| 225 } | 224 } |
| 225 // Finally, delete the database file itself. We remove the passwords from |
| 226 // it before deleting the file just in case there is some problem deleting |
| 227 // the file (e.g. directory is not writable, but file is), which would |
| 228 // otherwise cause passwords to re-migrate next (or maybe every) time. |
| 229 DeleteAndRecreateDatabaseFile(); |
| 226 } | 230 } |
| 227 } | 231 } |
| 228 ssize_t result = ok ? forms.size() : -1; | 232 ssize_t result = ok ? forms.size() : -1; |
| 229 STLDeleteElements(&forms); | 233 STLDeleteElements(&forms); |
| 230 return result; | 234 return result; |
| 231 } | 235 } |
| OLD | NEW |