Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Side by Side Diff: chrome/browser/password_manager/password_store_default.cc

Issue 2035003: Fix a possible crash introduced by r46412 by not accessing the result variabl... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
120 handles_.erase(handle);
121 if (!result)
122 return;
120 123
121 if (PASSWORD_RESULT != result->GetType()) { 124 if (PASSWORD_RESULT != result->GetType()) {
122 NOTREACHED(); 125 NOTREACHED();
123 return; 126 return;
124 } 127 }
125 128
126 handles_.erase(handle);
127 if (!result)
128 return;
129
130 const PasswordForms& forms = 129 const PasswordForms& forms =
131 static_cast<const WDResult<PasswordForms>*>(result)->GetValue(); 130 static_cast<const WDResult<PasswordForms>*>(result)->GetValue();
132 for (PasswordForms::const_iterator it = forms.begin(); 131 for (PasswordForms::const_iterator it = forms.begin();
133 it != forms.end(); ++it) { 132 it != forms.end(); ++it) {
134 AddLoginImpl(**it); 133 AddLoginImpl(**it);
135 web_data_service_->RemoveLogin(**it); 134 web_data_service_->RemoveLogin(**it);
136 delete *it; 135 delete *it;
137 } 136 }
138 if (handles_.empty()) { 137 if (handles_.empty()) {
139 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 138 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
140 true); 139 true);
141 } 140 }
142 } 141 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698