OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 8 |
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 AddInteger("snr:", (*iter)->signal_to_noise, &wifi_params); | 213 AddInteger("snr:", (*iter)->signal_to_noise, &wifi_params); |
214 std::string ssid = UTF16ToUTF8((*iter)->ssid); | 214 std::string ssid = UTF16ToUTF8((*iter)->ssid); |
215 // Backslash characters in the ssid need backslash-escaping to avoid | 215 // Backslash characters in the ssid need backslash-escaping to avoid |
216 // escaping a following wifi parameter separator. | 216 // escaping a following wifi parameter separator. |
217 ReplaceSubstringsAfterOffset(&ssid, 0, "\\", "\\\\"); | 217 ReplaceSubstringsAfterOffset(&ssid, 0, "\\", "\\\\"); |
218 // Pipe characters in the ssid need backslash-escaping to avoid being | 218 // Pipe characters in the ssid need backslash-escaping to avoid being |
219 // interpreted as the wifi parameter separator. | 219 // interpreted as the wifi parameter separator. |
220 ReplaceSubstringsAfterOffset(&ssid, 0, "|", "\\|"); | 220 ReplaceSubstringsAfterOffset(&ssid, 0, "|", "\\|"); |
221 AddString("ssid:", ssid, &wifi_params); | 221 AddString("ssid:", ssid, &wifi_params); |
222 params->push_back( | 222 params->push_back( |
223 "wifi=" + EscapeQueryParamValue(wifi_params, false)); | 223 "wifi=" + net::EscapeQueryParamValue(wifi_params, false)); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 void FormatPositionError(const GURL& server_url, | 227 void FormatPositionError(const GURL& server_url, |
228 const std::string& message, | 228 const std::string& message, |
229 Geoposition* position) { | 229 Geoposition* position) { |
230 position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; | 230 position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; |
231 position->error_message = "Network location provider at '"; | 231 position->error_message = "Network location provider at '"; |
232 position->error_message += server_url.possibly_invalid_spec(); | 232 position->error_message += server_url.possibly_invalid_spec(); |
233 position->error_message += "' : "; | 233 position->error_message += "' : "; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 position->longitude = longitude; | 395 position->longitude = longitude; |
396 position->timestamp = timestamp; | 396 position->timestamp = timestamp; |
397 | 397 |
398 // Other fields are optional. | 398 // Other fields are optional. |
399 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 399 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
400 | 400 |
401 return true; | 401 return true; |
402 } | 402 } |
403 | 403 |
404 } // namespace | 404 } // namespace |
OLD | NEW |