| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/legacy/supervised_user_refresh_token_fe
tcher.h" | 5 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe
tcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const URLFetcher* source) { | 198 const URLFetcher* source) { |
| 199 const net::URLRequestStatus& status = source->GetStatus(); | 199 const net::URLRequestStatus& status = source->GetStatus(); |
| 200 if (!status.is_success()) { | 200 if (!status.is_success()) { |
| 201 DispatchNetworkError(status.error()); | 201 DispatchNetworkError(status.error()); |
| 202 return; | 202 return; |
| 203 } | 203 } |
| 204 | 204 |
| 205 int response_code = source->GetResponseCode(); | 205 int response_code = source->GetResponseCode(); |
| 206 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { | 206 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { |
| 207 access_token_expired_ = true; | 207 access_token_expired_ = true; |
| 208 oauth2_token_service_->InvalidateToken(account_id_, | 208 oauth2_token_service_->InvalidateAccessToken( |
| 209 OAuth2TokenService::ScopeSet(), | 209 account_id_, OAuth2TokenService::ScopeSet(), access_token_); |
| 210 access_token_); | |
| 211 StartFetching(); | 210 StartFetching(); |
| 212 return; | 211 return; |
| 213 } | 212 } |
| 214 | 213 |
| 215 if (response_code != net::HTTP_OK) { | 214 if (response_code != net::HTTP_OK) { |
| 216 // TODO(bauerb): We should return the HTTP response code somehow. | 215 // TODO(bauerb): We should return the HTTP response code somehow. |
| 217 DLOG(WARNING) << "HTTP error " << response_code; | 216 DLOG(WARNING) << "HTTP error " << response_code; |
| 218 DispatchGoogleServiceAuthError( | 217 DispatchGoogleServiceAuthError( |
| 219 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), | 218 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), |
| 220 std::string()); | 219 std::string()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 URLRequestContextGetter* context) { | 297 URLRequestContextGetter* context) { |
| 299 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher( | 298 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher( |
| 300 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service, | 299 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service, |
| 301 account_id, | 300 account_id, |
| 302 device_id, | 301 device_id, |
| 303 context)); | 302 context)); |
| 304 return fetcher.Pass(); | 303 return fetcher.Pass(); |
| 305 } | 304 } |
| 306 | 305 |
| 307 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {} | 306 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {} |
| OLD | NEW |