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" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "content/common/geoposition.h" | 14 #include "content/common/geoposition.h" |
15 #include "content/common/net/url_fetcher.h" | 15 #include "content/common/net/url_fetcher_impl.h" |
16 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
17 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
18 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const size_t kMaxRequestLength = 2048; | 23 const size_t kMaxRequestLength = 2048; |
24 | 24 |
25 const char kAccessTokenString[] = "access_token"; | 25 const char kAccessTokenString[] = "access_token"; |
(...skipping 54 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(URLFetcher::Create( | 90 url_fetcher_.reset(URLFetcherImpl::Create( |
91 url_fetcher_id_for_tests, request_url, URLFetcher::GET, this)); | 91 url_fetcher_id_for_tests, request_url, URLFetcherImpl::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 299 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 |