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" |
11 #include "net/http/http_status_code.h" | 11 #include "net/http/http_status_code.h" |
12 #include "net/url_request/url_request_status.h" | 12 #include "net/url_request/url_request_status.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 const char kFamilyApiUrl[] = "https://www.googleapis.com/kidsmanagement/v1/"; | 15 const char kFamilyApiUrl[] = "https://www.googleapis.com/kidsmanagement/v1/"; |
16 const char kGetFamilyProfileApiSuffix[] = "families/mine?alt=json"; | 16 const char kGetFamilyProfileApiSuffix[] = "families/mine?alt=json"; |
17 const char kGetFamilyMembersApiSuffix[] = "families/mine/members?alt=json"; | 17 const char kGetFamilyMembersApiSuffix[] = "families/mine/members?alt=json"; |
18 const char kScope[] = "https://www.googleapis.com/auth/kid.family"; | 18 const char kScope[] = "https://www.googleapis.com/auth/kid.family.readonly"; |
19 const char kAuthorizationHeaderFormat[] = "Authorization: Bearer %s"; | 19 const char kAuthorizationHeaderFormat[] = "Authorization: Bearer %s"; |
20 const int kNumRetries = 1; | 20 const int kNumRetries = 1; |
21 | 21 |
22 const char kIdFamily[] = "family"; | 22 const char kIdFamily[] = "family"; |
23 const char kIdFamilyId[] = "familyId"; | 23 const char kIdFamilyId[] = "familyId"; |
24 const char kIdProfile[] = "profile"; | 24 const char kIdProfile[] = "profile"; |
25 const char kIdFamilyName[] = "name"; | 25 const char kIdFamilyName[] = "name"; |
26 const char kIdMembers[] = "members"; | 26 const char kIdMembers[] = "members"; |
27 const char kIdUserId[] = "userId"; | 27 const char kIdUserId[] = "userId"; |
28 const char kIdRole[] = "role"; | 28 const char kIdRole[] = "role"; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 consumer_->OnFailure(SERVICE_ERROR); | 311 consumer_->OnFailure(SERVICE_ERROR); |
312 return; | 312 return; |
313 } | 313 } |
314 std::vector<FamilyMember> members; | 314 std::vector<FamilyMember> members; |
315 if (!ParseMembers(members_list, &members)){ | 315 if (!ParseMembers(members_list, &members)){ |
316 consumer_->OnFailure(SERVICE_ERROR); | 316 consumer_->OnFailure(SERVICE_ERROR); |
317 return; | 317 return; |
318 } | 318 } |
319 consumer_->OnGetFamilyMembersSuccess(members); | 319 consumer_->OnGetFamilyMembersSuccess(members); |
320 } | 320 } |
OLD | NEW |