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 #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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 324 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
325 net::LOAD_DO_NOT_SAVE_COOKIES); | 325 net::LOAD_DO_NOT_SAVE_COOKIES); |
326 if (!auth_token_.empty()) { | 326 if (!auth_token_.empty()) { |
327 profile_image_fetcher_->SetExtraRequestHeaders( | 327 profile_image_fetcher_->SetExtraRequestHeaders( |
328 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); | 328 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); |
329 } | 329 } |
330 profile_image_fetcher_->Start(); | 330 profile_image_fetcher_->Start(); |
331 } else if (source == profile_image_fetcher_.get()) { | 331 } else if (source == profile_image_fetcher_.get()) { |
332 VLOG(1) << "Decoding the image..."; | 332 VLOG(1) << "Decoding the image..."; |
333 scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder( | 333 scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder( |
334 this, data); | 334 this, data, ImageDecoder::DEFAULT_CODEC); |
335 image_decoder->Start(); | 335 image_decoder->Start(); |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 void ProfileDownloader::OnImageDecoded(const ImageDecoder* decoder, | 339 void ProfileDownloader::OnImageDecoded(const ImageDecoder* decoder, |
340 const SkBitmap& decoded_image) { | 340 const SkBitmap& decoded_image) { |
341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
342 int image_size = delegate_->GetDesiredImageSideLength(); | 342 int image_size = delegate_->GetDesiredImageSideLength(); |
343 profile_picture_ = skia::ImageOperations::Resize( | 343 profile_picture_ = skia::ImageOperations::Resize( |
344 decoded_image, | 344 decoded_image, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 const base::Time& expiration_time) { | 385 const base::Time& expiration_time) { |
386 auth_token_ = access_token; | 386 auth_token_ = access_token; |
387 StartFetchingImage(); | 387 StartFetchingImage(); |
388 } | 388 } |
389 | 389 |
390 // Callback for OAuth2AccessTokenFetcher on failure. | 390 // Callback for OAuth2AccessTokenFetcher on failure. |
391 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { | 391 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { |
392 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; | 392 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; |
393 delegate_->OnProfileDownloadFailure(this); | 393 delegate_->OnProfileDownloadFailure(this); |
394 } | 394 } |
OLD | NEW |