| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/geolocation/simple_geolocation_request.h" | 5 #include "chrome/browser/chromeos/geolocation/simple_geolocation_request.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 void SimpleGeolocationRequest::StartRequest() { | 295 void SimpleGeolocationRequest::StartRequest() { |
| 296 DCHECK(thread_checker_.CalledOnValidThread()); | 296 DCHECK(thread_checker_.CalledOnValidThread()); |
| 297 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_REQUEST_START); | 297 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_REQUEST_START); |
| 298 ++retries_; | 298 ++retries_; |
| 299 | 299 |
| 300 url_fetcher_.reset( | 300 url_fetcher_.reset( |
| 301 net::URLFetcher::Create(request_url_, net::URLFetcher::POST, this)); | 301 net::URLFetcher::Create(request_url_, net::URLFetcher::POST, this)); |
| 302 url_fetcher_->SetRequestContext(url_context_getter_); | 302 url_fetcher_->SetRequestContext(url_context_getter_.get()); |
| 303 url_fetcher_->SetUploadData("application/json", | 303 url_fetcher_->SetUploadData("application/json", |
| 304 std::string(kSimpleGeolocationRequestBody)); | 304 std::string(kSimpleGeolocationRequestBody)); |
| 305 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | | 305 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | |
| 306 net::LOAD_DISABLE_CACHE | | 306 net::LOAD_DISABLE_CACHE | |
| 307 net::LOAD_DO_NOT_SAVE_COOKIES | | 307 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 308 net::LOAD_DO_NOT_SEND_COOKIES | | 308 net::LOAD_DO_NOT_SEND_COOKIES | |
| 309 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 309 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 310 url_fetcher_->Start(); | 310 url_fetcher_->Start(); |
| 311 } | 311 } |
| 312 | 312 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR | 383 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR |
| 384 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); | 384 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); |
| 385 RecordUmaResult(result, retries_); | 385 RecordUmaResult(result, retries_); |
| 386 position_.status = Geoposition::STATUS_TIMEOUT; | 386 position_.status = Geoposition::STATUS_TIMEOUT; |
| 387 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; | 387 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; |
| 388 ReplyAndDestroySelf(elapsed, true /* server_error */); | 388 ReplyAndDestroySelf(elapsed, true /* server_error */); |
| 389 // "this" is already destroyed here. | 389 // "this" is already destroyed here. |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace chromeos | 392 } // namespace chromeos |
| OLD | NEW |