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

Side by Side Diff: chrome/browser/geolocation/network_location_request.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/geolocation/network_location_request.h" 5 #include "chrome/browser/geolocation/network_location_request.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/string_util.h" 9 #include "base/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/geoposition.h" 11 #include "chrome/common/geoposition.h"
12 #include "chrome/common/net/url_request_context_getter.h" 12 #include "chrome/common/net/url_request_context_getter.h"
13 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
14 #include "net/url_request/url_request_status.h" 14 #include "net/url_request/url_request_status.h"
15 15
16 namespace { 16 namespace {
17 const char kMimeApplicationJson[] = "application/json"; 17 const char kMimeApplicationJson[] = "application/json";
18 18
19 // See http://code.google.com/apis/gears/geolocation_network_protocol.html 19 // See http://code.google.com/apis/gears/geolocation_network_protocol.html
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 DCHECK(access_token); 195 DCHECK(access_token);
196 196
197 // HttpPost can fail for a number of reasons. Most likely this is because 197 // HttpPost can fail for a number of reasons. Most likely this is because
198 // we're offline, or there was no response. 198 // we're offline, or there was no response.
199 if (!http_post_result) { 199 if (!http_post_result) {
200 FormatPositionError(server_url, "No response received", position); 200 FormatPositionError(server_url, "No response received", position);
201 return; 201 return;
202 } 202 }
203 if (status_code != 200) { // HTTP OK. 203 if (status_code != 200) { // HTTP OK.
204 std::string message = "Returned error code "; 204 std::string message = "Returned error code ";
205 message += IntToString(status_code); 205 message += base::IntToString(status_code);
206 FormatPositionError(server_url, message, position); 206 FormatPositionError(server_url, message, position);
207 return; 207 return;
208 } 208 }
209 // We use the timestamp from the device data that was used to generate 209 // We use the timestamp from the device data that was used to generate
210 // this position fix. 210 // this position fix.
211 if (!ParseServerResponse(response_body, timestamp, position, access_token)) { 211 if (!ParseServerResponse(response_body, timestamp, position, access_token)) {
212 // We failed to parse the repsonse. 212 // We failed to parse the repsonse.
213 FormatPositionError(server_url, "Response was malformed", position); 213 FormatPositionError(server_url, "Response was malformed", position);
214 return; 214 return;
215 } 215 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower); 414 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower);
415 AddInteger(L"age", age_milliseconds, wifi_tower); 415 AddInteger(L"age", age_milliseconds, wifi_tower);
416 AddInteger(L"channel", iter->channel, wifi_tower); 416 AddInteger(L"channel", iter->channel, wifi_tower);
417 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower); 417 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower);
418 AddString(L"ssid", iter->ssid, wifi_tower); 418 AddString(L"ssid", iter->ssid, wifi_tower);
419 wifi_towers->Append(wifi_tower); 419 wifi_towers->Append(wifi_tower);
420 } 420 }
421 body_object->Set(L"wifi_towers", wifi_towers); 421 body_object->Set(L"wifi_towers", wifi_towers);
422 } 422 }
423 } // namespace 423 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater_unittest.cc ('k') | chrome/browser/gtk/download_in_progress_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698