| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (!forms->empty()) | 179 if (!forms->empty()) |
| 180 allow_fallback_ = false; | 180 allow_fallback_ = false; |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 if (allow_default_store()) | 183 if (allow_default_store()) |
| 184 return PasswordStoreDefault::FillBlacklistLogins(forms); | 184 return PasswordStoreDefault::FillBlacklistLogins(forms); |
| 185 return false; | 185 return false; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void PasswordStoreX::CheckMigration() { | 188 void PasswordStoreX::CheckMigration() { |
| 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 189 DCHECK_CURRENTLY_ON(BrowserThread::DB); |
| 190 if (migration_checked_ || !backend_.get()) | 190 if (migration_checked_ || !backend_.get()) |
| 191 return; | 191 return; |
| 192 migration_checked_ = true; | 192 migration_checked_ = true; |
| 193 ssize_t migrated = MigrateLogins(); | 193 ssize_t migrated = MigrateLogins(); |
| 194 if (migrated > 0) { | 194 if (migrated > 0) { |
| 195 VLOG(1) << "Migrated " << migrated << " passwords to native store."; | 195 VLOG(1) << "Migrated " << migrated << " passwords to native store."; |
| 196 } else if (migrated == 0) { | 196 } else if (migrated == 0) { |
| 197 // As long as we are able to migrate some passwords, we know the native | 197 // As long as we are able to migrate some passwords, we know the native |
| 198 // store is working. But if there is nothing to migrate, the "migration" | 198 // store is working. But if there is nothing to migrate, the "migration" |
| 199 // can succeed even when the native store would fail. In this case we | 199 // can succeed even when the native store would fail. In this case we |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Finally, delete the database file itself. We remove the passwords from | 252 // Finally, delete the database file itself. We remove the passwords from |
| 253 // it before deleting the file just in case there is some problem deleting | 253 // it before deleting the file just in case there is some problem deleting |
| 254 // the file (e.g. directory is not writable, but file is), which would | 254 // the file (e.g. directory is not writable, but file is), which would |
| 255 // otherwise cause passwords to re-migrate next (or maybe every) time. | 255 // otherwise cause passwords to re-migrate next (or maybe every) time. |
| 256 DeleteAndRecreateDatabaseFile(); | 256 DeleteAndRecreateDatabaseFile(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 ssize_t result = ok ? forms.size() : -1; | 259 ssize_t result = ok ? forms.size() : -1; |
| 260 return result; | 260 return result; |
| 261 } | 261 } |
| OLD | NEW |