OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/profiles/profile_downloader.h" | 5 #include "chrome/browser/profiles/profile_downloader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const std::string& photo_id = path_components[kPhotoIdPathComponentIndex]; | 186 const std::string& photo_id = path_components[kPhotoIdPathComponentIndex]; |
187 const std::string& photo_version = | 187 const std::string& photo_version = |
188 path_components[kPhotoVersionPathComponentIndex]; | 188 path_components[kPhotoVersionPathComponentIndex]; |
189 | 189 |
190 // Check that the ID and version match the default Picasa profile photo. | 190 // Check that the ID and version match the default Picasa profile photo. |
191 return photo_id == kPicasaPhotoId && | 191 return photo_id == kPicasaPhotoId && |
192 photo_version == kDefaultPicasaPhotoVersion; | 192 photo_version == kDefaultPicasaPhotoVersion; |
193 } | 193 } |
194 | 194 |
195 ProfileDownloader::ProfileDownloader(ProfileDownloaderDelegate* delegate) | 195 ProfileDownloader::ProfileDownloader(ProfileDownloaderDelegate* delegate) |
196 : ImageRequest( | 196 : OAuth2TokenService::Consumer("profile_downloader"), |
197 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), | |
198 OAuth2TokenService::Consumer("profile_downloader"), | |
199 delegate_(delegate), | 197 delegate_(delegate), |
200 picture_status_(PICTURE_FAILED) { | 198 picture_status_(PICTURE_FAILED) { |
201 DCHECK(delegate_); | 199 DCHECK(delegate_); |
202 } | 200 } |
203 | 201 |
204 void ProfileDownloader::Start() { | 202 void ProfileDownloader::Start() { |
205 StartForAccount(std::string()); | 203 StartForAccount(std::string()); |
206 } | 204 } |
207 | 205 |
208 void ProfileDownloader::StartForAccount(const std::string& account_id) { | 206 void ProfileDownloader::StartForAccount(const std::string& account_id) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 void ProfileDownloader::OnGetTokenFailure( | 415 void ProfileDownloader::OnGetTokenFailure( |
418 const OAuth2TokenService::Request* request, | 416 const OAuth2TokenService::Request* request, |
419 const GoogleServiceAuthError& error) { | 417 const GoogleServiceAuthError& error) { |
420 DCHECK_EQ(request, oauth2_access_token_request_.get()); | 418 DCHECK_EQ(request, oauth2_access_token_request_.get()); |
421 oauth2_access_token_request_.reset(); | 419 oauth2_access_token_request_.reset(); |
422 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed:" | 420 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed:" |
423 << error.ToString(); | 421 << error.ToString(); |
424 delegate_->OnProfileDownloadFailure( | 422 delegate_->OnProfileDownloadFailure( |
425 this, ProfileDownloaderDelegate::TOKEN_ERROR); | 423 this, ProfileDownloaderDelegate::TOKEN_ERROR); |
426 } | 424 } |
OLD | NEW |