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 "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 "chrome/browser/chromeos/geolocation/geoposition.h" | 17 #include "chromeos/geolocation/geoposition.h" |
18 #include "chrome/browser/chromeos/geolocation/simple_geolocation_provider.h" | 18 #include "chromeos/geolocation/simple_geolocation_provider.h" |
19 #include "google_apis/google_api_keys.h" | 19 #include "google_apis/google_api_keys.h" |
20 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
21 #include "net/base/load_flags.h" | 21 #include "net/base/load_flags.h" |
22 #include "net/http/http_status_code.h" | 22 #include "net/http/http_status_code.h" |
23 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
25 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
26 | 26 |
27 // Location resolve timeout is usually 1 minute, so 2 minutes with 50 buckets | 27 // Location resolve timeout is usually 1 minute, so 2 minutes with 50 buckets |
28 // should be enough. | 28 // should be enough. |
(...skipping 354 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 |