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/child_accounts/permission_request_creat
or_apiary.h" | 5 #include "chrome/browser/supervised_user/child_accounts/permission_request_creat
or_apiary.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (!status.is_success()) { | 225 if (!status.is_success()) { |
226 DispatchNetworkError(it, status.error()); | 226 DispatchNetworkError(it, status.error()); |
227 return; | 227 return; |
228 } | 228 } |
229 | 229 |
230 int response_code = source->GetResponseCode(); | 230 int response_code = source->GetResponseCode(); |
231 if (response_code == net::HTTP_UNAUTHORIZED && !(*it)->access_token_expired) { | 231 if (response_code == net::HTTP_UNAUTHORIZED && !(*it)->access_token_expired) { |
232 (*it)->access_token_expired = true; | 232 (*it)->access_token_expired = true; |
233 OAuth2TokenService::ScopeSet scopes; | 233 OAuth2TokenService::ScopeSet scopes; |
234 scopes.insert(GetApiScope()); | 234 scopes.insert(GetApiScope()); |
235 oauth2_token_service_->InvalidateToken(account_id_, | 235 oauth2_token_service_->InvalidateAccessToken(account_id_, scopes, |
236 scopes, | 236 (*it)->access_token); |
237 (*it)->access_token); | |
238 StartFetching(*it); | 237 StartFetching(*it); |
239 return; | 238 return; |
240 } | 239 } |
241 | 240 |
242 if (response_code != net::HTTP_OK) { | 241 if (response_code != net::HTTP_OK) { |
243 LOG(WARNING) << "HTTP error " << response_code; | 242 LOG(WARNING) << "HTTP error " << response_code; |
244 DispatchGoogleServiceAuthError( | 243 DispatchGoogleServiceAuthError( |
245 it, GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); | 244 it, GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)); |
246 return; | 245 return; |
247 } | 246 } |
(...skipping 26 matching lines...) Expand all Loading... |
274 it, GoogleServiceAuthError::FromConnectionError(error_code)); | 273 it, GoogleServiceAuthError::FromConnectionError(error_code)); |
275 } | 274 } |
276 | 275 |
277 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( | 276 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( |
278 RequestIterator it, | 277 RequestIterator it, |
279 const GoogleServiceAuthError& error) { | 278 const GoogleServiceAuthError& error) { |
280 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); | 279 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); |
281 (*it)->callback.Run(false); | 280 (*it)->callback.Run(false); |
282 requests_.erase(it); | 281 requests_.erase(it); |
283 } | 282 } |
OLD | NEW |