Commit 80807f2b authored by Monica Basta's avatar Monica Basta Committed by Commit Bot

[Signin]: Prevent overriding GAIA image in case of fetch failure.

This CL adds a check on the |FetchImage| request state before overriding
the account image stored in the |AccountTrackerService|. We should not
override the image with an empty image in case of failure to re-fetch
the image in one of the 24 hours update interval.

Bug: 1037865
Change-Id: Ia78cf1d04791711a74f4f8fccb7a1ad53de2004d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1985765Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Monica Basta <msalama@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728487}
parent d01edeec
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "components/signin/public/base/avatar_icon_util.h" #include "components/signin/public/base/avatar_icon_util.h"
#include "components/signin/public/base/signin_client.h" #include "components/signin/public/base/signin_client.h"
#include "components/signin/public/base/signin_switches.h" #include "components/signin/public/base/signin_switches.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -369,6 +370,10 @@ void AccountFetcherService::OnRefreshTokensLoaded() { ...@@ -369,6 +370,10 @@ void AccountFetcherService::OnRefreshTokensLoaded() {
void AccountFetcherService::OnImageFetched( void AccountFetcherService::OnImageFetched(
const CoreAccountId& account_id, const CoreAccountId& account_id,
const gfx::Image& image, const gfx::Image& image,
const image_fetcher::RequestMetadata&) { const image_fetcher::RequestMetadata& metadata) {
if (metadata.http_response_code != net::HTTP_OK) {
DCHECK(image.IsEmpty());
return;
}
account_tracker_service_->SetAccountImage(account_id, image); account_tracker_service_->SetAccountImage(account_id, image);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment