| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.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 "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 19 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "webkit/glue/password_form.h" | 23 #include "webkit/forms/password_form.h" |
| 24 | 24 |
| 25 PasswordManagerHandler::PasswordManagerHandler() | 25 PasswordManagerHandler::PasswordManagerHandler() |
| 26 : ALLOW_THIS_IN_INITIALIZER_LIST(populater_(this)), | 26 : ALLOW_THIS_IN_INITIALIZER_LIST(populater_(this)), |
| 27 ALLOW_THIS_IN_INITIALIZER_LIST(exception_populater_(this)) { | 27 ALLOW_THIS_IN_INITIALIZER_LIST(exception_populater_(this)) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 PasswordManagerHandler::~PasswordManagerHandler() { | 30 PasswordManagerHandler::~PasswordManagerHandler() { |
| 31 PasswordStore* store = GetPasswordStore(); | 31 PasswordStore* store = GetPasswordStore(); |
| 32 if (store) | 32 if (store) |
| 33 store->RemoveObserver(this); | 33 store->RemoveObserver(this); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 245 |
| 246 pending_login_query_ = store->GetAutofillableLogins(this); | 246 pending_login_query_ = store->GetAutofillableLogins(this); |
| 247 } else { | 247 } else { |
| 248 LOG(ERROR) << "No password store! Cannot display passwords."; | 248 LOG(ERROR) << "No password store! Cannot display passwords."; |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 void PasswordManagerHandler::PasswordListPopulater:: | 252 void PasswordManagerHandler::PasswordListPopulater:: |
| 253 OnPasswordStoreRequestDone( | 253 OnPasswordStoreRequestDone( |
| 254 CancelableRequestProvider::Handle handle, | 254 CancelableRequestProvider::Handle handle, |
| 255 const std::vector<webkit_glue::PasswordForm*>& result) { | 255 const std::vector<webkit::forms::PasswordForm*>& result) { |
| 256 DCHECK_EQ(pending_login_query_, handle); | 256 DCHECK_EQ(pending_login_query_, handle); |
| 257 pending_login_query_ = 0; | 257 pending_login_query_ = 0; |
| 258 page_->password_list_.reset(); | 258 page_->password_list_.reset(); |
| 259 page_->password_list_.insert(page_->password_list_.end(), | 259 page_->password_list_.insert(page_->password_list_.end(), |
| 260 result.begin(), result.end()); | 260 result.begin(), result.end()); |
| 261 page_->SetPasswordList(); | 261 page_->SetPasswordList(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 PasswordManagerHandler::PasswordExceptionListPopulater:: | 264 PasswordManagerHandler::PasswordExceptionListPopulater:: |
| 265 PasswordExceptionListPopulater(PasswordManagerHandler* page) | 265 PasswordExceptionListPopulater(PasswordManagerHandler* page) |
| 266 : ListPopulater(page) { | 266 : ListPopulater(page) { |
| 267 } | 267 } |
| 268 | 268 |
| 269 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { | 269 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { |
| 270 PasswordStore* store = page_->GetPasswordStore(); | 270 PasswordStore* store = page_->GetPasswordStore(); |
| 271 if (store != NULL) { | 271 if (store != NULL) { |
| 272 if (pending_login_query_) | 272 if (pending_login_query_) |
| 273 store->CancelRequest(pending_login_query_); | 273 store->CancelRequest(pending_login_query_); |
| 274 | 274 |
| 275 pending_login_query_ = store->GetBlacklistLogins(this); | 275 pending_login_query_ = store->GetBlacklistLogins(this); |
| 276 } else { | 276 } else { |
| 277 LOG(ERROR) << "No password store! Cannot display exceptions."; | 277 LOG(ERROR) << "No password store! Cannot display exceptions."; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 void PasswordManagerHandler::PasswordExceptionListPopulater:: | 281 void PasswordManagerHandler::PasswordExceptionListPopulater:: |
| 282 OnPasswordStoreRequestDone( | 282 OnPasswordStoreRequestDone( |
| 283 CancelableRequestProvider::Handle handle, | 283 CancelableRequestProvider::Handle handle, |
| 284 const std::vector<webkit_glue::PasswordForm*>& result) { | 284 const std::vector<webkit::forms::PasswordForm*>& result) { |
| 285 DCHECK_EQ(pending_login_query_, handle); | 285 DCHECK_EQ(pending_login_query_, handle); |
| 286 pending_login_query_ = 0; | 286 pending_login_query_ = 0; |
| 287 page_->password_exception_list_.reset(); | 287 page_->password_exception_list_.reset(); |
| 288 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 288 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
| 289 result.begin(), result.end()); | 289 result.begin(), result.end()); |
| 290 page_->SetPasswordExceptionList(); | 290 page_->SetPasswordExceptionList(); |
| 291 } | 291 } |
| OLD | NEW |