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

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

Issue 335893002: Support to remove passwords by date_synced timestamp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync integration tests Created 6 years, 6 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) 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/password_store_x.h" 5 #include "chrome/browser/password_manager/password_store_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 LogStatsForBulkDeletion(changes.size()); 103 LogStatsForBulkDeletion(changes.size());
104 allow_fallback_ = false; 104 allow_fallback_ = false;
105 } else if (allow_default_store()) { 105 } else if (allow_default_store()) {
106 changes = PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl(delete_begin, 106 changes = PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl(delete_begin,
107 delete_end); 107 delete_end);
108 } 108 }
109 STLDeleteElements(&forms); 109 STLDeleteElements(&forms);
110 return changes; 110 return changes;
111 } 111 }
112 112
113 PasswordStoreChangeList PasswordStoreX::RemoveLoginsSyncedBetweenImpl(
114 const base::Time& delete_begin,
115 const base::Time& delete_end) {
116 CheckMigration();
117 PasswordStoreChangeList changes;
118 if (use_native_backend() &&
119 backend_->RemoveLoginsSyncedBetween(delete_begin, delete_end, &changes)) {
Garrett Casto 2014/06/17 17:57:36 Seems like we should standardize how we report cha
vasilii 2014/06/18 10:00:57 You are right. The plan is to remove GetLoginsCrea
120 allow_fallback_ = false;
Garrett Casto 2014/06/17 17:57:36 It also seems like it would be nice if we had UMA
vasilii 2014/06/18 10:00:57 http://crbug.com/386079. The new method will be ca
121 } else if (allow_default_store()) {
122 changes = PasswordStoreDefault::RemoveLoginsSyncedBetweenImpl(delete_begin,
123 delete_end);
124 }
125 return changes;
126 }
127
113 namespace { 128 namespace {
114 struct LoginLessThan { 129 struct LoginLessThan {
115 bool operator()(const PasswordForm* a, const PasswordForm* b) { 130 bool operator()(const PasswordForm* a, const PasswordForm* b) {
116 return a->origin < b->origin; 131 return a->origin < b->origin;
117 } 132 }
118 }; 133 };
119 } // anonymous namespace 134 } // anonymous namespace
120 135
121 void PasswordStoreX::SortLoginsByOrigin(NativeBackend::PasswordFormList* list) { 136 void PasswordStoreX::SortLoginsByOrigin(NativeBackend::PasswordFormList* list) {
122 // In login_database.cc, the query has ORDER BY origin_url. Simulate that. 137 // In login_database.cc, the query has ORDER BY origin_url. Simulate that.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // it before deleting the file just in case there is some problem deleting 282 // it before deleting the file just in case there is some problem deleting
268 // the file (e.g. directory is not writable, but file is), which would 283 // the file (e.g. directory is not writable, but file is), which would
269 // otherwise cause passwords to re-migrate next (or maybe every) time. 284 // otherwise cause passwords to re-migrate next (or maybe every) time.
270 DeleteAndRecreateDatabaseFile(); 285 DeleteAndRecreateDatabaseFile();
271 } 286 }
272 } 287 }
273 ssize_t result = ok ? forms.size() : -1; 288 ssize_t result = ok ? forms.size() : -1;
274 STLDeleteElements(&forms); 289 STLDeleteElements(&forms);
275 return result; 290 return result;
276 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698