| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const URLFetcher* source) { | 194 const URLFetcher* source) { |
| 195 const net::URLRequestStatus& status = source->GetStatus(); | 195 const net::URLRequestStatus& status = source->GetStatus(); |
| 196 if (!status.is_success()) { | 196 if (!status.is_success()) { |
| 197 DispatchNetworkError(status.error()); | 197 DispatchNetworkError(status.error()); |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 | 200 |
| 201 int response_code = source->GetResponseCode(); | 201 int response_code = source->GetResponseCode(); |
| 202 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { | 202 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { |
| 203 access_token_expired_ = true; | 203 access_token_expired_ = true; |
| 204 oauth2_token_service_->InvalidateToken(account_id_, | 204 oauth2_token_service_->InvalidateAccessToken( |
| 205 OAuth2TokenService::ScopeSet(), | 205 account_id_, OAuth2TokenService::ScopeSet(), access_token_); |
| 206 access_token_); | |
| 207 StartFetching(); | 206 StartFetching(); |
| 208 return; | 207 return; |
| 209 } | 208 } |
| 210 | 209 |
| 211 if (response_code != net::HTTP_OK) { | 210 if (response_code != net::HTTP_OK) { |
| 212 // TODO(bauerb): We should return the HTTP response code somehow. | 211 // TODO(bauerb): We should return the HTTP response code somehow. |
| 213 DLOG(WARNING) << "HTTP error " << response_code; | 212 DLOG(WARNING) << "HTTP error " << response_code; |
| 214 DispatchGoogleServiceAuthError( | 213 DispatchGoogleServiceAuthError( |
| 215 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), | 214 GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED), |
| 216 std::string()); | 215 std::string()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 URLRequestContextGetter* context) { | 293 URLRequestContextGetter* context) { |
| 295 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher( | 294 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher( |
| 296 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service, | 295 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service, |
| 297 account_id, | 296 account_id, |
| 298 device_id, | 297 device_id, |
| 299 context)); | 298 context)); |
| 300 return fetcher.Pass(); | 299 return fetcher.Pass(); |
| 301 } | 300 } |
| 302 | 301 |
| 303 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {} | 302 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {} |
| OLD | NEW |