| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_default.h" | 5 #include "chrome/browser/password_manager/password_store_default.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 DCHECK(web_data_service); | 111 DCHECK(web_data_service); |
| 112 MigrateIfNecessary(); | 112 MigrateIfNecessary(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 PasswordStoreDefault::~PasswordStoreDefault() { | 115 PasswordStoreDefault::~PasswordStoreDefault() { |
| 116 // MigrateHelper should always be NULL as Shutdown should be invoked before | 116 // MigrateHelper should always be NULL as Shutdown should be invoked before |
| 117 // the destructor. | 117 // the destructor. |
| 118 DCHECK(!migrate_helper_.get()); | 118 DCHECK(!migrate_helper_.get()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void PasswordStoreDefault::Shutdown() { | 121 void PasswordStoreDefault::ShutdownOnUIThread() { |
| 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 122 migrate_helper_.reset(); | 123 migrate_helper_.reset(); |
| 124 profile_ = NULL; |
| 123 } | 125 } |
| 124 | 126 |
| 125 void PasswordStoreDefault::ReportMetricsImpl() { | 127 void PasswordStoreDefault::ReportMetricsImpl() { |
| 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 127 login_db_->ReportMetrics(); | 129 login_db_->ReportMetrics(); |
| 128 } | 130 } |
| 129 | 131 |
| 130 void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) { | 132 void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) { |
| 131 if (login_db_->AddLogin(form)) { | 133 if (login_db_->AddLogin(form)) { |
| 132 PasswordStoreChangeList changes; | 134 PasswordStoreChangeList changes; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 213 } |
| 212 | 214 |
| 213 void PasswordStoreDefault::MigrateIfNecessary() { | 215 void PasswordStoreDefault::MigrateIfNecessary() { |
| 214 PrefService* prefs = profile_->GetPrefs(); | 216 PrefService* prefs = profile_->GetPrefs(); |
| 215 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) | 217 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) |
| 216 return; | 218 return; |
| 217 DCHECK(!migrate_helper_.get()); | 219 DCHECK(!migrate_helper_.get()); |
| 218 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); | 220 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); |
| 219 migrate_helper_->Init(); | 221 migrate_helper_->Init(); |
| 220 } | 222 } |
| OLD | NEW |