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

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

Issue 2298013002: Gets rid of LocationProviderBase. (Closed)
Patch Set: Typo. Created 4 years, 3 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
« no previous file with comments | « device/geolocation/BUILD.gn ('k') | device/geolocation/fake_location_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FAKE_LOCATION_PROVIDER_H_ 5 #ifndef DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_
6 #define DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_ 6 #define DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "device/geolocation/geoposition.h" 13 #include "device/geolocation/geoposition.h"
14 #include "device/geolocation/location_provider_base.h" 14 #include "device/geolocation/location_provider.h"
15 15
16 namespace device { 16 namespace device {
17 17
18 // Fake implementation of a location provider for testing. 18 // Fake implementation of a location provider for testing.
19 class FakeLocationProvider : public LocationProviderBase { 19 class FakeLocationProvider : public LocationProvider {
20 public: 20 public:
21 enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_ = STOPPED; 21 enum State { STOPPED, LOW_ACCURACY, HIGH_ACCURACY } state_ = STOPPED;
22 22
23 FakeLocationProvider(); 23 FakeLocationProvider();
24 ~FakeLocationProvider() override; 24 ~FakeLocationProvider() override;
25 25
26 // Updates listeners with the new position. 26 // Updates listeners with the new position.
27 void HandlePositionChanged(const Geoposition& position); 27 void HandlePositionChanged(const Geoposition& position);
28 28
29 State state() const { return state_; } 29 State state() const { return state_; }
30 bool is_permission_granted() const { return is_permission_granted_; } 30 bool is_permission_granted() const { return is_permission_granted_; }
31 31
32 // LocationProvider implementation. 32 // LocationProvider implementation.
33 void SetUpdateCallback(
34 const LocationProviderUpdateCallback& callback) override;
33 bool StartProvider(bool high_accuracy) override; 35 bool StartProvider(bool high_accuracy) override;
34 void StopProvider() override; 36 void StopProvider() override;
35 const Geoposition& GetPosition() override; 37 const Geoposition& GetPosition() override;
36 void OnPermissionGranted() override; 38 void OnPermissionGranted() override;
37 39
38 scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_; 40 scoped_refptr<base::SingleThreadTaskRunner> provider_task_runner_;
39 41
40 private: 42 private:
41 bool is_permission_granted_ = false; 43 bool is_permission_granted_ = false;
42 Geoposition position_; 44 Geoposition position_;
45 LocationProviderUpdateCallback callback_;
43 46
44 DISALLOW_COPY_AND_ASSIGN(FakeLocationProvider); 47 DISALLOW_COPY_AND_ASSIGN(FakeLocationProvider);
45 }; 48 };
46 49
47 } // namespace device 50 } // namespace device
48 51
49 #endif // DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_ 52 #endif // DEVICE_GEOLOCATION_FAKE_LOCATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « device/geolocation/BUILD.gn ('k') | device/geolocation/fake_location_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698