1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_AVATAR_FETCHER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_AVATAR_FETCHER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
17 class URLRequestContextGetter
;
20 class AccountAvatarFetcherDelegate
{
22 virtual void UpdateAvatar(const gfx::ImageSkia
& image
) = 0;
25 // Helper class to download an avatar. It deletes itself once the request is
27 class AccountAvatarFetcher
: public chrome::BitmapFetcherDelegate
{
31 const base::WeakPtr
<AccountAvatarFetcherDelegate
>& delegate
);
33 ~AccountAvatarFetcher() override
;
35 void Start(net::URLRequestContextGetter
* request_context
);
38 // chrome::BitmapFetcherDelegate:
39 void OnFetchComplete(const GURL
& url
, const SkBitmap
* bitmap
) override
;
41 chrome::BitmapFetcher fetcher_
;
42 base::WeakPtr
<AccountAvatarFetcherDelegate
> delegate_
;
44 DISALLOW_COPY_AND_ASSIGN(AccountAvatarFetcher
);
47 #endif // CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_AVATAR_FETCHER_H_