OLD | NEW |
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_GEOLOCATION_PROVIDER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_IMPL_H_ |
6 #define DEVICE_GEOLOCATION_GEOLOCATION_PROVIDER_IMPL_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "device/geolocation/geolocation_export.h" | 16 #include "content/common/content_export.h" |
17 #include "device/geolocation/geolocation_provider.h" | 17 #include "content/public/browser/geolocation_provider.h" |
18 #include "device/geolocation/geoposition.h" | 18 #include "content/public/common/geoposition.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 template<typename Type> struct DefaultSingletonTraits; | 21 template<typename Type> struct DefaultSingletonTraits; |
22 class SingleThreadTaskRunner; | |
23 } | 22 } |
24 | 23 |
25 namespace device { | 24 namespace content { |
26 class LocationArbitrator; | 25 class LocationArbitrator; |
27 | 26 |
28 class DEVICE_GEOLOCATION_EXPORT GeolocationProviderImpl | 27 class CONTENT_EXPORT GeolocationProviderImpl |
29 : public NON_EXPORTED_BASE(GeolocationProvider), | 28 : public NON_EXPORTED_BASE(GeolocationProvider), |
30 public base::Thread { | 29 public base::Thread { |
31 public: | 30 public: |
32 // GeolocationProvider implementation: | 31 // GeolocationProvider implementation: |
33 std::unique_ptr<GeolocationProvider::Subscription> AddLocationUpdateCallback( | 32 std::unique_ptr<GeolocationProvider::Subscription> AddLocationUpdateCallback( |
34 const LocationUpdateCallback& callback, | 33 const LocationUpdateCallback& callback, |
35 bool enable_high_accuracy) override; | 34 bool enable_high_accuracy) override; |
36 void UserDidOptIntoLocationServices() override; | 35 void UserDidOptIntoLocationServices() override; |
37 void OverrideLocationForTesting(const Geoposition& position) override; | 36 void OverrideLocationForTesting(const Geoposition& position) override; |
38 | 37 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 87 |
89 bool user_did_opt_into_location_services_; | 88 bool user_did_opt_into_location_services_; |
90 Geoposition position_; | 89 Geoposition position_; |
91 | 90 |
92 // True only in testing, where we want to use a custom position. | 91 // True only in testing, where we want to use a custom position. |
93 bool ignore_location_updates_; | 92 bool ignore_location_updates_; |
94 | 93 |
95 // Only to be used on the geolocation thread. | 94 // Only to be used on the geolocation thread. |
96 std::unique_ptr<LocationArbitrator> arbitrator_; | 95 std::unique_ptr<LocationArbitrator> arbitrator_; |
97 | 96 |
98 // Used to PostTask()s from the geolocation thread to creation thread. | |
99 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | |
100 | |
101 DISALLOW_COPY_AND_ASSIGN(GeolocationProviderImpl); | 97 DISALLOW_COPY_AND_ASSIGN(GeolocationProviderImpl); |
102 }; | 98 }; |
103 | 99 |
104 } // namespace device | 100 } // namespace content |
105 | 101 |
106 #endif // DEVICE_GEOLOCATION_GEOLOCATION_PROVIDER_IMPL_H_ | 102 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_IMPL_H_ |
OLD | NEW |