Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: chrome/browser/profiles/profile_downloader.cc

Issue 1326273003: Add logging to profile downloader to diagnose Android FR issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/signin/core/browser/account_fetcher_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 &url)) { 216 &url)) {
217 return url.spec(); 217 return url.spec();
218 } 218 }
219 return account_info_.picture_url; 219 return account_info_.picture_url;
220 } 220 }
221 221
222 void ProfileDownloader::StartFetchingImage() { 222 void ProfileDownloader::StartFetchingImage() {
223 VLOG(1) << "Fetching user entry with token: " << auth_token_; 223 VLOG(1) << "Fetching user entry with token: " << auth_token_;
224 account_info_ = account_tracker_service_->GetAccountInfo(account_id_); 224 account_info_ = account_tracker_service_->GetAccountInfo(account_id_);
225 225
226 if (account_info_.IsValid())
227 FetchImageData();
228 else
229 waiting_for_account_info_ = true;
230
226 if (delegate_->IsPreSignin()) { 231 if (delegate_->IsPreSignin()) {
227 AccountFetcherServiceFactory::GetForProfile(delegate_->GetBrowserProfile()) 232 AccountFetcherServiceFactory::GetForProfile(delegate_->GetBrowserProfile())
228 ->FetchUserInfoBeforeSignin(account_id_); 233 ->FetchUserInfoBeforeSignin(account_id_);
229 } 234 }
230
231 if (account_info_.IsValid())
232 FetchImageData();
233 else
234 waiting_for_account_info_ = true;
235 } 235 }
236 236
237 void ProfileDownloader::StartFetchingOAuth2AccessToken() { 237 void ProfileDownloader::StartFetchingOAuth2AccessToken() {
238 Profile* profile = delegate_->GetBrowserProfile(); 238 Profile* profile = delegate_->GetBrowserProfile();
239 OAuth2TokenService::ScopeSet scopes; 239 OAuth2TokenService::ScopeSet scopes;
240 scopes.insert(GaiaConstants::kGoogleUserInfoProfile); 240 scopes.insert(GaiaConstants::kGoogleUserInfoProfile);
241 // Increase scope to get hd attribute to determine if lock should be enabled. 241 // Increase scope to get hd attribute to determine if lock should be enabled.
242 if (switches::IsNewProfileManagement()) 242 if (switches::IsNewProfileManagement())
243 scopes.insert(GaiaConstants::kGoogleUserInfoEmail); 243 scopes.insert(GaiaConstants::kGoogleUserInfoEmail);
244 ProfileOAuth2TokenService* token_service = 244 ProfileOAuth2TokenService* token_service =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); 295 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str()));
296 } 296 }
297 297
298 profile_image_fetcher_->Start(); 298 profile_image_fetcher_->Start();
299 } 299 }
300 300
301 void ProfileDownloader::OnURLFetchComplete(const net::URLFetcher* source) { 301 void ProfileDownloader::OnURLFetchComplete(const net::URLFetcher* source) {
302 DCHECK_CURRENTLY_ON(BrowserThread::UI); 302 DCHECK_CURRENTLY_ON(BrowserThread::UI);
303 std::string data; 303 std::string data;
304 source->GetResponseAsString(&data); 304 source->GetResponseAsString(&data);
305 LOG(WARNING) << "Profile image URL fetch for image at "
306 << source->GetURL().possibly_invalid_spec()
307 << " completed with status: "
308 << source->GetStatus().status()
309 << " and response code: " << source->GetResponseCode()
310 << " data size: " << data.size();
305 bool network_error = 311 bool network_error =
306 source->GetStatus().status() != net::URLRequestStatus::SUCCESS; 312 source->GetStatus().status() != net::URLRequestStatus::SUCCESS;
307 if (network_error || source->GetResponseCode() != 200) { 313 if (network_error || source->GetResponseCode() != 200) {
308 LOG(WARNING) << "Fetching profile data failed"; 314 LOG(WARNING) << "Fetching profile data failed";
309 DVLOG(1) << " Status: " << source->GetStatus().status(); 315 DVLOG(1) << " Status: " << source->GetStatus().status();
310 DVLOG(1) << " Error: " << source->GetStatus().error(); 316 DVLOG(1) << " Error: " << source->GetStatus().error();
311 DVLOG(1) << " Response code: " << source->GetResponseCode(); 317 DVLOG(1) << " Response code: " << source->GetResponseCode();
312 DVLOG(1) << " Url: " << source->GetURL().spec(); 318 DVLOG(1) << " Url: " << source->GetURL().spec();
313 profile_image_fetcher_.reset(); 319 profile_image_fetcher_.reset();
314 delegate_->OnProfileDownloadFailure(this, network_error ? 320 delegate_->OnProfileDownloadFailure(this, network_error ?
315 ProfileDownloaderDelegate::NETWORK_ERROR : 321 ProfileDownloaderDelegate::NETWORK_ERROR :
316 ProfileDownloaderDelegate::SERVICE_ERROR); 322 ProfileDownloaderDelegate::SERVICE_ERROR);
317 } else { 323 } else {
318 profile_image_fetcher_.reset(); 324 profile_image_fetcher_.reset();
319 VLOG(1) << "Decoding the image...";
320 ImageDecoder::Start(this, data); 325 ImageDecoder::Start(this, data);
321 } 326 }
322 } 327 }
323 328
324 void ProfileDownloader::OnImageDecoded(const SkBitmap& decoded_image) { 329 void ProfileDownloader::OnImageDecoded(const SkBitmap& decoded_image) {
325 DCHECK_CURRENTLY_ON(BrowserThread::UI); 330 DCHECK_CURRENTLY_ON(BrowserThread::UI);
326 int image_size = delegate_->GetDesiredImageSideLength(); 331 int image_size = delegate_->GetDesiredImageSideLength();
327 profile_picture_ = skia::ImageOperations::Resize( 332 profile_picture_ = skia::ImageOperations::Resize(
328 decoded_image, 333 decoded_image,
329 skia::ImageOperations::RESIZE_BEST, 334 skia::ImageOperations::RESIZE_BEST,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 account_info_ = info; 384 account_info_ = info;
380 385
381 // If the StartFetchingImage was called before we had valid info, the 386 // If the StartFetchingImage was called before we had valid info, the
382 // downloader has been waiting so we need to fetch the image data now. 387 // downloader has been waiting so we need to fetch the image data now.
383 if (waiting_for_account_info_) { 388 if (waiting_for_account_info_) {
384 FetchImageData(); 389 FetchImageData();
385 waiting_for_account_info_ = false; 390 waiting_for_account_info_ = false;
386 } 391 }
387 } 392 }
388 } 393 }
OLDNEW
« no previous file with comments | « no previous file | components/signin/core/browser/account_fetcher_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698