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