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