| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROFILES_PROFILE_DOWNLOADER_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class OAuth2AccessTokenFetcher; | 22 class OAuth2AccessTokenFetcher; |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 class URLFetcher; | 25 class URLFetcher; |
| 26 } // namespace net | 26 } // namespace net |
| 27 | 27 |
| 28 // Downloads user profile information. The profile picture is decoded in a | 28 // Downloads user profile information. The profile picture is decoded in a |
| 29 // sandboxed process. | 29 // sandboxed process. |
| 30 class ProfileDownloader : public gaia::GaiaOAuthClient::Delegate, | 30 class ProfileDownloader : public gaia::GaiaOAuthClient::Delegate, |
| 31 public net::URLFetcherDelegate, | 31 public net::URLFetcherDelegate, |
| 32 public ImageDecoder::Delegate, | 32 public ImageDecoder::ImageRequest, |
| 33 public OAuth2TokenService::Observer, | 33 public OAuth2TokenService::Observer, |
| 34 public OAuth2TokenService::Consumer { | 34 public OAuth2TokenService::Consumer { |
| 35 public: | 35 public: |
| 36 enum PictureStatus { | 36 enum PictureStatus { |
| 37 PICTURE_SUCCESS, | 37 PICTURE_SUCCESS, |
| 38 PICTURE_FAILED, | 38 PICTURE_FAILED, |
| 39 PICTURE_DEFAULT, | 39 PICTURE_DEFAULT, |
| 40 PICTURE_CACHED, | 40 PICTURE_CACHED, |
| 41 }; | 41 }; |
| 42 | 42 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // gaia::GaiaOAuthClient::Delegate implementation. | 88 // gaia::GaiaOAuthClient::Delegate implementation. |
| 89 void OnGetUserInfoResponse( | 89 void OnGetUserInfoResponse( |
| 90 scoped_ptr<base::DictionaryValue> user_info) override; | 90 scoped_ptr<base::DictionaryValue> user_info) override; |
| 91 void OnOAuthError() override; | 91 void OnOAuthError() override; |
| 92 void OnNetworkError(int response_code) override; | 92 void OnNetworkError(int response_code) override; |
| 93 | 93 |
| 94 // Overriden from net::URLFetcherDelegate: | 94 // Overriden from net::URLFetcherDelegate: |
| 95 void OnURLFetchComplete(const net::URLFetcher* source) override; | 95 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 96 | 96 |
| 97 // Overriden from ImageDecoder::Delegate: | 97 // Overriden from ImageDecoder::ImageRequest: |
| 98 void OnImageDecoded(const ImageDecoder* decoder, | 98 void OnImageDecoded(const SkBitmap& decoded_image) override; |
| 99 const SkBitmap& decoded_image) override; | 99 void OnDecodeImageFailed() override; |
| 100 void OnDecodeImageFailed(const ImageDecoder* decoder) override; | |
| 101 | 100 |
| 102 // Overriden from OAuth2TokenService::Observer: | 101 // Overriden from OAuth2TokenService::Observer: |
| 103 void OnRefreshTokenAvailable(const std::string& account_id) override; | 102 void OnRefreshTokenAvailable(const std::string& account_id) override; |
| 104 | 103 |
| 105 // Overriden from OAuth2TokenService::Consumer: | 104 // Overriden from OAuth2TokenService::Consumer: |
| 106 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 105 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 107 const std::string& access_token, | 106 const std::string& access_token, |
| 108 const base::Time& expiration_time) override; | 107 const base::Time& expiration_time) override; |
| 109 void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 108 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 110 const GoogleServiceAuthError& error) override; | 109 const GoogleServiceAuthError& error) override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 base::string16 profile_given_name_; | 142 base::string16 profile_given_name_; |
| 144 std::string profile_locale_; | 143 std::string profile_locale_; |
| 145 SkBitmap profile_picture_; | 144 SkBitmap profile_picture_; |
| 146 PictureStatus picture_status_; | 145 PictureStatus picture_status_; |
| 147 std::string picture_url_; | 146 std::string picture_url_; |
| 148 | 147 |
| 149 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader); | 148 DISALLOW_COPY_AND_ASSIGN(ProfileDownloader); |
| 150 }; | 149 }; |
| 151 | 150 |
| 152 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ | 151 #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ |
| OLD | NEW |