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/ui/webui/options/password_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/password_manager/password_store_factory.h" | 13 #include "chrome/browser/password_manager/password_store_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "components/autofill/core/common/password_form.h" |
17 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
19 #include "content/public/browser/web_ui.h" | 20 #include "content/public/browser/web_ui.h" |
20 #include "content/public/common/password_form.h" | |
21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 | 25 |
26 namespace options { | 26 namespace options { |
27 | 27 |
28 PasswordManagerHandler::PasswordManagerHandler() | 28 PasswordManagerHandler::PasswordManagerHandler() |
29 : populater_(this), | 29 : populater_(this), |
30 exception_populater_(this) { | 30 exception_populater_(this) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 pending_login_query_ = store->GetAutofillableLogins(this); | 223 pending_login_query_ = store->GetAutofillableLogins(this); |
224 } else { | 224 } else { |
225 LOG(ERROR) << "No password store! Cannot display passwords."; | 225 LOG(ERROR) << "No password store! Cannot display passwords."; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void PasswordManagerHandler::PasswordListPopulater:: | 229 void PasswordManagerHandler::PasswordListPopulater:: |
230 OnPasswordStoreRequestDone( | 230 OnPasswordStoreRequestDone( |
231 CancelableRequestProvider::Handle handle, | 231 CancelableRequestProvider::Handle handle, |
232 const std::vector<content::PasswordForm*>& result) { | 232 const std::vector<autofill::PasswordForm*>& result) { |
233 DCHECK_EQ(pending_login_query_, handle); | 233 DCHECK_EQ(pending_login_query_, handle); |
234 pending_login_query_ = 0; | 234 pending_login_query_ = 0; |
235 page_->password_list_.clear(); | 235 page_->password_list_.clear(); |
236 page_->password_list_.insert(page_->password_list_.end(), | 236 page_->password_list_.insert(page_->password_list_.end(), |
237 result.begin(), result.end()); | 237 result.begin(), result.end()); |
238 page_->SetPasswordList(); | 238 page_->SetPasswordList(); |
239 } | 239 } |
240 | 240 |
241 void PasswordManagerHandler::PasswordListPopulater::OnGetPasswordStoreResults( | 241 void PasswordManagerHandler::PasswordListPopulater::OnGetPasswordStoreResults( |
242 const std::vector<content::PasswordForm*>& results) { | 242 const std::vector<autofill::PasswordForm*>& results) { |
243 // TODO(kaiwang): Implement when I refactor | 243 // TODO(kaiwang): Implement when I refactor |
244 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins. | 244 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins. |
245 NOTIMPLEMENTED(); | 245 NOTIMPLEMENTED(); |
246 } | 246 } |
247 | 247 |
248 PasswordManagerHandler::PasswordExceptionListPopulater:: | 248 PasswordManagerHandler::PasswordExceptionListPopulater:: |
249 PasswordExceptionListPopulater(PasswordManagerHandler* page) | 249 PasswordExceptionListPopulater(PasswordManagerHandler* page) |
250 : ListPopulater(page) { | 250 : ListPopulater(page) { |
251 } | 251 } |
252 | 252 |
253 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { | 253 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { |
254 PasswordStore* store = page_->GetPasswordStore(); | 254 PasswordStore* store = page_->GetPasswordStore(); |
255 if (store != NULL) { | 255 if (store != NULL) { |
256 if (pending_login_query_) | 256 if (pending_login_query_) |
257 store->CancelRequest(pending_login_query_); | 257 store->CancelRequest(pending_login_query_); |
258 | 258 |
259 pending_login_query_ = store->GetBlacklistLogins(this); | 259 pending_login_query_ = store->GetBlacklistLogins(this); |
260 } else { | 260 } else { |
261 LOG(ERROR) << "No password store! Cannot display exceptions."; | 261 LOG(ERROR) << "No password store! Cannot display exceptions."; |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 void PasswordManagerHandler::PasswordExceptionListPopulater:: | 265 void PasswordManagerHandler::PasswordExceptionListPopulater:: |
266 OnPasswordStoreRequestDone( | 266 OnPasswordStoreRequestDone( |
267 CancelableRequestProvider::Handle handle, | 267 CancelableRequestProvider::Handle handle, |
268 const std::vector<content::PasswordForm*>& result) { | 268 const std::vector<autofill::PasswordForm*>& result) { |
269 DCHECK_EQ(pending_login_query_, handle); | 269 DCHECK_EQ(pending_login_query_, handle); |
270 pending_login_query_ = 0; | 270 pending_login_query_ = 0; |
271 page_->password_exception_list_.clear(); | 271 page_->password_exception_list_.clear(); |
272 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 272 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
273 result.begin(), result.end()); | 273 result.begin(), result.end()); |
274 page_->SetPasswordExceptionList(); | 274 page_->SetPasswordExceptionList(); |
275 } | 275 } |
276 | 276 |
277 void PasswordManagerHandler::PasswordExceptionListPopulater:: | 277 void PasswordManagerHandler::PasswordExceptionListPopulater:: |
278 OnGetPasswordStoreResults( | 278 OnGetPasswordStoreResults( |
279 const std::vector<content::PasswordForm*>& results) { | 279 const std::vector<autofill::PasswordForm*>& results) { |
280 // TODO(kaiwang): Implement when I refactor | 280 // TODO(kaiwang): Implement when I refactor |
281 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins. | 281 // PasswordStore::GetAutofillableLogins and PasswordStore::GetBlacklistLogins. |
282 NOTIMPLEMENTED(); | 282 NOTIMPLEMENTED(); |
283 } | 283 } |
284 | 284 |
285 } // namespace options | 285 } // namespace options |
OLD | NEW |