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

Side by Side Diff: content/browser/geolocation/network_location_request.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/geolocation/network_location_request.h" 5 #include "content/browser/geolocation/network_location_request.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Convert absolute timestamps into a relative age. 214 // Convert absolute timestamps into a relative age.
215 int64 delta_ms = (base::Time::Now() - timestamp).InMilliseconds(); 215 int64 delta_ms = (base::Time::Now() - timestamp).InMilliseconds();
216 if (delta_ms >= 0 && delta_ms < kint32max) 216 if (delta_ms >= 0 && delta_ms < kint32max)
217 age = static_cast<int>(delta_ms); 217 age = static_cast<int>(delta_ms);
218 } 218 }
219 219
220 base::DictionaryValue request; 220 base::DictionaryValue request;
221 AddWifiData(wifi_data, age, &request); 221 AddWifiData(wifi_data, age, &request);
222 if (!access_token.empty()) 222 if (!access_token.empty())
223 request.SetString(kAccessTokenString, access_token); 223 request.SetString(kAccessTokenString, access_token);
224 base::JSONWriter::Write(&request, upload_data); 224 base::JSONWriter::Write(request, upload_data);
225 } 225 }
226 226
227 void AddString(const std::string& property_name, const std::string& value, 227 void AddString(const std::string& property_name, const std::string& value,
228 base::DictionaryValue* dict) { 228 base::DictionaryValue* dict) {
229 DCHECK(dict); 229 DCHECK(dict);
230 if (!value.empty()) 230 if (!value.empty())
231 dict->SetString(property_name, value); 231 dict->SetString(property_name, value);
232 } 232 }
233 233
234 void AddInteger(const std::string& property_name, int value, 234 void AddInteger(const std::string& property_name, int value,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 // Other fields are optional. 424 // Other fields are optional.
425 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); 425 GetAsDouble(*response_object, kAccuracyString, &position->accuracy);
426 426
427 return true; 427 return true;
428 } 428 }
429 429
430 } // namespace 430 } // namespace
431 431
432 } // namespace content 432 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698