| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const base::Time& expiration_time) { | 167 const base::Time& expiration_time) { |
| 168 RequestIterator it = requests_.begin(); | 168 RequestIterator it = requests_.begin(); |
| 169 while (it != requests_.end()) { | 169 while (it != requests_.end()) { |
| 170 if (request == (*it)->access_token_request.get()) | 170 if (request == (*it)->access_token_request.get()) |
| 171 break; | 171 break; |
| 172 ++it; | 172 ++it; |
| 173 } | 173 } |
| 174 DCHECK(it != requests_.end()); | 174 DCHECK(it != requests_.end()); |
| 175 (*it)->access_token = access_token; | 175 (*it)->access_token = access_token; |
| 176 | 176 |
| 177 (*it)->url_fetcher.reset(URLFetcher::Create((*it)->url_fetcher_id, | 177 (*it)->url_fetcher = URLFetcher::Create((*it)->url_fetcher_id, GetApiUrl(), |
| 178 GetApiUrl(), | 178 URLFetcher::POST, this); |
| 179 URLFetcher::POST, | |
| 180 this)); | |
| 181 | 179 |
| 182 (*it)->url_fetcher->SetRequestContext(context_); | 180 (*it)->url_fetcher->SetRequestContext(context_); |
| 183 (*it)->url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 181 (*it)->url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 184 net::LOAD_DO_NOT_SAVE_COOKIES); | 182 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 185 (*it)->url_fetcher->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); | 183 (*it)->url_fetcher->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); |
| 186 (*it)->url_fetcher->AddExtraRequestHeader( | 184 (*it)->url_fetcher->AddExtraRequestHeader( |
| 187 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 185 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
| 188 | 186 |
| 189 base::DictionaryValue dict; | 187 base::DictionaryValue dict; |
| 190 dict.SetStringWithoutPathExpansion(kEventTypeKey, (*it)->request_type); | 188 dict.SetStringWithoutPathExpansion(kEventTypeKey, (*it)->request_type); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 it, GoogleServiceAuthError::FromConnectionError(error_code)); | 274 it, GoogleServiceAuthError::FromConnectionError(error_code)); |
| 277 } | 275 } |
| 278 | 276 |
| 279 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( | 277 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( |
| 280 RequestIterator it, | 278 RequestIterator it, |
| 281 const GoogleServiceAuthError& error) { | 279 const GoogleServiceAuthError& error) { |
| 282 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); | 280 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); |
| 283 (*it)->callback.Run(false); | 281 (*it)->callback.Run(false); |
| 284 requests_.erase(it); | 282 requests_.erase(it); |
| 285 } | 283 } |
| OLD | NEW |