Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: content/browser/geolocation/geolocation_service_impl.h

Issue 628773003: Partially convert geolocation IPC to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to reviews, port override impl Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 GeolocationServiceContext;
16
17 // Implements the GeolocationService Mojo interface.
18 class GeolocationServiceImpl : public mojo::InterfaceImpl<GeolocationService> {
19 public:
20 // |context| must outlive this object. |update_callback| will be
21 // called when location updates are sent.
22 GeolocationServiceImpl(GeolocationServiceContext* context,
23 const base::Closure& update_callback);
24 virtual ~GeolocationServiceImpl();
25
26 // Pauses and resumes sending updates to the client of this instance.
27 void PauseUpdates();
28 void ResumeUpdates();
29
30 // Enables and disables geolocation override.
31 void SetOverride(const Geoposition& position);
32 void ClearOverride();
33
34 private:
35 // GeolocationService:
36 virtual void StartUpdating(bool high_accuracy) override;
37
38 // mojo::InterfaceImpl:
39 virtual void OnConnectionError() override;
40
41 void StartListeningForUpdates();
42 void OnLocationUpdate(const Geoposition& position);
43
44 // Owns this object.
45 GeolocationServiceContext* context_;
46 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_;
47 base::Closure update_callback_;
48
49 // Valid iff SetOverride() has been called and ClearOverride() has not
50 // subsequently been called.
51 Geoposition position_override_;
52
53 // Whether this instance is currently observing location updates with high
54 // accuracy.
55 bool high_accuracy_;
56
57 // Whether the client has called |StartUpdating()| on this instance.
58 bool client_asked_for_updates_;
59
60 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceImpl);
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698