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 "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" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "content/browser/geolocation/location_arbitrator.h" | 16 #include "content/browser/geolocation/location_arbitrator_impl.h" |
17 #include "content/public/common/geoposition.h" | 17 #include "content/public/common/geoposition.h" |
18 #include "google_apis/google_api_keys.h" | 18 #include "google_apis/google_api_keys.h" |
19 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
20 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
21 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
22 #include "net/url_request/url_request_context_getter.h" | 22 #include "net/url_request/url_request_context_getter.h" |
23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 namespace { | 26 namespace { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 namespace { | 149 namespace { |
150 | 150 |
151 struct AccessPointLess { | 151 struct AccessPointLess { |
152 bool operator()(const AccessPointData* ap1, | 152 bool operator()(const AccessPointData* ap1, |
153 const AccessPointData* ap2) const { | 153 const AccessPointData* ap2) const { |
154 return ap2->radio_signal_strength < ap1->radio_signal_strength; | 154 return ap2->radio_signal_strength < ap1->radio_signal_strength; |
155 } | 155 } |
156 }; | 156 }; |
157 | 157 |
158 GURL FormRequestURL(const GURL& url) { | 158 GURL FormRequestURL(const GURL& url) { |
159 if (url == GeolocationArbitrator::DefaultNetworkProviderURL()) { | 159 if (url == GeolocationArbitratorImpl::DefaultNetworkProviderURL()) { |
160 std::string api_key = google_apis::GetAPIKey(); | 160 std::string api_key = google_apis::GetAPIKey(); |
161 if (!api_key.empty()) { | 161 if (!api_key.empty()) { |
162 std::string query(url.query()); | 162 std::string query(url.query()); |
163 if (!query.empty()) | 163 if (!query.empty()) |
164 query += "&"; | 164 query += "&"; |
165 query += "key=" + net::EscapeQueryParamValue(api_key, true); | 165 query += "key=" + net::EscapeQueryParamValue(api_key, true); |
166 GURL::Replacements replacements; | 166 GURL::Replacements replacements; |
167 replacements.SetQueryStr(query); | 167 replacements.SetQueryStr(query); |
168 return url.ReplaceComponents(replacements); | 168 return url.ReplaceComponents(replacements); |
169 } | 169 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 // Other fields are optional. | 384 // Other fields are optional. |
385 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 385 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
386 | 386 |
387 return true; | 387 return true; |
388 } | 388 } |
389 | 389 |
390 } // namespace | 390 } // namespace |
391 | 391 |
392 } // namespace content | 392 } // namespace content |
OLD | NEW |