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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 this, delegate_->GetBrowserProfile()->GetRequestContext())); | 268 this, delegate_->GetBrowserProfile()->GetRequestContext())); |
269 oauth2_access_token_fetcher_->Start( | 269 oauth2_access_token_fetcher_->Start( |
270 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), | 270 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), |
271 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), | 271 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), |
272 service->GetOAuth2LoginRefreshToken(), | 272 service->GetOAuth2LoginRefreshToken(), |
273 scopes); | 273 scopes); |
274 } | 274 } |
275 | 275 |
276 ProfileDownloader::~ProfileDownloader() {} | 276 ProfileDownloader::~ProfileDownloader() {} |
277 | 277 |
278 void ProfileDownloader::OnURLFetchComplete(const content::URLFetcher* source) { | 278 void ProfileDownloader::OnURLFetchComplete(const net::URLFetcher* source) { |
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
280 std::string data; | 280 std::string data; |
281 source->GetResponseAsString(&data); | 281 source->GetResponseAsString(&data); |
282 if (source->GetResponseCode() != 200) { | 282 if (source->GetResponseCode() != 200) { |
283 DVLOG(1) << "Response code is " << source->GetResponseCode(); | 283 DVLOG(1) << "Response code is " << source->GetResponseCode(); |
284 DVLOG(1) << "Url is " << source->GetURL().spec(); | 284 DVLOG(1) << "Url is " << source->GetURL().spec(); |
285 DVLOG(1) << "Data is " << data; | 285 DVLOG(1) << "Data is " << data; |
286 delegate_->OnDownloadComplete(this, false); | 286 delegate_->OnDownloadComplete(this, false); |
287 return; | 287 return; |
288 } | 288 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { | 375 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { |
376 auth_token_ = access_token; | 376 auth_token_ = access_token; |
377 StartFetchingImage(); | 377 StartFetchingImage(); |
378 } | 378 } |
379 | 379 |
380 // Callback for OAuth2AccessTokenFetcher on failure. | 380 // Callback for OAuth2AccessTokenFetcher on failure. |
381 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { | 381 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { |
382 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; | 382 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; |
383 delegate_->OnDownloadComplete(this, false); | 383 delegate_->OnDownloadComplete(this, false); |
384 } | 384 } |
OLD | NEW |