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

Side by Side Diff: blimp/engine/feature/geolocation/blimp_location_provider.h

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 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 (c) 2016 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 BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_
6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "blimp/common/proto/geolocation.pb.h"
10 #include "device/geolocation/geoposition.h"
11 #include "device/geolocation/location_provider.h"
12
13 namespace blimp {
14 namespace engine {
15
16 // Location provider for Blimp using the device's provider over the network.
17 class BlimpLocationProvider : public device::LocationProvider {
18 public:
19 // A delegate that implements a subset of LocationProvider's functions.
20 // All methods will be executed on |delegate_task_runner_|.
21 class Delegate {
22 public:
23 using GeopositionReceivedCallback =
24 base::Callback<void(const device::Geoposition&)>;
25 virtual ~Delegate() {}
26
27 virtual void RequestAccuracy(
28 GeolocationSetInterestLevelMessage::Level level) = 0;
29 virtual void OnPermissionGranted() = 0;
30 virtual void SetUpdateCallback(
31 const GeopositionReceivedCallback& callback) = 0;
32 };
33
34 BlimpLocationProvider(
35 base::WeakPtr<Delegate> delegate,
36 scoped_refptr<base::SequencedTaskRunner> delegate_task_runner);
37 ~BlimpLocationProvider() override;
38
39 // device::LocationProvider implementation.
40 bool StartProvider(bool high_accuracy) override;
41 void StopProvider() override;
42 const device::Geoposition& GetPosition() override;
43 void OnPermissionGranted() override;
44 void SetUpdateCallback(
45 const LocationProviderUpdateCallback& callback) override;
46
47 private:
48 void OnLocationUpdate(const device::Geoposition& geoposition);
49
50 // This delegate handles a subset of the LocationProvider functionality.
51 base::WeakPtr<Delegate> delegate_;
52
53 scoped_refptr<base::SequencedTaskRunner> delegate_task_runner_;
54 device::Geoposition cached_position_;
55
56 // True if a successful StartProvider call has occured.
57 bool is_started_;
58
59 LocationProviderUpdateCallback location_update_callback_;
60
61 base::WeakPtrFactory<BlimpLocationProvider> weak_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(BlimpLocationProvider);
64 };
65
66 } // namespace engine
67 } // namespace blimp
68
69 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « blimp/engine/feature/engine_settings_feature_unittest.cc ('k') | blimp/engine/feature/geolocation/blimp_location_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698