| OLD | NEW |
| 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 "device/geolocation/network_location_request.h" | 5 #include "device/geolocation/network_location_request.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "device/geolocation/geoposition.h" | 20 #include "device/geolocation/geoposition.h" |
| 21 #include "device/geolocation/location_arbitrator_impl.h" | 21 #include "device/geolocation/location_arbitrator.h" |
| 22 #include "google_apis/google_api_keys.h" | 22 #include "google_apis/google_api_keys.h" |
| 23 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
| 24 #include "net/base/load_flags.h" | 24 #include "net/base/load_flags.h" |
| 25 #include "net/url_request/url_fetcher.h" | 25 #include "net/url_request/url_fetcher.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
| 27 #include "net/url_request/url_request_status.h" | 27 #include "net/url_request/url_request_status.h" |
| 28 | 28 |
| 29 namespace device { | 29 namespace device { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 namespace { | 176 namespace { |
| 177 | 177 |
| 178 struct AccessPointLess { | 178 struct AccessPointLess { |
| 179 bool operator()(const AccessPointData* ap1, | 179 bool operator()(const AccessPointData* ap1, |
| 180 const AccessPointData* ap2) const { | 180 const AccessPointData* ap2) const { |
| 181 return ap2->radio_signal_strength < ap1->radio_signal_strength; | 181 return ap2->radio_signal_strength < ap1->radio_signal_strength; |
| 182 } | 182 } |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 GURL FormRequestURL(const GURL& url) { | 185 GURL FormRequestURL(const GURL& url) { |
| 186 if (url == LocationArbitratorImpl::DefaultNetworkProviderURL()) { | 186 if (url == LocationArbitrator::DefaultNetworkProviderURL()) { |
| 187 std::string api_key = google_apis::GetAPIKey(); | 187 std::string api_key = google_apis::GetAPIKey(); |
| 188 if (!api_key.empty()) { | 188 if (!api_key.empty()) { |
| 189 std::string query(url.query()); | 189 std::string query(url.query()); |
| 190 if (!query.empty()) | 190 if (!query.empty()) |
| 191 query += "&"; | 191 query += "&"; |
| 192 query += "key=" + net::EscapeQueryParamValue(api_key, true); | 192 query += "key=" + net::EscapeQueryParamValue(api_key, true); |
| 193 GURL::Replacements replacements; | 193 GURL::Replacements replacements; |
| 194 replacements.SetQueryStr(query); | 194 replacements.SetQueryStr(query); |
| 195 return url.ReplaceComponents(replacements); | 195 return url.ReplaceComponents(replacements); |
| 196 } | 196 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // Other fields are optional. | 414 // Other fields are optional. |
| 415 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 415 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
| 416 | 416 |
| 417 return true; | 417 return true; |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace | 420 } // namespace |
| 421 | 421 |
| 422 } // namespace device | 422 } // namespace device |
| OLD | NEW |