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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 int response_code = source->GetResponseCode(); | 107 int response_code = source->GetResponseCode(); |
108 | 108 |
109 Geoposition position; | 109 Geoposition position; |
110 string16 access_token; | 110 string16 access_token; |
111 std::string data; | 111 std::string data; |
112 source->GetResponseAsString(&data); | 112 source->GetResponseAsString(&data); |
113 GetLocationFromResponse(status.is_success(), | 113 GetLocationFromResponse(status.is_success(), |
114 response_code, | 114 response_code, |
115 data, | 115 data, |
116 timestamp_, | 116 timestamp_, |
117 source->GetUrl(), | 117 source->GetURL(), |
118 &position, | 118 &position, |
119 &access_token); | 119 &access_token); |
120 const bool server_error = | 120 const bool server_error = |
121 !status.is_success() || (response_code >= 500 && response_code < 600); | 121 !status.is_success() || (response_code >= 500 && response_code < 600); |
122 url_fetcher_.reset(); | 122 url_fetcher_.reset(); |
123 | 123 |
124 DCHECK(listener_); | 124 DCHECK(listener_); |
125 DVLOG(1) << "NetworkLocationRequest::Run() : Calling listener with position."; | 125 DVLOG(1) << "NetworkLocationRequest::Run() : Calling listener with position."; |
126 listener_->LocationResponseAvailable(position, server_error, access_token, | 126 listener_->LocationResponseAvailable(position, server_error, access_token, |
127 radio_data_, wifi_data_); | 127 radio_data_, wifi_data_); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 position->longitude = longitude; | 401 position->longitude = longitude; |
402 position->timestamp = timestamp; | 402 position->timestamp = timestamp; |
403 | 403 |
404 // Other fields are optional. | 404 // Other fields are optional. |
405 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 405 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
406 | 406 |
407 return true; | 407 return true; |
408 } | 408 } |
409 | 409 |
410 } // namespace | 410 } // namespace |
OLD | NEW |