| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 (*it)->url_fetcher->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); | 183 (*it)->url_fetcher->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); |
| 184 (*it)->url_fetcher->AddExtraRequestHeader( | 184 (*it)->url_fetcher->AddExtraRequestHeader( |
| 185 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 185 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
| 186 | 186 |
| 187 base::DictionaryValue dict; | 187 base::DictionaryValue dict; |
| 188 dict.SetStringWithoutPathExpansion(kEventTypeKey, (*it)->request_type); | 188 dict.SetStringWithoutPathExpansion(kEventTypeKey, (*it)->request_type); |
| 189 dict.SetStringWithoutPathExpansion(kObjectRefKey, (*it)->object_ref); | 189 dict.SetStringWithoutPathExpansion(kObjectRefKey, (*it)->object_ref); |
| 190 dict.SetStringWithoutPathExpansion(kStateKey, kState); | 190 dict.SetStringWithoutPathExpansion(kStateKey, kState); |
| 191 | 191 |
| 192 std::string body; | 192 std::string body; |
| 193 base::JSONWriter::Write(&dict, &body); | 193 base::JSONWriter::Write(dict, &body); |
| 194 (*it)->url_fetcher->SetUploadData("application/json", body); | 194 (*it)->url_fetcher->SetUploadData("application/json", body); |
| 195 | 195 |
| 196 (*it)->url_fetcher->Start(); | 196 (*it)->url_fetcher->Start(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void PermissionRequestCreatorApiary::OnGetTokenFailure( | 199 void PermissionRequestCreatorApiary::OnGetTokenFailure( |
| 200 const OAuth2TokenService::Request* request, | 200 const OAuth2TokenService::Request* request, |
| 201 const GoogleServiceAuthError& error) { | 201 const GoogleServiceAuthError& error) { |
| 202 VLOG(1) << "Couldn't get token"; | 202 VLOG(1) << "Couldn't get token"; |
| 203 RequestIterator it = requests_.begin(); | 203 RequestIterator it = requests_.begin(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 it, GoogleServiceAuthError::FromConnectionError(error_code)); | 274 it, GoogleServiceAuthError::FromConnectionError(error_code)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( | 277 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( |
| 278 RequestIterator it, | 278 RequestIterator it, |
| 279 const GoogleServiceAuthError& error) { | 279 const GoogleServiceAuthError& error) { |
| 280 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); | 280 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); |
| 281 (*it)->callback.Run(false); | 281 (*it)->callback.Run(false); |
| 282 requests_.erase(it); | 282 requests_.erase(it); |
| 283 } | 283 } |
| OLD | NEW |