OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_USER_IMAGE_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_DOWNLOADER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_DOWNLOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "chrome/browser/utility_process_host.h" | 13 #include "chrome/browser/utility_process_host.h" |
14 #include "chrome/common/net/url_fetcher.h" | 14 #include "chrome/common/net/url_fetcher.h" |
15 | 15 |
16 class ListValue; | 16 class ListValue; |
17 class ResourceDispatcherHost; | 17 class ResourceDispatcherHost; |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 // Gets user image URL from user's Google Profile, downloads the image, | 21 // Gets user image URL from user's Google Profile, downloads the image, |
22 // converts it to PNG format and stores the converted image in a file with | 22 // converts it to PNG format and stores the converted image in a file with |
23 // path to it stored in local state dictionary. | 23 // path to it stored in local state dictionary. |
24 class UserImageDownloader : public URLFetcher::Delegate, | 24 class UserImageDownloader : public URLFetcher::Delegate, |
25 public UtilityProcessHost::Client { | 25 public UtilityProcessHost::Client { |
26 public: | 26 public: |
| 27 // Starts downloading the picture upon successful login. |
27 // |auth_token| is a authentication token received in ClientLogin | 28 // |auth_token| is a authentication token received in ClientLogin |
28 // response, used for requests sent to Contacts API. | 29 // response, used for requests sent to Contacts API. |
29 // Starts downloading the picture. Object is deleted as reference counted | |
30 // object. | |
31 UserImageDownloader(const std::string& username, | 30 UserImageDownloader(const std::string& username, |
32 const std::string& auth_token); | 31 const std::string& auth_token); |
33 | 32 |
34 private: | 33 private: |
35 // It's a reference counted object, so destructor is private. | 34 // It's a reference counted object, so destructor is private. |
36 ~UserImageDownloader(); | 35 ~UserImageDownloader(); |
37 | 36 |
38 // Overriden from URLFetcher::Delegate: | 37 // Overriden from URLFetcher::Delegate: |
39 virtual void OnURLFetchComplete(const URLFetcher* source, | 38 virtual void OnURLFetchComplete(const URLFetcher* source, |
40 const GURL& url, | 39 const GURL& url, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Authentication token to use for image download. | 83 // Authentication token to use for image download. |
85 std::string auth_token_; | 84 std::string auth_token_; |
86 | 85 |
87 DISALLOW_COPY_AND_ASSIGN(UserImageDownloader); | 86 DISALLOW_COPY_AND_ASSIGN(UserImageDownloader); |
88 }; | 87 }; |
89 | 88 |
90 } // namespace chromeos | 89 } // namespace chromeos |
91 | 90 |
92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_DOWNLOADER_H_ | 91 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_DOWNLOADER_H_ |
93 | 92 |
OLD | NEW |