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

Unified Diff: chrome/browser/password_manager/account_chooser_dialog_android.cc

Issue 2454993004: [Smart Lock] Account chooser assign correct avatar to profile. (Closed)
Patch Set: . Created 4 years, 2 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/account_chooser_dialog_android.cc
diff --git a/chrome/browser/password_manager/account_chooser_dialog_android.cc b/chrome/browser/password_manager/account_chooser_dialog_android.cc
index cf5db18ce81a75e06c972dafaf95a06a3bd0d6b0..a0b6f0b3df480b3bfdbeb0c65e8722222b50db0e 100644
--- a/chrome/browser/password_manager/account_chooser_dialog_android.cc
+++ b/chrome/browser/password_manager/account_chooser_dialog_android.cc
@@ -90,20 +90,16 @@ void AvatarFetcherAndroid::OnFetchComplete(const GURL& url,
delete this;
}
-void FetchAvatars(
- const base::android::ScopedJavaGlobalRef<jobject>& java_dialog,
- const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_forms,
- int index,
- net::URLRequestContextGetter* request_context) {
- for (const auto& password_form : password_forms) {
- if (!password_form->icon_url.is_valid())
- continue;
- // Fetcher deletes itself once fetching is finished.
- auto* fetcher =
- new AvatarFetcherAndroid(password_form->icon_url, index, java_dialog);
- fetcher->Start(request_context);
- ++index;
- }
+void FetchAvatar(const base::android::ScopedJavaGlobalRef<jobject>& java_dialog,
+ const autofill::PasswordForm* password_form,
+ int index,
+ net::URLRequestContextGetter* request_context) {
+ if (!password_form->icon_url.is_valid())
+ return;
+ // Fetcher deletes itself once fetching is finished.
+ auto* fetcher =
+ new AvatarFetcherAndroid(password_form->icon_url, index, java_dialog);
+ fetcher->Start(request_context);
}
}; // namespace
@@ -166,9 +162,11 @@ void AccountChooserDialogAndroid::ShowDialog() {
net::URLRequestContextGetter* request_context =
Profile::FromBrowserContext(web_contents_->GetBrowserContext())
->GetRequestContext();
- FetchAvatars(dialog_jobject_, local_credentials_forms(), 0, request_context);
- FetchAvatars(dialog_jobject_, federation_providers_forms(),
- local_credentials_forms().size(), request_context);
+ int avatar_index = 0;
+ for (const auto& form : local_credentials_forms())
+ FetchAvatar(dialog_jobject_, form.get(), avatar_index++, request_context);
+ for (const auto& form : federation_providers_forms())
+ FetchAvatar(dialog_jobject_, form.get(), avatar_index++, request_context);
}
void AccountChooserDialogAndroid::OnCredentialClicked(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698