Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3858)

Unified Diff: chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc

Issue 2468763002: MD Settings: fix chrome.passwordsPrivate empty list bug (Closed)
Patch Set: fix ups Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index f332e3ef2d7140918b85f02330fb98f1d811a8ed..c697d10653907fae137f66d32a33e843277cdca9 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -49,9 +49,12 @@ void PasswordsPrivateDelegateImpl::SendSavedPasswordsList() {
router->OnSavedPasswordsListChanged(current_entries_);
}
-const std::vector<api::passwords_private::PasswordUiEntry>*
-PasswordsPrivateDelegateImpl::GetSavedPasswordsList() const {
- return &current_entries_;
+void PasswordsPrivateDelegateImpl::GetSavedPasswordsList(
+ const UiEntriesCallback& callback) {
+ if (is_initialized_)
+ callback.Run(&current_entries_);
+ else
+ get_saved_passwords_list_callbacks_.push_back(callback);
}
void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
@@ -61,9 +64,12 @@ void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
router->OnPasswordExceptionsListChanged(current_exceptions_);
}
-const std::vector<api::passwords_private::ExceptionPair>*
-PasswordsPrivateDelegateImpl::GetPasswordExceptionsList() const {
- return &current_exceptions_;
+void PasswordsPrivateDelegateImpl::GetPasswordExceptionsList(
+ const ExceptionPairsCallback& callback) {
+ if (is_initialized_)
+ callback.Run(&current_exceptions_);
+ else
+ get_password_exception_list_callbacks_.push_back(callback);
}
void PasswordsPrivateDelegateImpl::RemoveSavedPassword(
@@ -232,7 +238,7 @@ void PasswordsPrivateDelegateImpl::Shutdown() {
}
void PasswordsPrivateDelegateImpl::ExecuteFunction(
- const base::Callback<void()>& callback) {
+ const base::Closure& callback) {
if (is_initialized_) {
callback.Run();
return;
@@ -249,9 +255,19 @@ void PasswordsPrivateDelegateImpl::InitializeIfNecessary() {
is_initialized_ = true;
- for (const base::Callback<void()>& callback : pre_initialization_callbacks_) {
+ for (const base::Closure& callback : pre_initialization_callbacks_) {
callback.Run();
}
+ for (const auto& callback : get_saved_passwords_list_callbacks_) {
+ callback.Run(&current_entries_);
+ }
+ for (const auto& callback : get_password_exception_list_callbacks_) {
+ callback.Run(&current_exceptions_);
+ }
+
+ pre_initialization_callbacks_.clear();
+ get_saved_passwords_list_callbacks_.clear();
+ get_password_exception_list_callbacks_.clear();
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698