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 <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "device/geolocation/geolocation_export.h" | 12 #include "device/geolocation/geolocation_export.h" |
13 #include "device/geolocation/public/interfaces/geolocation.mojom.h" | 13 #include "device/geolocation/public/interfaces/geolocation.mojom.h" |
14 | 14 |
| 15 namespace service_manager { |
| 16 struct BindSourceInfo; |
| 17 } |
| 18 |
15 namespace device { | 19 namespace device { |
16 | 20 |
17 class GeolocationServiceImpl; | 21 class GeolocationServiceImpl; |
18 struct Geoposition; | 22 struct Geoposition; |
19 | 23 |
20 // Provides information to a set of GeolocationServiceImpl instances that are | 24 // Provides information to a set of GeolocationServiceImpl instances that are |
21 // associated with a given context. Notably, allows pausing and resuming | 25 // associated with a given context. Notably, allows pausing and resuming |
22 // geolocation on these instances. | 26 // geolocation on these instances. |
23 class DEVICE_GEOLOCATION_EXPORT GeolocationServiceContext { | 27 class DEVICE_GEOLOCATION_EXPORT GeolocationServiceContext { |
24 public: | 28 public: |
25 GeolocationServiceContext(); | 29 GeolocationServiceContext(); |
26 virtual ~GeolocationServiceContext(); | 30 virtual ~GeolocationServiceContext(); |
27 | 31 |
28 // Creates a GeolocationServiceImpl that is weakly bound to |request|. | 32 // Creates a GeolocationServiceImpl that is weakly bound to |request|. |
29 void CreateService(mojo::InterfaceRequest<mojom::GeolocationService> request); | 33 void CreateService(const service_manager::BindSourceInfo& source_info, |
| 34 mojom::GeolocationServiceRequest request); |
30 | 35 |
31 // Called when a service has a connection error. After this call, it is no | 36 // Called when a service has a connection error. After this call, it is no |
32 // longer safe to access |service|. | 37 // longer safe to access |service|. |
33 void ServiceHadConnectionError(GeolocationServiceImpl* service); | 38 void ServiceHadConnectionError(GeolocationServiceImpl* service); |
34 | 39 |
35 // Enables geolocation override. This method can be used to trigger possible | 40 // Enables geolocation override. This method can be used to trigger possible |
36 // location-specific behavior in a particular context. | 41 // location-specific behavior in a particular context. |
37 void SetOverride(std::unique_ptr<Geoposition> geoposition); | 42 void SetOverride(std::unique_ptr<Geoposition> geoposition); |
38 | 43 |
39 // Disables geolocation override. | 44 // Disables geolocation override. |
40 void ClearOverride(); | 45 void ClearOverride(); |
41 | 46 |
42 private: | 47 private: |
43 std::vector<std::unique_ptr<GeolocationServiceImpl>> services_; | 48 std::vector<std::unique_ptr<GeolocationServiceImpl>> services_; |
44 | 49 |
45 std::unique_ptr<Geoposition> geoposition_override_; | 50 std::unique_ptr<Geoposition> geoposition_override_; |
46 | 51 |
47 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); | 52 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext); |
48 }; | 53 }; |
49 | 54 |
50 } // namespace device | 55 } // namespace device |
51 | 56 |
52 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ | 57 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_ |
OLD | NEW |