| 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/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 17 #include "content/browser/geolocation/location_arbitrator_impl.h" | 18 #include "content/browser/geolocation/location_arbitrator_impl.h" |
| 18 #include "content/public/common/geoposition.h" | 19 #include "content/public/common/geoposition.h" |
| 19 #include "google_apis/google_api_keys.h" | 20 #include "google_apis/google_api_keys.h" |
| 20 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
| 21 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
| 22 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
| 23 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 24 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; | 119 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; |
| 119 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL); | 120 RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL); |
| 120 url_fetcher_.reset(); | 121 url_fetcher_.reset(); |
| 121 } | 122 } |
| 122 wifi_data_ = wifi_data; | 123 wifi_data_ = wifi_data; |
| 123 wifi_data_timestamp_ = timestamp; | 124 wifi_data_timestamp_ = timestamp; |
| 124 | 125 |
| 125 GURL request_url = FormRequestURL(url_); | 126 GURL request_url = FormRequestURL(url_); |
| 126 url_fetcher_ = net::URLFetcher::Create(url_fetcher_id_for_tests, request_url, | 127 url_fetcher_ = net::URLFetcher::Create(url_fetcher_id_for_tests, request_url, |
| 127 net::URLFetcher::POST, this); | 128 net::URLFetcher::POST, this); |
| 129 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 130 url_fetcher_.get(), data_use_measurement::DataUseUserData::GEO_LOCATION); |
| 128 url_fetcher_->SetRequestContext(url_context_.get()); | 131 url_fetcher_->SetRequestContext(url_context_.get()); |
| 129 std::string upload_data; | 132 std::string upload_data; |
| 130 FormUploadData(wifi_data, timestamp, access_token, &upload_data); | 133 FormUploadData(wifi_data, timestamp, access_token, &upload_data); |
| 131 url_fetcher_->SetUploadData("application/json", upload_data); | 134 url_fetcher_->SetUploadData("application/json", upload_data); |
| 132 url_fetcher_->SetLoadFlags( | 135 url_fetcher_->SetLoadFlags( |
| 133 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | | 136 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | |
| 134 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | | 137 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | |
| 135 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 138 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 136 | 139 |
| 137 request_start_time_ = base::TimeTicks::Now(); | 140 request_start_time_ = base::TimeTicks::Now(); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 427 |
| 425 // Other fields are optional. | 428 // Other fields are optional. |
| 426 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 429 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
| 427 | 430 |
| 428 return true; | 431 return true; |
| 429 } | 432 } |
| 430 | 433 |
| 431 } // namespace | 434 } // namespace |
| 432 | 435 |
| 433 } // namespace content | 436 } // namespace content |
| OLD | NEW |