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 "content/browser/geolocation/geolocation_provider_impl.h" | 5 #include "content/browser/geolocation/geolocation_provider_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 } else { | 30 } else { |
31 subscription = low_accuracy_callbacks_.Add(callback); | 31 subscription = low_accuracy_callbacks_.Add(callback); |
32 } | 32 } |
33 | 33 |
34 OnClientsChanged(); | 34 OnClientsChanged(); |
35 if (position_.Validate() || | 35 if (position_.Validate() || |
36 position_.error_code != Geoposition::ERROR_CODE_NONE) { | 36 position_.error_code != Geoposition::ERROR_CODE_NONE) { |
37 callback.Run(position_); | 37 callback.Run(position_); |
38 } | 38 } |
39 | 39 |
40 return subscription.Pass(); | 40 return subscription; |
41 } | 41 } |
42 | 42 |
43 void GeolocationProviderImpl::UserDidOptIntoLocationServices() { | 43 void GeolocationProviderImpl::UserDidOptIntoLocationServices() { |
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
45 bool was_permission_granted = user_did_opt_into_location_services_; | 45 bool was_permission_granted = user_did_opt_into_location_services_; |
46 user_did_opt_into_location_services_ = true; | 46 user_did_opt_into_location_services_ = true; |
47 if (IsRunning() && !was_permission_granted) | 47 if (IsRunning() && !was_permission_granted) |
48 InformProvidersPermissionGranted(); | 48 InformProvidersPermissionGranted(); |
49 } | 49 } |
50 | 50 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 arbitrator_ = NULL; | 171 arbitrator_ = NULL; |
172 } | 172 } |
173 | 173 |
174 LocationArbitrator* GeolocationProviderImpl::CreateArbitrator() { | 174 LocationArbitrator* GeolocationProviderImpl::CreateArbitrator() { |
175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( | 175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( |
176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); | 176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); |
177 return new LocationArbitratorImpl(callback); | 177 return new LocationArbitratorImpl(callback); |
178 } | 178 } |
179 | 179 |
180 } // namespace content | 180 } // namespace content |
OLD | NEW |