Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698