OLD | NEW |
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 27 matching lines...) Expand all Loading... |
38 explicit ProfileImageDownloader(Delegate* delegate); | 38 explicit ProfileImageDownloader(Delegate* delegate); |
39 virtual ~ProfileImageDownloader(); | 39 virtual ~ProfileImageDownloader(); |
40 | 40 |
41 // Starts downloading the picture if the necessary authorization token is | 41 // Starts downloading the picture if the necessary authorization token is |
42 // ready. If not, subscribes to token service and starts fetching if the | 42 // ready. If not, subscribes to token service and starts fetching if the |
43 // token is available. | 43 // token is available. |
44 void Start(); | 44 void Start(); |
45 | 45 |
46 private: | 46 private: |
47 // Overriden from content::URLFetcherDelegate: | 47 // Overriden from content::URLFetcherDelegate: |
48 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 48 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
49 | 49 |
50 // Overriden from ImageDecoder::Delegate: | 50 // Overriden from ImageDecoder::Delegate: |
51 virtual void OnImageDecoded(const ImageDecoder* decoder, | 51 virtual void OnImageDecoded(const ImageDecoder* decoder, |
52 const SkBitmap& decoded_image) OVERRIDE; | 52 const SkBitmap& decoded_image) OVERRIDE; |
53 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; | 53 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; |
54 | 54 |
55 // Overriden from content::NotificationObserver: | 55 // Overriden from content::NotificationObserver: |
56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) OVERRIDE; |
59 | 59 |
60 // Searches for profile image URL in user entry response from Picasa. | 60 // Searches for profile image URL in user entry response from Picasa. |
61 // Returns an empty string on failure. | 61 // Returns an empty string on failure. |
62 std::string GetProfileImageURL(const std::string& data) const; | 62 std::string GetProfileImageURL(const std::string& data) const; |
63 | 63 |
64 // Issues the first request to get user profile image. | 64 // Issues the first request to get user profile image. |
65 void StartFetchingImage(); | 65 void StartFetchingImage(); |
66 | 66 |
67 Delegate* delegate_; | 67 Delegate* delegate_; |
68 std::string auth_token_; | 68 std::string auth_token_; |
69 scoped_ptr<URLFetcher> user_entry_fetcher_; | 69 scoped_ptr<content::URLFetcher> user_entry_fetcher_; |
70 scoped_ptr<URLFetcher> profile_image_fetcher_; | 70 scoped_ptr<content::URLFetcher> profile_image_fetcher_; |
71 content::NotificationRegistrar registrar_; | 71 content::NotificationRegistrar registrar_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader); | 73 DISALLOW_COPY_AND_ASSIGN(ProfileImageDownloader); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace chromeos | 76 } // namespace chromeos |
77 | 77 |
78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PROFILE_IMAGE_DOWNLOADER_H_ |
OLD | NEW |