| 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 "chromeos/geolocation/simple_geolocation_request.h" | 5 #include "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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chromeos/geolocation/geoposition.h" | |
| 18 #include "chromeos/geolocation/simple_geolocation_provider.h" | 17 #include "chromeos/geolocation/simple_geolocation_provider.h" |
| 19 #include "google_apis/google_api_keys.h" | 18 #include "google_apis/google_api_keys.h" |
| 20 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
| 21 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
| 22 #include "net/http/http_status_code.h" | 21 #include "net/http/http_status_code.h" |
| 23 #include "net/url_request/url_fetcher.h" | |
| 24 #include "net/url_request/url_request_context_getter.h" | 22 #include "net/url_request/url_request_context_getter.h" |
| 25 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
| 26 | 24 |
| 27 // Location resolve timeout is usually 1 minute, so 2 minutes with 50 buckets | 25 // Location resolve timeout is usually 1 minute, so 2 minutes with 50 buckets |
| 28 // should be enough. | 26 // should be enough. |
| 29 #define UMA_HISTOGRAM_LOCATION_RESPONSE_TIMES(name, sample) \ | 27 #define UMA_HISTOGRAM_LOCATION_RESPONSE_TIMES(name, sample) \ |
| 30 UMA_HISTOGRAM_CUSTOM_TIMES(name, \ | 28 UMA_HISTOGRAM_CUSTOM_TIMES(name, \ |
| 31 sample, \ | 29 sample, \ |
| 32 base::TimeDelta::FromMilliseconds(10), \ | 30 base::TimeDelta::FromMilliseconds(10), \ |
| 33 base::TimeDelta::FromMinutes(2), \ | 31 base::TimeDelta::FromMinutes(2), \ |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR | 381 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR |
| 384 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); | 382 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); |
| 385 RecordUmaResult(result, retries_); | 383 RecordUmaResult(result, retries_); |
| 386 position_.status = Geoposition::STATUS_TIMEOUT; | 384 position_.status = Geoposition::STATUS_TIMEOUT; |
| 387 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; | 385 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; |
| 388 ReplyAndDestroySelf(elapsed, true /* server_error */); | 386 ReplyAndDestroySelf(elapsed, true /* server_error */); |
| 389 // "this" is already destroyed here. | 387 // "this" is already destroyed here. |
| 390 } | 388 } |
| 391 | 389 |
| 392 } // namespace chromeos | 390 } // namespace chromeos |
| OLD | NEW |