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 #include "device/geolocation/geolocation_provider_impl.h" | 5 #include "device/geolocation/geolocation_provider_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 void GeolocationProviderImpl::UserDidOptIntoLocationServices() { | 62 void GeolocationProviderImpl::UserDidOptIntoLocationServices() { |
63 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 63 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
64 bool was_permission_granted = user_did_opt_into_location_services_; | 64 bool was_permission_granted = user_did_opt_into_location_services_; |
65 user_did_opt_into_location_services_ = true; | 65 user_did_opt_into_location_services_ = true; |
66 if (IsRunning() && !was_permission_granted) | 66 if (IsRunning() && !was_permission_granted) |
67 InformProvidersPermissionGranted(); | 67 InformProvidersPermissionGranted(); |
68 } | 68 } |
69 | 69 |
| 70 bool GeolocationProviderImpl::HighAccuracyLocationInUse() { |
| 71 return !high_accuracy_callbacks_.empty(); |
| 72 } |
| 73 |
70 void GeolocationProviderImpl::OverrideLocationForTesting( | 74 void GeolocationProviderImpl::OverrideLocationForTesting( |
71 const Geoposition& position) { | 75 const Geoposition& position) { |
72 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 76 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
73 ignore_location_updates_ = true; | 77 ignore_location_updates_ = true; |
74 NotifyClients(position); | 78 NotifyClients(position); |
75 } | 79 } |
76 | 80 |
77 void GeolocationProviderImpl::OnLocationUpdate(const LocationProvider* provider, | 81 void GeolocationProviderImpl::OnLocationUpdate(const LocationProvider* provider, |
78 const Geoposition& position) { | 82 const Geoposition& position) { |
79 DCHECK(OnGeolocationThread()); | 83 DCHECK(OnGeolocationThread()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 arbitrator_->SetUpdateCallback(callback); | 199 arbitrator_->SetUpdateCallback(callback); |
196 } | 200 } |
197 } | 201 } |
198 | 202 |
199 void GeolocationProviderImpl::CleanUp() { | 203 void GeolocationProviderImpl::CleanUp() { |
200 DCHECK(OnGeolocationThread()); | 204 DCHECK(OnGeolocationThread()); |
201 arbitrator_.reset(); | 205 arbitrator_.reset(); |
202 } | 206 } |
203 | 207 |
204 } // namespace device | 208 } // namespace device |
OLD | NEW |