| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 scopes); | 266 scopes); |
| 267 } | 267 } |
| 268 | 268 |
| 269 ProfileDownloader::~ProfileDownloader() {} | 269 ProfileDownloader::~ProfileDownloader() {} |
| 270 | 270 |
| 271 void ProfileDownloader::OnURLFetchComplete(const content::URLFetcher* source) { | 271 void ProfileDownloader::OnURLFetchComplete(const content::URLFetcher* source) { |
| 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 273 std::string data; | 273 std::string data; |
| 274 source->GetResponseAsString(&data); | 274 source->GetResponseAsString(&data); |
| 275 if (source->GetResponseCode() != 200) { | 275 if (source->GetResponseCode() != 200) { |
| 276 LOG(ERROR) << "Response code is " << source->GetResponseCode(); | 276 DVLOG(1) << "Response code is " << source->GetResponseCode(); |
| 277 LOG(ERROR) << "Url is " << source->GetURL().spec(); | 277 DVLOG(1) << "Url is " << source->GetURL().spec(); |
| 278 LOG(ERROR) << "Data is " << data; | 278 DVLOG(1) << "Data is " << data; |
| 279 delegate_->OnDownloadComplete(this, false); | 279 delegate_->OnDownloadComplete(this, false); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 | 282 |
| 283 if (source == user_entry_fetcher_.get()) { | 283 if (source == user_entry_fetcher_.get()) { |
| 284 std::string image_url; | 284 std::string image_url; |
| 285 if (!GetProfileNameAndImageURL(data, &profile_full_name_, &image_url, | 285 if (!GetProfileNameAndImageURL(data, &profile_full_name_, &image_url, |
| 286 delegate_->GetDesiredImageSideLength())) { | 286 delegate_->GetDesiredImageSideLength())) { |
| 287 delegate_->OnDownloadComplete(this, false); | 287 delegate_->OnDownloadComplete(this, false); |
| 288 return; | 288 return; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { | 366 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { |
| 367 auth_token_ = access_token; | 367 auth_token_ = access_token; |
| 368 StartFetchingImage(); | 368 StartFetchingImage(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 // Callback for OAuth2AccessTokenFetcher on failure. | 371 // Callback for OAuth2AccessTokenFetcher on failure. |
| 372 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { | 372 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { |
| 373 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; | 373 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; |
| 374 delegate_->OnDownloadComplete(this, false); | 374 delegate_->OnDownloadComplete(this, false); |
| 375 } | 375 } |
| OLD | NEW |