| 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.h" | 5 #include "content/browser/geolocation/location_arbitrator.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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 DoStartProviders(); | 110 DoStartProviders(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void GeolocationArbitrator::RegisterProvider( | 113 void GeolocationArbitrator::RegisterProvider( |
| 114 LocationProviderBase* provider) { | 114 LocationProviderBase* provider) { |
| 115 if (!provider) | 115 if (!provider) |
| 116 return; | 116 return; |
| 117 provider->RegisterListener(this); | 117 provider->RegisterListener(this); |
| 118 if (is_permission_granted_) | 118 if (is_permission_granted_) |
| 119 provider->OnPermissionGranted(); | 119 provider->OnPermissionGranted(); |
| 120 providers_->push_back(provider); | 120 providers_.push_back(provider); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void GeolocationArbitrator::LocationUpdateAvailable( | 123 void GeolocationArbitrator::LocationUpdateAvailable( |
| 124 LocationProviderBase* provider) { | 124 LocationProviderBase* provider) { |
| 125 DCHECK(provider); | 125 DCHECK(provider); |
| 126 Geoposition new_position; | 126 Geoposition new_position; |
| 127 provider->GetPosition(&new_position); | 127 provider->GetPosition(&new_position); |
| 128 DCHECK(new_position.Validate() || | 128 DCHECK(new_position.Validate() || |
| 129 new_position.error_code != content::Geoposition::ERROR_CODE_NONE); | 129 new_position.error_code != content::Geoposition::ERROR_CODE_NONE); |
| 130 if (!IsNewPositionBetter(position_, new_position, | 130 if (!IsNewPositionBetter(position_, new_position, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool GeolocationArbitrator::HasPermissionBeenGranted() const { | 164 bool GeolocationArbitrator::HasPermissionBeenGranted() const { |
| 165 return is_permission_granted_; | 165 return is_permission_granted_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void GeolocationArbitrator::SetDependencyFactoryForTest( | 168 void GeolocationArbitrator::SetDependencyFactoryForTest( |
| 169 GeolocationArbitratorDependencyFactory* dependency_factory) { | 169 GeolocationArbitratorDependencyFactory* dependency_factory) { |
| 170 g_dependency_factory_for_test = dependency_factory; | 170 g_dependency_factory_for_test = dependency_factory; |
| 171 } | 171 } |
| OLD | NEW |