| 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 #ifndef DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ | 5 #ifndef DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ |
| 6 #define DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ | 6 #define DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "device/geolocation/geolocation_export.h" | 10 #include "device/geolocation/geolocation_export.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Creates a GeolocationServiceImpl that is weakly bound to |request|. | 26 // Creates a GeolocationServiceImpl that is weakly bound to |request|. |
| 27 // |update_callback| will be called when services send | 27 // |update_callback| will be called when services send |
| 28 // location updates to their clients. | 28 // location updates to their clients. |
| 29 void CreateService(const base::Closure& update_callback, | 29 void CreateService(const base::Closure& update_callback, |
| 30 mojo::InterfaceRequest<mojom::GeolocationService> request); | 30 mojo::InterfaceRequest<mojom::GeolocationService> request); |
| 31 | 31 |
| 32 // Called when a service has a connection error. After this call, it is no | 32 // Called when a service has a connection error. After this call, it is no |
| 33 // longer safe to access |service|. | 33 // longer safe to access |service|. |
| 34 void ServiceHadConnectionError(GeolocationServiceImpl* service); | 34 void ServiceHadConnectionError(GeolocationServiceImpl* service); |
| 35 | 35 |
| 36 // Pauses and resumes geolocation. Resuming when nothing is paused is a | |
| 37 // no-op. If a service is added while geolocation is paused, that service | |
| 38 // will not get geolocation updates until geolocation is resumed. | |
| 39 void PauseUpdates(); | |
| 40 void ResumeUpdates(); | |
| 41 | |
| 42 // Returns whether geolocation updates are currently paused. | |
| 43 bool paused() { return paused_; } | |
| 44 | |
| 45 // Enables geolocation override. This method can be used to trigger possible | 36 // Enables geolocation override. This method can be used to trigger possible |
| 46 // location-specific behavior in a particular context. | 37 // location-specific behavior in a particular context. |
| 47 void SetOverride(std::unique_ptr<Geoposition> geoposition); | 38 void SetOverride(std::unique_ptr<Geoposition> geoposition); |
| 48 | 39 |
| 49 // Disables geolocation override. | 40 // Disables geolocation override. |
| 50 void ClearOverride(); | 41 void ClearOverride(); |
| 51 | 42 |
| 52 private: | 43 private: |
| 53 ScopedVector<GeolocationServiceImpl> services_; | 44 ScopedVector<GeolocationServiceImpl> services_; |
| 54 bool paused_; | |
| 55 | 45 |
| 56 std::unique_ptr<Geoposition> geoposition_override_; | 46 std::unique_ptr<Geoposition> geoposition_override_; |
| 57 | 47 |
| 58 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); | 48 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); |
| 59 }; | 49 }; |
| 60 | 50 |
| 61 } // namespace device | 51 } // namespace device |
| 62 | 52 |
| 63 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ | 53 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ |
| OLD | NEW |