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_change.h" | 5 #include "chrome/browser/password_manager/password_store_change.h" |
6 #include "chrome/browser/password_manager/password_store_default.h" | 6 #include "chrome/browser/password_manager/password_store_default.h" |
7 #include "chrome/browser/pref_service.h" | 7 #include "chrome/browser/pref_service.h" |
8 #include "chrome/browser/webdata/web_data_service.h" | 8 #include "chrome/browser/webdata/web_data_service.h" |
9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) | 107 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) |
108 return; | 108 return; |
109 handles_.insert(web_data_service_->GetAutofillableLogins(this)); | 109 handles_.insert(web_data_service_->GetAutofillableLogins(this)); |
110 handles_.insert(web_data_service_->GetBlacklistLogins(this)); | 110 handles_.insert(web_data_service_->GetBlacklistLogins(this)); |
111 } | 111 } |
112 | 112 |
113 typedef std::vector<const PasswordForm*> PasswordForms; | 113 typedef std::vector<const PasswordForm*> PasswordForms; |
114 | 114 |
115 void PasswordStoreDefault::OnWebDataServiceRequestDone( | 115 void PasswordStoreDefault::OnWebDataServiceRequestDone( |
116 WebDataService::Handle handle, | 116 WebDataService::Handle handle, |
117 const WDTypedResult *result) { | 117 const WDTypedResult* result) { |
118 DCHECK(handles_.end() != handles_.find(handle)); | 118 DCHECK(handles_.end() != handles_.find(handle)); |
119 DCHECK(result); | 119 DCHECK(result); |
120 | 120 |
| 121 if (PASSWORD_RESULT != result->GetType()) { |
| 122 NOTREACHED(); |
| 123 return; |
| 124 } |
| 125 |
121 handles_.erase(handle); | 126 handles_.erase(handle); |
122 if (!result) | 127 if (!result) |
123 return; | 128 return; |
124 | 129 |
125 const PasswordForms& forms = | 130 const PasswordForms& forms = |
126 static_cast<const WDResult<PasswordForms>*>(result)->GetValue(); | 131 static_cast<const WDResult<PasswordForms>*>(result)->GetValue(); |
127 for (PasswordForms::const_iterator it = forms.begin(); | 132 for (PasswordForms::const_iterator it = forms.begin(); |
128 it != forms.end(); ++it) { | 133 it != forms.end(); ++it) { |
129 AddLoginImpl(**it); | 134 AddLoginImpl(**it); |
130 web_data_service_->RemoveLogin(**it); | 135 web_data_service_->RemoveLogin(**it); |
131 delete *it; | 136 delete *it; |
132 } | 137 } |
133 if (handles_.empty()) { | 138 if (handles_.empty()) { |
134 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, | 139 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, |
135 true); | 140 true); |
136 } | 141 } |
137 } | 142 } |
OLD | NEW |