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

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

Issue 6646051: Fix DCHECK, memory leak, and refactor PasswordStore to use CancelableRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use non-zero tests until http://crbug.com/77650 is addressed. Created 9 years, 8 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
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 NotificationType::LOGINS_CHANGED, 86 NotificationType::LOGINS_CHANGED,
87 Source<PasswordStore>(this), 87 Source<PasswordStore>(this),
88 Details<PasswordStoreChangeList>(&changes)); 88 Details<PasswordStoreChangeList>(&changes));
89 } 89 }
90 } 90 }
91 STLDeleteElements(&forms); 91 STLDeleteElements(&forms);
92 } 92 }
93 93
94 void PasswordStoreDefault::GetLoginsImpl( 94 void PasswordStoreDefault::GetLoginsImpl(
95 GetLoginsRequest* request, const webkit_glue::PasswordForm& form) { 95 GetLoginsRequest* request, const webkit_glue::PasswordForm& form) {
96 std::vector<PasswordForm*> forms; 96 login_db_->GetLogins(form, &request->value);
97 login_db_->GetLogins(form, &forms); 97 ForwardLoginsResult(request);
98 NotifyConsumer(request, forms);
99 } 98 }
100 99
101 void PasswordStoreDefault::GetAutofillableLoginsImpl( 100 void PasswordStoreDefault::GetAutofillableLoginsImpl(
102 GetLoginsRequest* request) { 101 GetLoginsRequest* request) {
103 std::vector<PasswordForm*> forms; 102 FillAutofillableLogins(&request->value);
104 FillAutofillableLogins(&forms); 103 ForwardLoginsResult(request);
105 NotifyConsumer(request, forms);
106 } 104 }
107 105
108 void PasswordStoreDefault::GetBlacklistLoginsImpl( 106 void PasswordStoreDefault::GetBlacklistLoginsImpl(
109 GetLoginsRequest* request) { 107 GetLoginsRequest* request) {
110 std::vector<PasswordForm*> forms; 108 FillBlacklistLogins(&request->value);
111 FillBlacklistLogins(&forms); 109 ForwardLoginsResult(request);
112 NotifyConsumer(request, forms);
113 } 110 }
114 111
115 bool PasswordStoreDefault::FillAutofillableLogins( 112 bool PasswordStoreDefault::FillAutofillableLogins(
116 std::vector<PasswordForm*>* forms) { 113 std::vector<PasswordForm*>* forms) {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
118 return login_db_->GetAutofillableLogins(forms); 115 return login_db_->GetAutofillableLogins(forms);
119 } 116 }
120 117
121 bool PasswordStoreDefault::FillBlacklistLogins( 118 bool PasswordStoreDefault::FillBlacklistLogins(
122 std::vector<PasswordForm*>* forms) { 119 std::vector<PasswordForm*>* forms) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 it != forms.end(); ++it) { 151 it != forms.end(); ++it) {
155 AddLogin(**it); 152 AddLogin(**it);
156 web_data_service_->RemoveLogin(**it); 153 web_data_service_->RemoveLogin(**it);
157 delete *it; 154 delete *it;
158 } 155 }
159 if (handles_.empty()) { 156 if (handles_.empty()) {
160 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 157 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
161 true); 158 true);
162 } 159 }
163 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698