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.h" | 5 #include "chrome/browser/password_manager/password_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 // OnGetPasswordStoreResults owns PasswordForms in the vector. | 33 // OnGetPasswordStoreResults owns PasswordForms in the vector. |
34 consumer->OnGetPasswordStoreResults(*matched_forms); | 34 consumer->OnGetPasswordStoreResults(*matched_forms); |
35 } | 35 } |
36 | 36 |
37 void PostConsumerCallback( | 37 void PostConsumerCallback( |
38 base::TaskRunner* task_runner, | 38 base::TaskRunner* task_runner, |
39 const CancelableTaskTracker::IsCanceledCallback& is_canceled_cb, | 39 const CancelableTaskTracker::IsCanceledCallback& is_canceled_cb, |
40 PasswordStoreConsumer* consumer, | 40 PasswordStoreConsumer* consumer, |
41 const base::Time& ignore_logins_cutoff, | 41 const base::Time& ignore_logins_cutoff, |
42 const PasswordForm& form, | |
vabr (Chromium)
2014/03/07 23:43:36
Please indicate, what is the form needed for. Idea
riadh.chtara
2014/03/14 17:16:08
it's not needed.
I forgot to remove it.
Sorry for
| |
42 const vector<PasswordForm*>& matched_forms) { | 43 const vector<PasswordForm*>& matched_forms) { |
43 vector<PasswordForm*>* matched_forms_copy = new vector<PasswordForm*>(); | 44 vector<PasswordForm*>* matched_forms_copy = new vector<PasswordForm*>(); |
44 if (ignore_logins_cutoff.is_null()) { | 45 if (ignore_logins_cutoff.is_null()) { |
45 *matched_forms_copy = matched_forms; | 46 *matched_forms_copy = matched_forms; |
46 } else { | 47 } else { |
47 // Apply |ignore_logins_cutoff| and delete old ones. | 48 // Apply |ignore_logins_cutoff| and delete old ones. |
48 for (size_t i = 0; i < matched_forms.size(); i++) { | 49 for (size_t i = 0; i < matched_forms.size(); i++) { |
49 if (matched_forms[i]->date_created < ignore_logins_cutoff) | 50 if (matched_forms[i]->date_created < ignore_logins_cutoff) |
50 delete matched_forms[i]; | 51 delete matched_forms[i]; |
51 else | 52 else |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 | 142 |
142 CancelableTaskTracker::IsCanceledCallback is_canceled_cb; | 143 CancelableTaskTracker::IsCanceledCallback is_canceled_cb; |
143 CancelableTaskTracker::TaskId id = | 144 CancelableTaskTracker::TaskId id = |
144 consumer->cancelable_task_tracker()->NewTrackedTaskId(&is_canceled_cb); | 145 consumer->cancelable_task_tracker()->NewTrackedTaskId(&is_canceled_cb); |
145 | 146 |
146 ConsumerCallbackRunner callback_runner = | 147 ConsumerCallbackRunner callback_runner = |
147 base::Bind(&PostConsumerCallback, | 148 base::Bind(&PostConsumerCallback, |
148 base::MessageLoopProxy::current(), | 149 base::MessageLoopProxy::current(), |
149 is_canceled_cb, | 150 is_canceled_cb, |
150 consumer, | 151 consumer, |
151 ignore_logins_cutoff); | 152 ignore_logins_cutoff, |
153 form); | |
152 ScheduleTask( | 154 ScheduleTask( |
153 base::Bind(&PasswordStore::GetLoginsImpl, this, form, callback_runner)); | 155 base::Bind(&PasswordStore::GetLoginsImpl, this, form, callback_runner)); |
154 return id; | 156 return id; |
155 } | 157 } |
156 | 158 |
157 CancelableRequestProvider::Handle PasswordStore::GetAutofillableLogins( | 159 CancelableRequestProvider::Handle PasswordStore::GetAutofillableLogins( |
158 PasswordStoreConsumer* consumer) { | 160 PasswordStoreConsumer* consumer) { |
159 return Schedule(&PasswordStore::GetAutofillableLoginsImpl, consumer); | 161 return Schedule(&PasswordStore::GetAutofillableLoginsImpl, consumer); |
160 } | 162 } |
161 | 163 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 #endif // !defined(OS_MACOSX) | 242 #endif // !defined(OS_MACOSX) |
241 BrowserThread::PostTask( | 243 BrowserThread::PostTask( |
242 BrowserThread::UI, FROM_HERE, | 244 BrowserThread::UI, FROM_HERE, |
243 base::Bind(&PasswordStore::NotifyLoginsChanged, this)); | 245 base::Bind(&PasswordStore::NotifyLoginsChanged, this)); |
244 } | 246 } |
245 | 247 |
246 void PasswordStore::NotifyLoginsChanged() { | 248 void PasswordStore::NotifyLoginsChanged() { |
247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
248 FOR_EACH_OBSERVER(Observer, observers_, OnLoginsChanged()); | 250 FOR_EACH_OBSERVER(Observer, observers_, OnLoginsChanged()); |
249 } | 251 } |
OLD | NEW |