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

Side by Side Diff: chrome/browser/chromeos/login/profile_image_downloader.h

Issue 8541002: [cros] Initial user image loading and repeated profile image loading fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 enum DownloadResult { 27 enum DownloadResult {
28 kDownloadSuccessChanged, 28 kDownloadSuccessChanged,
29 kDownloadSuccess, 29 kDownloadSuccess,
30 kDownloadFailure, 30 kDownloadFailure,
31 kDownloadDefault, 31 kDownloadDefault,
32 32
33 // Must be the last, convenient count. 33 // Must be the last, convenient count.
34 kDownloadResultsCount 34 kDownloadResultsCount
35 }; 35 };
36 36
37 // Reports on success or failure of Profile image download. 37 // Reports on success or failure of Profile image download. It is OK to
38 // delete the |ProfileImageDownloader| instance in any of these handlers.
38 class Delegate { 39 class Delegate {
39 public: 40 public:
40 virtual ~Delegate() {} 41 virtual ~Delegate() {}
41 42
42 // Called when image is successfully downloaded and decoded. 43 // Called when image is successfully downloaded and decoded.
43 virtual void OnDownloadSuccess(const SkBitmap& image) = 0; 44 virtual void OnDownloadSuccess(const SkBitmap& image) = 0;
44 45
45 // Called on download failure. 46 // Called on download failure.
46 virtual void OnDownloadFailure() {} 47 virtual void OnDownloadFailure() {}
47 48
48 // Called when user has the default profile image and we won't download 49 // Called when user has the default profile image and we won't download
49 // it. 50 // it.
50 virtual void OnDownloadDefaultImage() {} 51 virtual void OnDownloadDefaultImage() {}
51 }; 52 };
52 53
53 explicit ProfileImageDownloader(Delegate* delegate); 54 explicit ProfileImageDownloader(Delegate* delegate);
54 virtual ~ProfileImageDownloader(); 55 virtual ~ProfileImageDownloader();
55 56
56 // Starts downloading the picture if the necessary authorization token is 57 // Starts downloading the picture if the necessary authorization token is
57 // ready. If not, subscribes to token service and starts fetching if the 58 // ready. If not, subscribes to token service and starts fetching if the
58 // token is available. 59 // token is available. Should not be called more than once.
59 void Start(); 60 void Start();
60 61
61 private: 62 private:
62 // Overriden from content::URLFetcherDelegate: 63 // Overriden from content::URLFetcherDelegate:
63 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; 64 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE;
64 65
65 // Overriden from ImageDecoder::Delegate: 66 // Overriden from ImageDecoder::Delegate:
66 virtual void OnImageDecoded(const ImageDecoder* decoder, 67 virtual void OnImageDecoded(const ImageDecoder* decoder,
67 const SkBitmap& decoded_image) OVERRIDE; 68 const SkBitmap& decoded_image) OVERRIDE;
68 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; 69 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
(...skipping 18 matching lines...) Expand all
87 scoped_ptr<content::URLFetcher> user_entry_fetcher_; 88 scoped_ptr<content::URLFetcher> user_entry_fetcher_;
88 scoped_ptr<content::URLFetcher> profile_image_fetcher_; 89 scoped_ptr<content::URLFetcher> profile_image_fetcher_;
89 content::NotificationRegistrar registrar_; 90 content::NotificationRegistrar registrar_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader); 92 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader);
92 }; 93 };
93 94
94 } // namespace chromeos 95 } // namespace chromeos
95 96
96 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ 97 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/default_user_images.cc ('k') | chrome/browser/chromeos/login/profile_image_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698