| 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/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "content/browser/geolocation/location_arbitrator_impl.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 { |
| 27 | 27 |
| 28 const size_t kMaxRequestLength = 2048; | |
| 29 | |
| 30 const char kAccessTokenString[] = "accessToken"; | 28 const char kAccessTokenString[] = "accessToken"; |
| 31 const char kLocationString[] = "location"; | 29 const char kLocationString[] = "location"; |
| 32 const char kLatitudeString[] = "lat"; | 30 const char kLatitudeString[] = "lat"; |
| 33 const char kLongitudeString[] = "lng"; | 31 const char kLongitudeString[] = "lng"; |
| 34 const char kAccuracyString[] = "accuracy"; | 32 const char kAccuracyString[] = "accuracy"; |
| 35 const char kStatusString[] = "status"; | |
| 36 const char kStatusOKString[] = "OK"; | |
| 37 | 33 |
| 38 // Local functions | 34 // Local functions |
| 39 // Creates the request url to send to the server. | 35 // Creates the request url to send to the server. |
| 40 GURL FormRequestURL(const GURL& url); | 36 GURL FormRequestURL(const GURL& url); |
| 41 | 37 |
| 42 void FormUploadData(const WifiData& wifi_data, | 38 void FormUploadData(const WifiData& wifi_data, |
| 43 const base::Time& timestamp, | 39 const base::Time& timestamp, |
| 44 const string16& access_token, | 40 const string16& access_token, |
| 45 std::string* upload_data); | 41 std::string* upload_data); |
| 46 | 42 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 377 |
| 382 // Other fields are optional. | 378 // Other fields are optional. |
| 383 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 379 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
| 384 | 380 |
| 385 return true; | 381 return true; |
| 386 } | 382 } |
| 387 | 383 |
| 388 } // namespace | 384 } // namespace |
| 389 | 385 |
| 390 } // namespace content | 386 } // namespace content |
| OLD | NEW |