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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void PasswordStore::RemoveLoginsCreatedBetween(const base::Time& delete_begin, | 113 void PasswordStore::RemoveLoginsCreatedBetween(const base::Time& delete_begin, |
114 const base::Time& delete_end) { | 114 const base::Time& delete_end) { |
115 ScheduleTask(base::Bind(&PasswordStore::WrapModificationTask, this, | 115 ScheduleTask(base::Bind(&PasswordStore::WrapModificationTask, this, |
116 base::Closure( | 116 base::Closure( |
117 base::Bind(&PasswordStore::RemoveLoginsCreatedBetweenImpl, this, | 117 base::Bind(&PasswordStore::RemoveLoginsCreatedBetweenImpl, this, |
118 delete_begin, delete_end)))); | 118 delete_begin, delete_end)))); |
119 } | 119 } |
120 | 120 |
121 CancelableTaskTracker::TaskId PasswordStore::GetLogins( | 121 CancelableTaskTracker::TaskId PasswordStore::GetLogins( |
122 const PasswordForm& form, | 122 const PasswordForm& form, |
| 123 AuthorizationPromptPolicy prompt_policy, |
123 PasswordStoreConsumer* consumer) { | 124 PasswordStoreConsumer* consumer) { |
124 // Per http://crbug.com/121738, we deliberately ignore saved logins for | 125 // Per http://crbug.com/121738, we deliberately ignore saved logins for |
125 // http*://www.google.com/ that were stored prior to 2012. (Google now uses | 126 // http*://www.google.com/ that were stored prior to 2012. (Google now uses |
126 // https://accounts.google.com/ for all login forms, so these should be | 127 // https://accounts.google.com/ for all login forms, so these should be |
127 // unused.) We don't delete them just yet, and they'll still be visible in the | 128 // unused.) We don't delete them just yet, and they'll still be visible in the |
128 // password manager, but we won't use them to autofill any forms. This is a | 129 // password manager, but we won't use them to autofill any forms. This is a |
129 // security feature to help minimize damage that can be done by XSS attacks. | 130 // security feature to help minimize damage that can be done by XSS attacks. |
130 // TODO(mdm): actually delete them at some point, say M24 or so. | 131 // TODO(mdm): actually delete them at some point, say M24 or so. |
131 base::Time ignore_logins_cutoff; // the null time | 132 base::Time ignore_logins_cutoff; // the null time |
132 if (form.scheme == PasswordForm::SCHEME_HTML && | 133 if (form.scheme == PasswordForm::SCHEME_HTML && |
133 (form.signon_realm == "http://www.google.com" || | 134 (form.signon_realm == "http://www.google.com" || |
134 form.signon_realm == "http://www.google.com/" || | 135 form.signon_realm == "http://www.google.com/" || |
135 form.signon_realm == "https://www.google.com" || | 136 form.signon_realm == "https://www.google.com" || |
136 form.signon_realm == "https://www.google.com/")) { | 137 form.signon_realm == "https://www.google.com/")) { |
137 static const base::Time::Exploded exploded_cutoff = | 138 static const base::Time::Exploded exploded_cutoff = |
138 { 2012, 1, 0, 1, 0, 0, 0, 0 }; // 00:00 Jan 1 2012 | 139 { 2012, 1, 0, 1, 0, 0, 0, 0 }; // 00:00 Jan 1 2012 |
139 ignore_logins_cutoff = base::Time::FromUTCExploded(exploded_cutoff); | 140 ignore_logins_cutoff = base::Time::FromUTCExploded(exploded_cutoff); |
140 } | 141 } |
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); |
152 ScheduleTask( | 153 ScheduleTask(base::Bind(&PasswordStore::GetLoginsImpl, |
153 base::Bind(&PasswordStore::GetLoginsImpl, this, form, callback_runner)); | 154 this, form, prompt_policy, callback_runner)); |
154 return id; | 155 return id; |
155 } | 156 } |
156 | 157 |
157 CancelableRequestProvider::Handle PasswordStore::GetAutofillableLogins( | 158 CancelableRequestProvider::Handle PasswordStore::GetAutofillableLogins( |
158 PasswordStoreConsumer* consumer) { | 159 PasswordStoreConsumer* consumer) { |
159 return Schedule(&PasswordStore::GetAutofillableLoginsImpl, consumer); | 160 return Schedule(&PasswordStore::GetAutofillableLoginsImpl, consumer); |
160 } | 161 } |
161 | 162 |
162 CancelableRequestProvider::Handle PasswordStore::GetBlacklistLogins( | 163 CancelableRequestProvider::Handle PasswordStore::GetBlacklistLogins( |
163 PasswordStoreConsumer* consumer) { | 164 PasswordStoreConsumer* consumer) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 #endif // !defined(OS_MACOSX) | 241 #endif // !defined(OS_MACOSX) |
241 BrowserThread::PostTask( | 242 BrowserThread::PostTask( |
242 BrowserThread::UI, FROM_HERE, | 243 BrowserThread::UI, FROM_HERE, |
243 base::Bind(&PasswordStore::NotifyLoginsChanged, this)); | 244 base::Bind(&PasswordStore::NotifyLoginsChanged, this)); |
244 } | 245 } |
245 | 246 |
246 void PasswordStore::NotifyLoginsChanged() { | 247 void PasswordStore::NotifyLoginsChanged() { |
247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
248 FOR_EACH_OBSERVER(Observer, observers_, OnLoginsChanged()); | 249 FOR_EACH_OBSERVER(Observer, observers_, OnLoginsChanged()); |
249 } | 250 } |
OLD | NEW |