| 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/location_arbitrator_impl.h" | 5 #include "content/browser/geolocation/location_arbitrator_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (!provider) | 116 if (!provider) |
| 117 return; | 117 return; |
| 118 provider->SetUpdateCallback(provider_update_callback_); | 118 provider->SetUpdateCallback(provider_update_callback_); |
| 119 if (is_permission_granted_) | 119 if (is_permission_granted_) |
| 120 provider->OnPermissionGranted(); | 120 provider->OnPermissionGranted(); |
| 121 providers_.push_back(std::move(provider)); | 121 providers_.push_back(std::move(provider)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void LocationArbitratorImpl::RegisterSystemProvider() { | 124 void LocationArbitratorImpl::RegisterSystemProvider() { |
| 125 std::unique_ptr<LocationProvider> provider = | 125 std::unique_ptr<LocationProvider> provider = |
| 126 base::WrapUnique(delegate_->OverrideSystemLocationProvider()); | 126 delegate_->OverrideSystemLocationProvider(); |
| 127 if (!provider) | 127 if (!provider) |
| 128 provider = NewSystemLocationProvider(); | 128 provider = NewSystemLocationProvider(); |
| 129 RegisterProvider(std::move(provider)); | 129 RegisterProvider(std::move(provider)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void LocationArbitratorImpl::OnLocationUpdate(const LocationProvider* provider, | 132 void LocationArbitratorImpl::OnLocationUpdate(const LocationProvider* provider, |
| 133 const Geoposition& new_position) { | 133 const Geoposition& new_position) { |
| 134 DCHECK(new_position.Validate() || | 134 DCHECK(new_position.Validate() || |
| 135 new_position.error_code != Geoposition::ERROR_CODE_NONE); | 135 new_position.error_code != Geoposition::ERROR_CODE_NONE); |
| 136 if (!IsNewPositionBetter(position_, new_position, | 136 if (!IsNewPositionBetter(position_, new_position, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { | 208 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { |
| 209 return is_permission_granted_; | 209 return is_permission_granted_; |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace content | 212 } // namespace content |
| OLD | NEW |