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 <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 backend_->RemoveLoginsSyncedBetween(delete_begin, delete_end, &changes)) { | 154 backend_->RemoveLoginsSyncedBetween(delete_begin, delete_end, &changes)) { |
155 LogStatsForBulkDeletionDuringRollback(changes.size()); | 155 LogStatsForBulkDeletionDuringRollback(changes.size()); |
156 allow_fallback_ = false; | 156 allow_fallback_ = false; |
157 } else if (allow_default_store()) { | 157 } else if (allow_default_store()) { |
158 changes = PasswordStoreDefault::RemoveLoginsSyncedBetweenImpl(delete_begin, | 158 changes = PasswordStoreDefault::RemoveLoginsSyncedBetweenImpl(delete_begin, |
159 delete_end); | 159 delete_end); |
160 } | 160 } |
161 return changes; | 161 return changes; |
162 } | 162 } |
163 | 163 |
164 PasswordStoreChangeList PasswordStoreX::DisableAutoSignInForAllLoginsImpl() { | 164 PasswordStoreChangeList PasswordStoreX::DisableAutoSignInForOriginsImpl( |
| 165 const base::Callback<bool(const GURL&)>& origin_filter) { |
165 CheckMigration(); | 166 CheckMigration(); |
166 PasswordStoreChangeList changes; | 167 PasswordStoreChangeList changes; |
167 if (use_native_backend() && | 168 if (use_native_backend() && |
168 backend_->DisableAutoSignInForAllLogins(&changes)) { | 169 backend_->DisableAutoSignInForOrigins(origin_filter, &changes)) { |
169 allow_fallback_ = false; | 170 allow_fallback_ = false; |
170 } else if (allow_default_store()) { | 171 } else if (allow_default_store()) { |
171 changes = PasswordStoreDefault::DisableAutoSignInForAllLoginsImpl(); | 172 changes = |
| 173 PasswordStoreDefault::DisableAutoSignInForOriginsImpl(origin_filter); |
172 } | 174 } |
173 return changes; | 175 return changes; |
174 } | 176 } |
175 | 177 |
176 namespace { | 178 namespace { |
177 | 179 |
178 struct LoginLessThan { | 180 struct LoginLessThan { |
179 bool operator()(const PasswordForm* a, const PasswordForm* b) { | 181 bool operator()(const PasswordForm* a, const PasswordForm* b) { |
180 return a->origin < b->origin; | 182 return a->origin < b->origin; |
181 } | 183 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // Finally, delete the database file itself. We remove the passwords from | 305 // Finally, delete the database file itself. We remove the passwords from |
304 // it before deleting the file just in case there is some problem deleting | 306 // it before deleting the file just in case there is some problem deleting |
305 // the file (e.g. directory is not writable, but file is), which would | 307 // the file (e.g. directory is not writable, but file is), which would |
306 // otherwise cause passwords to re-migrate next (or maybe every) time. | 308 // otherwise cause passwords to re-migrate next (or maybe every) time. |
307 DeleteAndRecreateDatabaseFile(); | 309 DeleteAndRecreateDatabaseFile(); |
308 } | 310 } |
309 } | 311 } |
310 ssize_t result = ok ? forms.size() : -1; | 312 ssize_t result = ok ? forms.size() : -1; |
311 return result; | 313 return result; |
312 } | 314 } |
OLD | NEW |