| 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/family_info_fetcher.h" | 5 #include "chrome/browser/supervised_user/child_accounts/family_info_fetcher.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 consumer_->OnFailure(NETWORK_ERROR); | 195 consumer_->OnFailure(NETWORK_ERROR); |
| 196 return; | 196 return; |
| 197 } | 197 } |
| 198 | 198 |
| 199 int response_code = source->GetResponseCode(); | 199 int response_code = source->GetResponseCode(); |
| 200 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { | 200 if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) { |
| 201 DVLOG(1) << "Access token expired, retrying"; | 201 DVLOG(1) << "Access token expired, retrying"; |
| 202 access_token_expired_ = true; | 202 access_token_expired_ = true; |
| 203 OAuth2TokenService::ScopeSet scopes; | 203 OAuth2TokenService::ScopeSet scopes; |
| 204 scopes.insert(kScope); | 204 scopes.insert(kScope); |
| 205 token_service_->InvalidateToken(account_id_, scopes, access_token_); | 205 token_service_->InvalidateAccessToken(account_id_, scopes, access_token_); |
| 206 StartFetching(); | 206 StartFetching(); |
| 207 return; | 207 return; |
| 208 } | 208 } |
| 209 | 209 |
| 210 if (response_code != net::HTTP_OK) { | 210 if (response_code != net::HTTP_OK) { |
| 211 DLOG(WARNING) << "HTTP error " << response_code; | 211 DLOG(WARNING) << "HTTP error " << response_code; |
| 212 consumer_->OnFailure(NETWORK_ERROR); | 212 consumer_->OnFailure(NETWORK_ERROR); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 consumer_->OnFailure(SERVICE_ERROR); | 310 consumer_->OnFailure(SERVICE_ERROR); |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 std::vector<FamilyMember> members; | 313 std::vector<FamilyMember> members; |
| 314 if (!ParseMembers(members_list, &members)){ | 314 if (!ParseMembers(members_list, &members)){ |
| 315 consumer_->OnFailure(SERVICE_ERROR); | 315 consumer_->OnFailure(SERVICE_ERROR); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 consumer_->OnGetFamilyMembersSuccess(members); | 318 consumer_->OnGetFamilyMembersSuccess(members); |
| 319 } | 319 } |
| OLD | NEW |