| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ | 4 #ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ |
| 5 #define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ | 5 #define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
| 11 | 11 |
| 12 class ProfileInfoCache; | 12 class ProfileAttributesStorage; |
| 13 | 13 |
| 14 class ProfileAvatarDownloader : public chrome::BitmapFetcherDelegate { | 14 class ProfileAvatarDownloader : public chrome::BitmapFetcherDelegate { |
| 15 public: | 15 public: |
| 16 ProfileAvatarDownloader(size_t icon_index, | 16 ProfileAvatarDownloader(size_t icon_index, |
| 17 const base::FilePath& profile_path, | 17 const base::FilePath& profile_path, |
| 18 ProfileInfoCache* cache); | 18 ProfileAttributesStorage* storage); |
| 19 ~ProfileAvatarDownloader() override; | 19 ~ProfileAvatarDownloader() override; |
| 20 | 20 |
| 21 void Start(); | 21 void Start(); |
| 22 | 22 |
| 23 // BitmapFetcherDelegate: | 23 // BitmapFetcherDelegate: |
| 24 void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override; | 24 void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 // Downloads the avatar image from a url. | 27 // Downloads the avatar image from a url. |
| 28 scoped_ptr<chrome::BitmapFetcher> fetcher_; | 28 scoped_ptr<chrome::BitmapFetcher> fetcher_; |
| 29 | 29 |
| 30 // Index of the avatar being downloaded. | 30 // Index of the avatar being downloaded. |
| 31 size_t icon_index_; | 31 size_t icon_index_; |
| 32 | 32 |
| 33 // Path of the profile for which the avatar is being downloaded. | 33 // Path of the profile for which the avatar is being downloaded. |
| 34 base::FilePath profile_path_; | 34 base::FilePath profile_path_; |
| 35 | 35 |
| 36 ProfileInfoCache* cache_; // Weak. | 36 ProfileAttributesStorage* storage_; // Not owned. |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ | 39 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_DOWNLOADER_H_ |
| OLD | NEW |