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

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

Issue 2466273004: MD Settings: test passwordsPrivate.get{SavedPassword,PasswordExceptions}List (Closed)
Patch Set: asdf 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfbb2281e930eb19926790aa82f5f621ead8a45b..ee744580d8251a96c6d64567f483748ce5009f4e 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
@@ -51,7 +51,7 @@ void PasswordsPrivateDelegateImpl::SendSavedPasswordsList() {
void PasswordsPrivateDelegateImpl::GetSavedPasswordsList(
const UiEntriesCallback& callback) {
- if (is_initialized_)
+ if (current_entries_initialized_)
callback.Run(current_entries_);
else
get_saved_passwords_list_callbacks_.push_back(callback);
@@ -66,7 +66,7 @@ void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
void PasswordsPrivateDelegateImpl::GetPasswordExceptionsList(
const ExceptionPairsCallback& callback) {
- if (is_initialized_)
+ if (current_exceptions_initialized_)
callback.Run(current_exceptions_);
else
get_password_exception_list_callbacks_.push_back(callback);
@@ -195,8 +195,15 @@ void PasswordsPrivateDelegateImpl::SetPasswordList(
SendSavedPasswordsList();
+ DCHECK(!current_entries_initialized_ ||
+ get_saved_passwords_list_callbacks_.empty());
+
current_entries_initialized_ = true;
InitializeIfNecessary();
+
+ for (const auto& callback : get_saved_passwords_list_callbacks_)
+ callback.Run(current_entries_);
+ get_saved_passwords_list_callbacks_.clear();
}
void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
@@ -222,8 +229,15 @@ void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
SendPasswordExceptionsList();
+ DCHECK(!current_entries_initialized_ ||
+ get_saved_passwords_list_callbacks_.empty());
+
current_exceptions_initialized_ = true;
InitializeIfNecessary();
+
+ for (const auto& callback : get_password_exception_list_callbacks_)
+ callback.Run(current_exceptions_);
+ get_password_exception_list_callbacks_.clear();
}
#if !defined(OS_ANDROID)
@@ -254,19 +268,9 @@ void PasswordsPrivateDelegateImpl::InitializeIfNecessary() {
is_initialized_ = true;
- for (const base::Closure& 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698