Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/memory/scoped_ptr.h" | |
| 6 #include "content/browser/geolocation/geolocation_provider_impl.h" | |
| 7 #include "content/common/geolocation_service.mojom.h" | |
| 8 | |
| 9 #ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_H_ | |
| 10 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_H_ | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class GeolocationProvider; | |
| 15 class GeolocationServiceImplContext; | |
| 16 | |
| 17 // Implements the GeolocationService Mojo interface. | |
| 18 class GeolocationServiceImpl : public mojo::InterfaceImpl<GeolocationService> { | |
|
Michael van Ouwerkerk
2014/10/08 14:13:08
Who owns this service? How many instances are ther
blundell
2014/10/09 08:32:52
The service was bound to the lifetime of the pipe
| |
| 19 public: | |
| 20 // |context| is the geolocation context in which created services should | |
| 21 // operate. |on_location_update_callback| will be called when services send | |
| 22 // location updates to their clients. | |
| 23 static void Create(GeolocationServiceImplContext* context, | |
| 24 const base::Closure& on_location_update_callback, | |
|
Michael van Ouwerkerk
2014/10/08 14:13:08
Nit: drop the on_ prefix. Or even: location_callba
blundell
2014/10/09 08:32:52
Changed to update_callback.
| |
| 25 mojo::InterfaceRequest<GeolocationService> request); | |
| 26 | |
| 27 // Pauses and resumes sending updates to the client of this instance. | |
| 28 void PauseUpdates(); | |
| 29 void ResumeUpdates(); | |
| 30 | |
| 31 private: | |
| 32 GeolocationServiceImpl(GeolocationServiceImplContext* context, | |
| 33 const base::Closure& on_location_update_callback); | |
| 34 virtual ~GeolocationServiceImpl(); | |
| 35 | |
| 36 // GeolocationService: | |
| 37 virtual void StartUpdating(bool high_accuracy) OVERRIDE; | |
| 38 | |
| 39 void StartListeningForUpdates(); | |
| 40 void OnLocationUpdate(const Geoposition& position); | |
| 41 | |
| 42 // Must outlive this object. | |
| 43 GeolocationServiceImplContext* context_; | |
|
Michael van Ouwerkerk
2014/10/08 14:13:08
I'm having a slow day. Service outlives context or
blundell
2014/10/09 08:32:52
Before, either could outlive the other, which as y
| |
| 44 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; | |
| 45 base::Closure on_location_update_callback_; | |
| 46 | |
| 47 // Whether this instance is currently observing location updates with high | |
| 48 // accuracy. | |
| 49 bool high_accuracy_; | |
| 50 }; | |
|
Michael van Ouwerkerk
2014/10/08 14:13:08
Does this need DISALLOW_COPY_AND_ASSIGN?
blundell
2014/10/09 08:32:52
Done.
| |
| 51 | |
| 52 } // namespace content | |
| 53 | |
| 54 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_H_ | |
| OLD | NEW |