| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 // static | 264 // static |
| 265 bool FamilyInfoFetcher::ParseMembers(const base::ListValue* list, | 265 bool FamilyInfoFetcher::ParseMembers(const base::ListValue* list, |
| 266 std::vector<FamilyMember>* members) { | 266 std::vector<FamilyMember>* members) { |
| 267 for (base::ListValue::const_iterator it = list->begin(); | 267 for (base::ListValue::const_iterator it = list->begin(); |
| 268 it != list->end(); | 268 it != list->end(); |
| 269 it++) { | 269 it++) { |
| 270 FamilyMember member; | 270 FamilyMember member; |
| 271 base::DictionaryValue* dict = NULL; | 271 const base::DictionaryValue* dict = NULL; |
| 272 if (!(*it)->GetAsDictionary(&dict) || !ParseMember(dict, &member)) { | 272 if (!it->GetAsDictionary(&dict) || !ParseMember(dict, &member)) { |
| 273 return false; | 273 return false; |
| 274 } | 274 } |
| 275 members->push_back(member); | 275 members->push_back(member); |
| 276 } | 276 } |
| 277 return true; | 277 return true; |
| 278 } | 278 } |
| 279 | 279 |
| 280 // static | 280 // static |
| 281 bool FamilyInfoFetcher::ParseMember(const base::DictionaryValue* dict, | 281 bool FamilyInfoFetcher::ParseMember(const base::DictionaryValue* dict, |
| 282 FamilyMember* member) { | 282 FamilyMember* member) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 consumer_->OnFailure(SERVICE_ERROR); | 346 consumer_->OnFailure(SERVICE_ERROR); |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 std::vector<FamilyMember> members; | 349 std::vector<FamilyMember> members; |
| 350 if (!ParseMembers(members_list, &members)){ | 350 if (!ParseMembers(members_list, &members)){ |
| 351 consumer_->OnFailure(SERVICE_ERROR); | 351 consumer_->OnFailure(SERVICE_ERROR); |
| 352 return; | 352 return; |
| 353 } | 353 } |
| 354 consumer_->OnGetFamilyMembersSuccess(members); | 354 consumer_->OnGetFamilyMembersSuccess(members); |
| 355 } | 355 } |
| OLD | NEW |