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

Side by Side Diff: device/geolocation/geolocation_service_context.h

Issue 2192683003: Revert of Reland: Geolocation: move from content/browser to device/ (patchset #2 id:20001 of https:… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2810
Patch Set: Created 4 years, 4 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 #ifndef DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_
6 #define DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h"
10 #include "device/geolocation/geolocation_export.h"
11 #include "third_party/WebKit/public/platform/modules/geolocation/geolocation.moj om.h"
12
13 namespace device {
14
15 class GeolocationServiceImpl;
16 struct Geoposition;
17
18 // Provides information to a set of GeolocationServiceImpl instances that are
19 // associated with a given context. Notably, allows pausing and resuming
20 // geolocation on these instances.
21 class DEVICE_GEOLOCATION_EXPORT GeolocationServiceContext {
22 public:
23 GeolocationServiceContext();
24 virtual ~GeolocationServiceContext();
25
26 // Creates a GeolocationServiceImpl that is weakly bound to |request|.
27 // |update_callback| will be called when services send
28 // location updates to their clients.
29 void CreateService(
30 const base::Closure& update_callback,
31 mojo::InterfaceRequest<blink::mojom::GeolocationService> request);
32
33 // Called when a service has a connection error. After this call, it is no
34 // longer safe to access |service|.
35 void ServiceHadConnectionError(GeolocationServiceImpl* service);
36
37 // 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
39 // will not get geolocation updates until geolocation is resumed.
40 void PauseUpdates();
41 void ResumeUpdates();
42
43 // Returns whether geolocation updates are currently paused.
44 bool paused() { return paused_; }
45
46 // Enables geolocation override. This method can be used to trigger possible
47 // location-specific behavior in a particular context.
48 void SetOverride(std::unique_ptr<Geoposition> geoposition);
49
50 // Disables geolocation override.
51 void ClearOverride();
52
53 private:
54 ScopedVector<GeolocationServiceImpl> services_;
55 bool paused_;
56
57 std::unique_ptr<Geoposition> geoposition_override_;
58
59 DISALLOW_COPY_AND_ASSIGN(GeolocationServiceContext);
60 };
61
62 } // namespace device
63
64 #endif // DEVICE_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_
OLDNEW
« no previous file with comments | « device/geolocation/geolocation_provider_impl_unittest.cc ('k') | device/geolocation/geolocation_service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698