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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return; | 315 return; |
316 } | 316 } |
317 if (!image_url.empty() && image_url == delegate_->GetCachedPictureURL()) { | 317 if (!image_url.empty() && image_url == delegate_->GetCachedPictureURL()) { |
318 VLOG(1) << "Picture URL matches cached picture URL"; | 318 VLOG(1) << "Picture URL matches cached picture URL"; |
319 picture_status_ = PICTURE_CACHED; | 319 picture_status_ = PICTURE_CACHED; |
320 delegate_->OnProfileDownloadSuccess(this); | 320 delegate_->OnProfileDownloadSuccess(this); |
321 return; | 321 return; |
322 } | 322 } |
323 VLOG(1) << "Fetching profile image from " << image_url; | 323 VLOG(1) << "Fetching profile image from " << image_url; |
324 picture_url_ = image_url; | 324 picture_url_ = image_url; |
325 profile_image_fetcher_.reset(net::URLFetcher::Create( | 325 profile_image_fetcher_ = |
326 GURL(image_url), net::URLFetcher::GET, this)); | 326 net::URLFetcher::Create(GURL(image_url), net::URLFetcher::GET, this); |
327 profile_image_fetcher_->SetRequestContext( | 327 profile_image_fetcher_->SetRequestContext( |
328 delegate_->GetBrowserProfile()->GetRequestContext()); | 328 delegate_->GetBrowserProfile()->GetRequestContext()); |
329 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 329 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
330 net::LOAD_DO_NOT_SAVE_COOKIES); | 330 net::LOAD_DO_NOT_SAVE_COOKIES); |
331 if (!auth_token_.empty()) { | 331 if (!auth_token_.empty()) { |
332 profile_image_fetcher_->SetExtraRequestHeaders( | 332 profile_image_fetcher_->SetExtraRequestHeaders( |
333 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); | 333 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); |
334 } | 334 } |
335 profile_image_fetcher_->Start(); | 335 profile_image_fetcher_->Start(); |
336 } | 336 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void ProfileDownloader::OnGetTokenFailure( | 415 void ProfileDownloader::OnGetTokenFailure( |
416 const OAuth2TokenService::Request* request, | 416 const OAuth2TokenService::Request* request, |
417 const GoogleServiceAuthError& error) { | 417 const GoogleServiceAuthError& error) { |
418 DCHECK_EQ(request, oauth2_access_token_request_.get()); | 418 DCHECK_EQ(request, oauth2_access_token_request_.get()); |
419 oauth2_access_token_request_.reset(); | 419 oauth2_access_token_request_.reset(); |
420 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed:" | 420 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed:" |
421 << error.ToString(); | 421 << error.ToString(); |
422 delegate_->OnProfileDownloadFailure( | 422 delegate_->OnProfileDownloadFailure( |
423 this, ProfileDownloaderDelegate::TOKEN_ERROR); | 423 this, ProfileDownloaderDelegate::TOKEN_ERROR); |
424 } | 424 } |
OLD | NEW |