summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles/profile_avatar_downloader.h
blob: 43b357862a90b9ba036adea5d5c251dd83262fe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_
#define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_

#include "base/files/file_path.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"

class ProfileInfoCache;

class ProfileAvatarDownloader : public chrome::BitmapFetcherDelegate {
 public:
  ProfileAvatarDownloader(size_t icon_index,
                          const base::FilePath& profile_path,
                          ProfileInfoCache* cache);
  ~ProfileAvatarDownloader() override;

  void Start();

  // BitmapFetcherDelegate:
  void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;

 private:
  // Downloads the avatar image from a url.
  scoped_ptr<chrome::BitmapFetcher> fetcher_;

  // Index of the avatar being downloaded.
  size_t icon_index_;

  // Path of the profile for which the avatar is being downloaded.
  base::FilePath profile_path_;

  ProfileInfoCache* cache_;  // Weak.
};

#endif  // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_