| 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" |
| 11 #include "chrome/browser/password_manager/password_store_change.h" | 11 #include "chrome/browser/password_manager/password_store_change.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/webdata/web_data_service.h" | 14 #include "chrome/browser/webdata/web_data_service.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 using webkit_glue::PasswordForm; | 22 using webkit::forms::PasswordForm; |
| 23 | 23 |
| 24 // MigrateHelper handles migration from WebDB to PasswordStore. It runs | 24 // MigrateHelper handles migration from WebDB to PasswordStore. It runs |
| 25 // entirely on the UI thread and is owned by PasswordStoreDefault. | 25 // entirely on the UI thread and is owned by PasswordStoreDefault. |
| 26 class PasswordStoreDefault::MigrateHelper : public WebDataServiceConsumer { | 26 class PasswordStoreDefault::MigrateHelper : public WebDataServiceConsumer { |
| 27 public: | 27 public: |
| 28 MigrateHelper(Profile* profile, | 28 MigrateHelper(Profile* profile, |
| 29 WebDataService* web_data_service, | 29 WebDataService* web_data_service, |
| 30 PasswordStore* password_store) | 30 PasswordStore* password_store) |
| 31 : profile_(profile), | 31 : profile_(profile), |
| 32 web_data_service_(web_data_service), | 32 web_data_service_(web_data_service), |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 content::NotificationService::current()->Notify( | 174 content::NotificationService::current()->Notify( |
| 175 chrome::NOTIFICATION_LOGINS_CHANGED, | 175 chrome::NOTIFICATION_LOGINS_CHANGED, |
| 176 content::Source<PasswordStore>(this), | 176 content::Source<PasswordStore>(this), |
| 177 content::Details<PasswordStoreChangeList>(&changes)); | 177 content::Details<PasswordStoreChangeList>(&changes)); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 STLDeleteElements(&forms); | 180 STLDeleteElements(&forms); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void PasswordStoreDefault::GetLoginsImpl( | 183 void PasswordStoreDefault::GetLoginsImpl( |
| 184 GetLoginsRequest* request, const webkit_glue::PasswordForm& form) { | 184 GetLoginsRequest* request, const webkit::forms::PasswordForm& form) { |
| 185 login_db_->GetLogins(form, &request->value); | 185 login_db_->GetLogins(form, &request->value); |
| 186 ForwardLoginsResult(request); | 186 ForwardLoginsResult(request); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void PasswordStoreDefault::GetAutofillableLoginsImpl( | 189 void PasswordStoreDefault::GetAutofillableLoginsImpl( |
| 190 GetLoginsRequest* request) { | 190 GetLoginsRequest* request) { |
| 191 FillAutofillableLogins(&request->value); | 191 FillAutofillableLogins(&request->value); |
| 192 ForwardLoginsResult(request); | 192 ForwardLoginsResult(request); |
| 193 } | 193 } |
| 194 | 194 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 211 } | 211 } |
| 212 | 212 |
| 213 void PasswordStoreDefault::MigrateIfNecessary() { | 213 void PasswordStoreDefault::MigrateIfNecessary() { |
| 214 PrefService* prefs = profile_->GetPrefs(); | 214 PrefService* prefs = profile_->GetPrefs(); |
| 215 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) | 215 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) |
| 216 return; | 216 return; |
| 217 DCHECK(!migrate_helper_.get()); | 217 DCHECK(!migrate_helper_.get()); |
| 218 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); | 218 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); |
| 219 migrate_helper_->Init(); | 219 migrate_helper_->Init(); |
| 220 } | 220 } |
| OLD | NEW |