| 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" |
| 11 #include "third_party/WebKit/public/platform/modules/geolocation/geolocation.moj
om.h" | 11 #include "device/geolocation/public/interfaces/geolocation.mojom.h" |
| 12 | 12 |
| 13 namespace device { | 13 namespace device { |
| 14 | 14 |
| 15 class GeolocationServiceImpl; | 15 class GeolocationServiceImpl; |
| 16 struct Geoposition; | 16 struct Geoposition; |
| 17 | 17 |
| 18 // Provides information to a set of GeolocationServiceImpl instances that are | 18 // Provides information to a set of GeolocationServiceImpl instances that are |
| 19 // associated with a given context. Notably, allows pausing and resuming | 19 // associated with a given context. Notably, allows pausing and resuming |
| 20 // geolocation on these instances. | 20 // geolocation on these instances. |
| 21 class DEVICE_GEOLOCATION_EXPORT GeolocationServiceContext { | 21 class DEVICE_GEOLOCATION_EXPORT GeolocationServiceContext { |
| 22 public: | 22 public: |
| 23 GeolocationServiceContext(); | 23 GeolocationServiceContext(); |
| 24 virtual ~GeolocationServiceContext(); | 24 virtual ~GeolocationServiceContext(); |
| 25 | 25 |
| 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( | 29 void CreateService(const base::Closure& update_callback, |
| 30 const base::Closure& update_callback, | 30 mojo::InterfaceRequest<mojom::GeolocationService> request); |
| 31 mojo::InterfaceRequest<blink::mojom::GeolocationService> request); | |
| 32 | 31 |
| 33 // 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 |
| 34 // longer safe to access |service|. | 33 // longer safe to access |service|. |
| 35 void ServiceHadConnectionError(GeolocationServiceImpl* service); | 34 void ServiceHadConnectionError(GeolocationServiceImpl* service); |
| 36 | 35 |
| 37 // Pauses and resumes geolocation. Resuming when nothing is paused is a | 36 // Pauses and resumes geolocation. Resuming when nothing is paused is a |
| 38 // no-op. If a service is added while geolocation is paused, that service | 37 // no-op. If a service is added while geolocation is paused, that service |
| 39 // will not get geolocation updates until geolocation is resumed. | 38 // will not get geolocation updates until geolocation is resumed. |
| 40 void PauseUpdates(); | 39 void PauseUpdates(); |
| 41 void ResumeUpdates(); | 40 void ResumeUpdates(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 bool paused_; | 54 bool paused_; |
| 56 | 55 |
| 57 std::unique_ptr<Geoposition> geoposition_override_; | 56 std::unique_ptr<Geoposition> geoposition_override_; |
| 58 | 57 |
| 59 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); | 58 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 } // namespace device | 61 } // namespace device |
| 63 | 62 |
| 64 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ | 63 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ |
| OLD | NEW |