| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/geolocation/network_location_request.h" | 5 #include "chrome/browser/geolocation/network_location_request.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 url_fetcher_.reset(); | 82 url_fetcher_.reset(); |
| 83 } | 83 } |
| 84 std::string post_body; | 84 std::string post_body; |
| 85 if (!FormRequestBody(host_name_, access_token, radio_data, wifi_data, | 85 if (!FormRequestBody(host_name_, access_token, radio_data, wifi_data, |
| 86 &post_body)) { | 86 &post_body)) { |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 timestamp_ = timestamp; | 89 timestamp_ = timestamp; |
| 90 | 90 |
| 91 url_fetcher_.reset(URLFetcher::Create( | 91 url_fetcher_.reset(URLFetcher::Create( |
| 92 wifi_data.access_point_data.size(), // Used for testing | 92 host_name_.size(), // Used for testing |
| 93 url_, URLFetcher::POST, this)); | 93 url_, URLFetcher::POST, this)); |
| 94 url_fetcher_->set_upload_data(kMimeApplicationJson, post_body); | 94 url_fetcher_->set_upload_data(kMimeApplicationJson, post_body); |
| 95 url_fetcher_->set_request_context(url_context_); | 95 url_fetcher_->set_request_context(url_context_); |
| 96 url_fetcher_->Start(); | 96 url_fetcher_->Start(); |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void NetworkLocationRequest::OnURLFetchComplete(const URLFetcher* source, | 100 void NetworkLocationRequest::OnURLFetchComplete(const URLFetcher* source, |
| 101 const GURL& url, | 101 const GURL& url, |
| 102 const URLRequestStatus& status, | 102 const URLRequestStatus& status, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower); | 395 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower); |
| 396 AddInteger(L"age", iter->age, wifi_tower); | 396 AddInteger(L"age", iter->age, wifi_tower); |
| 397 AddInteger(L"channel", iter->channel, wifi_tower); | 397 AddInteger(L"channel", iter->channel, wifi_tower); |
| 398 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower); | 398 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower); |
| 399 AddString(L"ssid", iter->ssid, wifi_tower); | 399 AddString(L"ssid", iter->ssid, wifi_tower); |
| 400 wifi_towers->Append(wifi_tower); | 400 wifi_towers->Append(wifi_tower); |
| 401 } | 401 } |
| 402 body_object->Set(L"wifi_towers", wifi_towers); | 402 body_object->Set(L"wifi_towers", wifi_towers); |
| 403 } | 403 } |
| 404 } // namespace | 404 } // namespace |
| OLD | NEW |