| 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/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "content/common/net/url_fetcher_impl.h" | |
| 16 #include "content/public/common/geoposition.h" | 15 #include "content/public/common/geoposition.h" |
| 16 #include "content/public/common/url_fetcher.h" |
| 17 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 18 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 20 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const size_t kMaxRequestLength = 2048; | 24 const size_t kMaxRequestLength = 2048; |
| 25 | 25 |
| 26 const char kAccessTokenString[] = "access_token"; | 26 const char kAccessTokenString[] = "access_token"; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (url_fetcher_ != NULL) { | 80 if (url_fetcher_ != NULL) { |
| 81 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; | 81 DVLOG(1) << "NetworkLocationRequest : Cancelling pending request"; |
| 82 url_fetcher_.reset(); | 82 url_fetcher_.reset(); |
| 83 } | 83 } |
| 84 radio_data_ = radio_data; | 84 radio_data_ = radio_data; |
| 85 wifi_data_ = wifi_data; | 85 wifi_data_ = wifi_data; |
| 86 timestamp_ = timestamp; | 86 timestamp_ = timestamp; |
| 87 | 87 |
| 88 GURL request_url = FormRequestURL(url_.spec(), access_token, | 88 GURL request_url = FormRequestURL(url_.spec(), access_token, |
| 89 wifi_data, timestamp_); | 89 wifi_data, timestamp_); |
| 90 url_fetcher_.reset(URLFetcherImpl::Create( | 90 url_fetcher_.reset(content::URLFetcher::Create( |
| 91 url_fetcher_id_for_tests, request_url, URLFetcherImpl::GET, this)); | 91 url_fetcher_id_for_tests, request_url, net::URLFetcher::GET, this)); |
| 92 url_fetcher_->SetRequestContext(url_context_); | 92 url_fetcher_->SetRequestContext(url_context_); |
| 93 url_fetcher_->SetLoadFlags( | 93 url_fetcher_->SetLoadFlags( |
| 94 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | | 94 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | |
| 95 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | | 95 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | |
| 96 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 96 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 97 | 97 |
| 98 url_fetcher_->Start(); | 98 url_fetcher_->Start(); |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 position->longitude = longitude; | 408 position->longitude = longitude; |
| 409 position->timestamp = timestamp; | 409 position->timestamp = timestamp; |
| 410 | 410 |
| 411 // Other fields are optional. | 411 // Other fields are optional. |
| 412 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 412 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
| 413 | 413 |
| 414 return true; | 414 return true; |
| 415 } | 415 } |
| 416 | 416 |
| 417 } // namespace | 417 } // namespace |
| OLD | NEW |