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

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

Issue 14811010: Add metadata to content::PasswordForm to keep track of the password usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 7 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
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_form_manager.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login_database.h" 5 #include "chrome/browser/password_manager/login_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/pickle.h" 14 #include "base/pickle.h"
15 #include "base/stringprintf.h"
15 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
16 #include "base/time.h" 17 #include "base/time.h"
17 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
18 #include "sql/statement.h" 19 #include "sql/statement.h"
19 #include "sql/transaction.h" 20 #include "sql/transaction.h"
20 21
21 using content::PasswordForm; 22 using content::PasswordForm;
22 23
23 static const int kCurrentVersionNumber = 2; 24 static const int kCurrentVersionNumber = 3;
24 static const int kCompatibleVersionNumber = 1; 25 static const int kCompatibleVersionNumber = 1;
25 26
26 namespace { 27 namespace {
27 28
28 // Convenience enum for interacting with SQL queries that use all the columns. 29 // Convenience enum for interacting with SQL queries that use all the columns.
29 enum LoginTableColumns { 30 enum LoginTableColumns {
30 COLUMN_ORIGIN_URL = 0, 31 COLUMN_ORIGIN_URL = 0,
31 COLUMN_ACTION_URL, 32 COLUMN_ACTION_URL,
32 COLUMN_USERNAME_ELEMENT, 33 COLUMN_USERNAME_ELEMENT,
33 COLUMN_USERNAME_VALUE, 34 COLUMN_USERNAME_VALUE,
34 COLUMN_PASSWORD_ELEMENT, 35 COLUMN_PASSWORD_ELEMENT,
35 COLUMN_PASSWORD_VALUE, 36 COLUMN_PASSWORD_VALUE,
36 COLUMN_SUBMIT_ELEMENT, 37 COLUMN_SUBMIT_ELEMENT,
37 COLUMN_SIGNON_REALM, 38 COLUMN_SIGNON_REALM,
38 COLUMN_SSL_VALID, 39 COLUMN_SSL_VALID,
39 COLUMN_PREFERRED, 40 COLUMN_PREFERRED,
40 COLUMN_DATE_CREATED, 41 COLUMN_DATE_CREATED,
41 COLUMN_BLACKLISTED_BY_USER, 42 COLUMN_BLACKLISTED_BY_USER,
42 COLUMN_SCHEME, 43 COLUMN_SCHEME,
43 COLUMN_PASSWORD_TYPE, 44 COLUMN_PASSWORD_TYPE,
44 COLUMN_POSSIBLE_USERNAMES 45 COLUMN_POSSIBLE_USERNAMES,
46 COLUMN_TIMES_USED
45 }; 47 };
46 48
47 } // namespace 49 } // namespace
48 50
49 LoginDatabase::LoginDatabase() { 51 LoginDatabase::LoginDatabase() {
50 } 52 }
51 53
52 LoginDatabase::~LoginDatabase() { 54 LoginDatabase::~LoginDatabase() {
53 } 55 }
54 56
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 98 }
97 99
98 if (!transaction.Commit()) { 100 if (!transaction.Commit()) {
99 db_.Close(); 101 db_.Close();
100 return false; 102 return false;
101 } 103 }
102 return true; 104 return true;
103 } 105 }
104 106
105 bool LoginDatabase::MigrateOldVersionsAsNeeded() { 107 bool LoginDatabase::MigrateOldVersionsAsNeeded() {
106 switch (meta_table_.GetVersionNumber()) { 108 int current_version = meta_table_.GetVersionNumber();
107 case kCompatibleVersionNumber: 109 while (current_version != kCurrentVersionNumber) {
108 if (!db_.Execute("ALTER TABLE logins " 110 switch (current_version) {
Mike Mammarella 2013/05/15 00:08:14 This seems like it might be a good place to use ex
109 "ADD COLUMN password_type INTEGER") || 111 case 1:
110 !db_.Execute("ALTER TABLE logins " 112 if (!db_.Execute("ALTER TABLE logins "
111 "ADD COLUMN possible_usernames BLOB")) { 113 "ADD COLUMN password_type INTEGER") ||
114 !db_.Execute("ALTER TABLE logins "
115 "ADD COLUMN possible_usernames BLOB")) {
116 return false;
117 } else {
118 current_version = 2;
119 }
120 break;
121 case 2:
122 if (!db_.Execute("ALTER TABLE logins "
123 "ADD COLUMN times_used INTEGER")) {
124 return false;
125 } else {
126 current_version = 3;
127 }
128 default:
129 NOTREACHED();
112 return false; 130 return false;
113 } else { 131 }
114 meta_table_.SetVersionNumber(kCurrentVersionNumber);
115 }
116 } 132 }
133 meta_table_.SetVersionNumber(kCurrentVersionNumber);
117 return true; 134 return true;
118 } 135 }
119 136
120 bool LoginDatabase::InitLoginsTable() { 137 bool LoginDatabase::InitLoginsTable() {
121 if (!db_.DoesTableExist("logins")) { 138 if (!db_.DoesTableExist("logins")) {
122 if (!db_.Execute("CREATE TABLE logins (" 139 if (!db_.Execute("CREATE TABLE logins ("
123 "origin_url VARCHAR NOT NULL, " 140 "origin_url VARCHAR NOT NULL, "
124 "action_url VARCHAR, " 141 "action_url VARCHAR, "
125 "username_element VARCHAR, " 142 "username_element VARCHAR, "
126 "username_value VARCHAR, " 143 "username_value VARCHAR, "
127 "password_element VARCHAR, " 144 "password_element VARCHAR, "
128 "password_value BLOB, " 145 "password_value BLOB, "
129 "submit_element VARCHAR, " 146 "submit_element VARCHAR, "
130 "signon_realm VARCHAR NOT NULL," 147 "signon_realm VARCHAR NOT NULL,"
131 "ssl_valid INTEGER NOT NULL," 148 "ssl_valid INTEGER NOT NULL,"
132 "preferred INTEGER NOT NULL," 149 "preferred INTEGER NOT NULL,"
133 "date_created INTEGER NOT NULL," 150 "date_created INTEGER NOT NULL,"
134 "blacklisted_by_user INTEGER NOT NULL," 151 "blacklisted_by_user INTEGER NOT NULL,"
135 "scheme INTEGER NOT NULL," 152 "scheme INTEGER NOT NULL,"
136 "password_type INTEGER," 153 "password_type INTEGER,"
137 "possible_usernames BLOB," 154 "possible_usernames BLOB,"
155 "times_used INTEGER,"
138 "UNIQUE " 156 "UNIQUE "
139 "(origin_url, username_element, " 157 "(origin_url, username_element, "
140 "username_value, password_element, " 158 "username_value, password_element, "
141 "submit_element, signon_realm))")) { 159 "submit_element, signon_realm))")) {
142 NOTREACHED(); 160 NOTREACHED();
143 return false; 161 return false;
144 } 162 }
145 if (!db_.Execute("CREATE INDEX logins_signon ON " 163 if (!db_.Execute("CREATE INDEX logins_signon ON "
146 "logins (signon_realm)")) { 164 "logins (signon_realm)")) {
147 NOTREACHED(); 165 NOTREACHED();
(...skipping 13 matching lines...) Expand all
161 179
162 int total_accounts = 0; 180 int total_accounts = 0;
163 while (s.Step()) { 181 while (s.Step()) {
164 int accounts_per_site = s.ColumnInt(1); 182 int accounts_per_site = s.ColumnInt(1);
165 total_accounts += accounts_per_site; 183 total_accounts += accounts_per_site;
166 UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.AccountsPerSite", 184 UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.AccountsPerSite",
167 accounts_per_site, 0, 32, 6); 185 accounts_per_site, 0, 32, 6);
168 } 186 }
169 UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.TotalAccounts", 187 UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.TotalAccounts",
170 total_accounts, 0, 32, 6); 188 total_accounts, 0, 32, 6);
189
190 sql::Statement usage_statement(db_.GetCachedStatement(
191 SQL_FROM_HERE,
192 "SELECT password_type, times_used FROM logins"));
193
194 if (!usage_statement.is_valid())
195 return;
196
197 while (usage_statement.Step()) {
198 PasswordForm::Type type = static_cast<PasswordForm::Type>(
199 usage_statement.ColumnInt(0));
200
201 std::string password_type = "";
202 if (type == PasswordForm::TYPE_GENERATED)
203 password_type = "Generated";
204
205 UMA_HISTOGRAM_CUSTOM_COUNTS(
206 base::StringPrintf("PasswordManager.Times%sPasswordUsed",
207 password_type.c_str()),
208 usage_statement.ColumnInt(1), 0, 100, 10);
209 }
171 } 210 }
172 211
173 bool LoginDatabase::AddLogin(const PasswordForm& form) { 212 bool LoginDatabase::AddLogin(const PasswordForm& form) {
174 std::string encrypted_password; 213 std::string encrypted_password;
175 if (!EncryptedString(form.password_value, &encrypted_password)) 214 if (!EncryptedString(form.password_value, &encrypted_password))
176 return false; 215 return false;
177 216
178 // You *must* change LoginTableColumns if this query changes. 217 // You *must* change LoginTableColumns if this query changes.
179 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 218 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
180 "INSERT OR REPLACE INTO logins " 219 "INSERT OR REPLACE INTO logins "
181 "(origin_url, action_url, username_element, username_value, " 220 "(origin_url, action_url, username_element, username_value, "
182 " password_element, password_value, submit_element, " 221 " password_element, password_value, submit_element, "
183 " signon_realm, ssl_valid, preferred, date_created, " 222 " signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, "
184 " blacklisted_by_user, scheme, password_type, possible_usernames) " 223 " scheme, password_type, possible_usernames, times_used) "
185 "VALUES " 224 "VALUES "
186 "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")); 225 "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
187 s.BindString(COLUMN_ORIGIN_URL, form.origin.spec()); 226 s.BindString(COLUMN_ORIGIN_URL, form.origin.spec());
188 s.BindString(COLUMN_ACTION_URL, form.action.spec()); 227 s.BindString(COLUMN_ACTION_URL, form.action.spec());
189 s.BindString16(COLUMN_USERNAME_ELEMENT, form.username_element); 228 s.BindString16(COLUMN_USERNAME_ELEMENT, form.username_element);
190 s.BindString16(COLUMN_USERNAME_VALUE, form.username_value); 229 s.BindString16(COLUMN_USERNAME_VALUE, form.username_value);
191 s.BindString16(COLUMN_PASSWORD_ELEMENT, form.password_element); 230 s.BindString16(COLUMN_PASSWORD_ELEMENT, form.password_element);
192 s.BindBlob(COLUMN_PASSWORD_VALUE, encrypted_password.data(), 231 s.BindBlob(COLUMN_PASSWORD_VALUE, encrypted_password.data(),
193 static_cast<int>(encrypted_password.length())); 232 static_cast<int>(encrypted_password.length()));
194 s.BindString16(COLUMN_SUBMIT_ELEMENT, form.submit_element); 233 s.BindString16(COLUMN_SUBMIT_ELEMENT, form.submit_element);
195 s.BindString(COLUMN_SIGNON_REALM, form.signon_realm); 234 s.BindString(COLUMN_SIGNON_REALM, form.signon_realm);
196 s.BindInt(COLUMN_SSL_VALID, form.ssl_valid); 235 s.BindInt(COLUMN_SSL_VALID, form.ssl_valid);
197 s.BindInt(COLUMN_PREFERRED, form.preferred); 236 s.BindInt(COLUMN_PREFERRED, form.preferred);
198 s.BindInt64(COLUMN_DATE_CREATED, form.date_created.ToTimeT()); 237 s.BindInt64(COLUMN_DATE_CREATED, form.date_created.ToTimeT());
199 s.BindInt(COLUMN_BLACKLISTED_BY_USER, form.blacklisted_by_user); 238 s.BindInt(COLUMN_BLACKLISTED_BY_USER, form.blacklisted_by_user);
200 s.BindInt(COLUMN_SCHEME, form.scheme); 239 s.BindInt(COLUMN_SCHEME, form.scheme);
201 s.BindInt(COLUMN_PASSWORD_TYPE, form.type); 240 s.BindInt(COLUMN_PASSWORD_TYPE, form.type);
202 Pickle pickle = SerializeVector(form.possible_usernames); 241 Pickle pickle = SerializeVector(form.possible_usernames);
203 s.BindBlob(COLUMN_POSSIBLE_USERNAMES, pickle.data(), pickle.size()); 242 s.BindBlob(COLUMN_POSSIBLE_USERNAMES, pickle.data(), pickle.size());
243 s.BindInt(COLUMN_TIMES_USED, form.times_used);
204 244
205 return s.Run(); 245 return s.Run();
206 } 246 }
207 247
208 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) { 248 bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) {
209 std::string encrypted_password; 249 std::string encrypted_password;
210 if (!EncryptedString(form.password_value, &encrypted_password)) 250 if (!EncryptedString(form.password_value, &encrypted_password))
211 return false; 251 return false;
212 252
213 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 253 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
214 "UPDATE logins SET " 254 "UPDATE logins SET "
215 "action_url = ?, " 255 "action_url = ?, "
216 "password_value = ?, " 256 "password_value = ?, "
217 "ssl_valid = ?, " 257 "ssl_valid = ?, "
218 "preferred = ?, " 258 "preferred = ?, "
219 "possible_usernames = ? " 259 "possible_usernames = ?, "
260 "times_used = ? "
220 "WHERE origin_url = ? AND " 261 "WHERE origin_url = ? AND "
221 "username_element = ? AND " 262 "username_element = ? AND "
222 "username_value = ? AND " 263 "username_value = ? AND "
223 "password_element = ? AND " 264 "password_element = ? AND "
224 "signon_realm = ?")); 265 "signon_realm = ?"));
225 s.BindString(0, form.action.spec()); 266 s.BindString(0, form.action.spec());
226 s.BindBlob(1, encrypted_password.data(), 267 s.BindBlob(1, encrypted_password.data(),
227 static_cast<int>(encrypted_password.length())); 268 static_cast<int>(encrypted_password.length()));
228 s.BindInt(2, form.ssl_valid); 269 s.BindInt(2, form.ssl_valid);
229 s.BindInt(3, form.preferred); 270 s.BindInt(3, form.preferred);
230 Pickle pickle = SerializeVector(form.possible_usernames); 271 Pickle pickle = SerializeVector(form.possible_usernames);
231 s.BindBlob(4, pickle.data(), pickle.size()); 272 s.BindBlob(4, pickle.data(), pickle.size());
232 s.BindString(5, form.origin.spec()); 273 s.BindInt(5, form.times_used);
233 s.BindString16(6, form.username_element); 274 s.BindString(6, form.origin.spec());
234 s.BindString16(7, form.username_value); 275 s.BindString16(7, form.username_element);
235 s.BindString16(8, form.password_element); 276 s.BindString16(8, form.username_value);
236 s.BindString(9, form.signon_realm); 277 s.BindString16(9, form.password_element);
278 s.BindString(10, form.signon_realm);
237 279
238 if (!s.Run()) 280 if (!s.Run())
239 return false; 281 return false;
240 282
241 if (items_changed) 283 if (items_changed)
242 *items_changed = db_.GetLastChangeCount(); 284 *items_changed = db_.GetLastChangeCount();
243 285
244 return true; 286 return true;
245 } 287 }
246 288
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 int scheme_int = s.ColumnInt(COLUMN_SCHEME); 345 int scheme_int = s.ColumnInt(COLUMN_SCHEME);
304 DCHECK((scheme_int >= 0) && (scheme_int <= PasswordForm::SCHEME_OTHER)); 346 DCHECK((scheme_int >= 0) && (scheme_int <= PasswordForm::SCHEME_OTHER));
305 form->scheme = static_cast<PasswordForm::Scheme>(scheme_int); 347 form->scheme = static_cast<PasswordForm::Scheme>(scheme_int);
306 int type_int = s.ColumnInt(COLUMN_PASSWORD_TYPE); 348 int type_int = s.ColumnInt(COLUMN_PASSWORD_TYPE);
307 DCHECK(type_int >= 0 && type_int <= PasswordForm::TYPE_GENERATED); 349 DCHECK(type_int >= 0 && type_int <= PasswordForm::TYPE_GENERATED);
308 form->type = static_cast<PasswordForm::Type>(type_int); 350 form->type = static_cast<PasswordForm::Type>(type_int);
309 Pickle pickle( 351 Pickle pickle(
310 static_cast<const char*>(s.ColumnBlob(COLUMN_POSSIBLE_USERNAMES)), 352 static_cast<const char*>(s.ColumnBlob(COLUMN_POSSIBLE_USERNAMES)),
311 s.ColumnByteLength(COLUMN_POSSIBLE_USERNAMES)); 353 s.ColumnByteLength(COLUMN_POSSIBLE_USERNAMES));
312 form->possible_usernames = DeserializeVector(pickle); 354 form->possible_usernames = DeserializeVector(pickle);
355 form->times_used = s.ColumnInt(COLUMN_TIMES_USED);
313 return true; 356 return true;
314 } 357 }
315 358
316 bool LoginDatabase::GetLogins(const PasswordForm& form, 359 bool LoginDatabase::GetLogins(const PasswordForm& form,
317 std::vector<PasswordForm*>* forms) const { 360 std::vector<PasswordForm*>* forms) const {
318 DCHECK(forms); 361 DCHECK(forms);
319 // You *must* change LoginTableColumns if this query changes. 362 // You *must* change LoginTableColumns if this query changes.
320 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 363 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
321 "SELECT origin_url, action_url, " 364 "SELECT origin_url, action_url, "
322 "username_element, username_value, " 365 "username_element, username_value, "
323 "password_element, password_value, " 366 "password_element, password_value, submit_element, "
324 "submit_element, signon_realm, ssl_valid, preferred, date_created, " 367 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, "
325 "blacklisted_by_user, scheme, password_type, possible_usernames " 368 "scheme, password_type, possible_usernames, times_used "
326 "FROM logins WHERE signon_realm == ? ")); 369 "FROM logins WHERE signon_realm == ? "));
327 s.BindString(0, form.signon_realm); 370 s.BindString(0, form.signon_realm);
328 371
329 while (s.Step()) { 372 while (s.Step()) {
330 scoped_ptr<PasswordForm> new_form(new PasswordForm()); 373 scoped_ptr<PasswordForm> new_form(new PasswordForm());
331 if (!InitPasswordFormFromStatement(new_form.get(), s)) 374 if (!InitPasswordFormFromStatement(new_form.get(), s))
332 return false; 375 return false;
333 forms->push_back(new_form.release()); 376 forms->push_back(new_form.release());
334 } 377 }
335 return s.Succeeded(); 378 return s.Succeeded();
336 } 379 }
337 380
338 bool LoginDatabase::GetLoginsCreatedBetween( 381 bool LoginDatabase::GetLoginsCreatedBetween(
339 const base::Time begin, 382 const base::Time begin,
340 const base::Time end, 383 const base::Time end,
341 std::vector<content::PasswordForm*>* forms) const { 384 std::vector<content::PasswordForm*>* forms) const {
342 DCHECK(forms); 385 DCHECK(forms);
343 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 386 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
344 "SELECT origin_url, action_url, " 387 "SELECT origin_url, action_url, "
345 "username_element, username_value, " 388 "username_element, username_value, "
346 "password_element, password_value, " 389 "password_element, password_value, submit_element, "
347 "submit_element, signon_realm, ssl_valid, preferred, date_created, " 390 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, "
348 "blacklisted_by_user, scheme, password_type, possible_usernames " 391 "scheme, password_type, possible_usernames, times_used "
349 "FROM logins WHERE date_created >= ? AND date_created < ?" 392 "FROM logins WHERE date_created >= ? AND date_created < ?"
350 "ORDER BY origin_url")); 393 "ORDER BY origin_url"));
351 s.BindInt64(0, begin.ToTimeT()); 394 s.BindInt64(0, begin.ToTimeT());
352 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max() 395 s.BindInt64(1, end.is_null() ? std::numeric_limits<int64>::max()
353 : end.ToTimeT()); 396 : end.ToTimeT());
354 397
355 while (s.Step()) { 398 while (s.Step()) {
356 scoped_ptr<PasswordForm> new_form(new PasswordForm()); 399 scoped_ptr<PasswordForm> new_form(new PasswordForm());
357 if (!InitPasswordFormFromStatement(new_form.get(), s)) 400 if (!InitPasswordFormFromStatement(new_form.get(), s))
358 return false; 401 return false;
(...skipping 12 matching lines...) Expand all
371 return GetAllLoginsWithBlacklistSetting(true, forms); 414 return GetAllLoginsWithBlacklistSetting(true, forms);
372 } 415 }
373 416
374 bool LoginDatabase::GetAllLoginsWithBlacklistSetting( 417 bool LoginDatabase::GetAllLoginsWithBlacklistSetting(
375 bool blacklisted, std::vector<PasswordForm*>* forms) const { 418 bool blacklisted, std::vector<PasswordForm*>* forms) const {
376 DCHECK(forms); 419 DCHECK(forms);
377 // You *must* change LoginTableColumns if this query changes. 420 // You *must* change LoginTableColumns if this query changes.
378 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 421 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
379 "SELECT origin_url, action_url, " 422 "SELECT origin_url, action_url, "
380 "username_element, username_value, " 423 "username_element, username_value, "
381 "password_element, password_value, " 424 "password_element, password_value, submit_element, "
382 "submit_element, signon_realm, ssl_valid, preferred, date_created, " 425 "signon_realm, ssl_valid, preferred, date_created, blacklisted_by_user, "
383 "blacklisted_by_user, scheme, password_type, possible_usernames " 426 "scheme, password_type, possible_usernames, times_used "
384 "FROM logins WHERE blacklisted_by_user == ? " 427 "FROM logins WHERE blacklisted_by_user == ? "
385 "ORDER BY origin_url")); 428 "ORDER BY origin_url"));
386 s.BindInt(0, blacklisted ? 1 : 0); 429 s.BindInt(0, blacklisted ? 1 : 0);
387 430
388 while (s.Step()) { 431 while (s.Step()) {
389 scoped_ptr<PasswordForm> new_form(new PasswordForm()); 432 scoped_ptr<PasswordForm> new_form(new PasswordForm());
390 if (!InitPasswordFormFromStatement(new_form.get(), s)) 433 if (!InitPasswordFormFromStatement(new_form.get(), s))
391 return false; 434 return false;
392 forms->push_back(new_form.release()); 435 forms->push_back(new_form.release());
393 } 436 }
(...skipping 19 matching lines...) Expand all
413 std::vector<string16> LoginDatabase::DeserializeVector(const Pickle& p) const { 456 std::vector<string16> LoginDatabase::DeserializeVector(const Pickle& p) const {
414 std::vector<string16> ret; 457 std::vector<string16> ret;
415 string16 str; 458 string16 str;
416 459
417 PickleIterator iterator(p); 460 PickleIterator iterator(p);
418 while (iterator.ReadString16(&str)) { 461 while (iterator.ReadString16(&str)) {
419 ret.push_back(str); 462 ret.push_back(str);
420 } 463 }
421 return ret; 464 return ret;
422 } 465 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_form_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698