OLD | NEW |
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 Loading... |
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 base::Time delete_begin, |
| 115 base::Time delete_end) { |
| 116 CheckMigration(); |
| 117 PasswordStoreChangeList changes; |
| 118 if (use_native_backend() && |
| 119 backend_->RemoveLoginsSyncedBetween(delete_begin, delete_end, &changes)) { |
| 120 allow_fallback_ = false; |
| 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 Loading... |
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 } |
OLD | NEW |