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_provider.h" | 5 #include "chromeos/geolocation/simple_geolocation_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/time/time.h" | |
12 #include "chromeos/geolocation/geoposition.h" | 11 #include "chromeos/geolocation/geoposition.h" |
13 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
14 #include "url/gurl.h" | |
15 | 13 |
16 namespace chromeos { | 14 namespace chromeos { |
17 | 15 |
18 namespace { | 16 namespace { |
19 const char kDefaultGeolocationProviderUrl[] = | 17 const char kDefaultGeolocationProviderUrl[] = |
20 "https://www.googleapis.com/geolocation/v1/geolocate?"; | 18 "https://www.googleapis.com/geolocation/v1/geolocate?"; |
21 } // namespace | 19 } // namespace |
22 | 20 |
23 SimpleGeolocationProvider::SimpleGeolocationProvider( | 21 SimpleGeolocationProvider::SimpleGeolocationProvider( |
24 net::URLRequestContextGetter* url_context_getter, | 22 net::URLRequestContextGetter* url_context_getter, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 62 |
65 callback.Run(geoposition, server_error, elapsed); | 63 callback.Run(geoposition, server_error, elapsed); |
66 | 64 |
67 ScopedVector<SimpleGeolocationRequest>::iterator new_end = | 65 ScopedVector<SimpleGeolocationRequest>::iterator new_end = |
68 std::remove(requests_.begin(), requests_.end(), request); | 66 std::remove(requests_.begin(), requests_.end(), request); |
69 DCHECK_EQ(std::distance(new_end, requests_.end()), 1); | 67 DCHECK_EQ(std::distance(new_end, requests_.end()), 1); |
70 requests_.erase(new_end, requests_.end()); | 68 requests_.erase(new_end, requests_.end()); |
71 } | 69 } |
72 | 70 |
73 } // namespace chromeos | 71 } // namespace chromeos |
OLD | NEW |