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 | 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_impl.h" | 15 #include "content/common/net/url_fetcher_impl.h" |
| 16 #include "content/public/common/content_url_request_user_data.h" |
16 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
17 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
19 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 const size_t kMaxRequestLength = 2048; | 24 const size_t kMaxRequestLength = 2048; |
24 | 25 |
25 const char kAccessTokenString[] = "access_token"; | 26 const char kAccessTokenString[] = "access_token"; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 84 } |
84 radio_data_ = radio_data; | 85 radio_data_ = radio_data; |
85 wifi_data_ = wifi_data; | 86 wifi_data_ = wifi_data; |
86 timestamp_ = timestamp; | 87 timestamp_ = timestamp; |
87 | 88 |
88 GURL request_url = FormRequestURL(url_.spec(), access_token, | 89 GURL request_url = FormRequestURL(url_.spec(), access_token, |
89 wifi_data, timestamp_); | 90 wifi_data, timestamp_); |
90 url_fetcher_.reset(URLFetcherImpl::Create( | 91 url_fetcher_.reset(URLFetcherImpl::Create( |
91 url_fetcher_id_for_tests, request_url, URLFetcherImpl::GET, this)); | 92 url_fetcher_id_for_tests, request_url, URLFetcherImpl::GET, this)); |
92 url_fetcher_->SetRequestContext(url_context_); | 93 url_fetcher_->SetRequestContext(url_context_); |
| 94 // No user data, as the request will be cookie-less. |
| 95 url_fetcher_->SetContentURLRequestUserData( |
| 96 new content::ContentURLRequestUserData()); |
93 url_fetcher_->SetLoadFlags( | 97 url_fetcher_->SetLoadFlags( |
94 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | | 98 net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | |
95 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | | 99 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | |
96 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 100 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
97 | 101 |
98 url_fetcher_->Start(); | 102 url_fetcher_->Start(); |
99 return true; | 103 return true; |
100 } | 104 } |
101 | 105 |
102 void NetworkLocationRequest::OnURLFetchComplete( | 106 void NetworkLocationRequest::OnURLFetchComplete( |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 position->longitude = longitude; | 410 position->longitude = longitude; |
407 position->timestamp = timestamp; | 411 position->timestamp = timestamp; |
408 | 412 |
409 // Other fields are optional. | 413 // Other fields are optional. |
410 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 414 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
411 | 415 |
412 return true; | 416 return true; |
413 } | 417 } |
414 | 418 |
415 } // namespace | 419 } // namespace |
OLD | NEW |