| 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_LOCATION_ARBITRATOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // Takes ownership of |provider| on entry; it will either be added to | 65 // Takes ownership of |provider| on entry; it will either be added to |
| 66 // |providers_| or deleted on error (e.g. it fails to start). | 66 // |providers_| or deleted on error (e.g. it fails to start). |
| 67 void RegisterProvider(LocationProvider* provider); | 67 void RegisterProvider(LocationProvider* provider); |
| 68 void OnAccessTokenStoresLoaded( | 68 void OnAccessTokenStoresLoaded( |
| 69 AccessTokenStore::AccessTokenSet access_token_store, | 69 AccessTokenStore::AccessTokenSet access_token_store, |
| 70 net::URLRequestContextGetter* context_getter); | 70 net::URLRequestContextGetter* context_getter); |
| 71 void DoStartProviders(); | 71 void DoStartProviders(); |
| 72 | 72 |
| 73 // The providers call this function when a new position is available. | 73 // Gets called when a provider has a new position. |
| 74 void LocationUpdateAvailable(const LocationProvider* provider, | 74 void OnLocationUpdate(const LocationProvider* provider, |
| 75 const Geoposition& new_position); | 75 const Geoposition& new_position); |
| 76 | 76 |
| 77 // Returns true if |new_position| is an improvement over |old_position|. | 77 // Returns true if |new_position| is an improvement over |old_position|. |
| 78 // Set |from_same_provider| to true if both the positions came from the same | 78 // Set |from_same_provider| to true if both the positions came from the same |
| 79 // provider. | 79 // provider. |
| 80 bool IsNewPositionBetter(const Geoposition& old_position, | 80 bool IsNewPositionBetter(const Geoposition& old_position, |
| 81 const Geoposition& new_position, | 81 const Geoposition& new_position, |
| 82 bool from_same_provider) const; | 82 bool from_same_provider) const; |
| 83 | 83 |
| 84 scoped_refptr<AccessTokenStore> access_token_store_; | 84 scoped_refptr<AccessTokenStore> access_token_store_; |
| 85 LocationUpdateCallback callback_; | 85 LocationUpdateCallback arbitrator_update_callback_; |
| 86 LocationProvider::LocationProviderUpdateCallback provider_callback_; | 86 LocationProvider::LocationProviderUpdateCallback provider_update_callback_; |
| 87 ScopedVector<LocationProvider> providers_; | 87 ScopedVector<LocationProvider> providers_; |
| 88 bool use_high_accuracy_; | 88 bool use_high_accuracy_; |
| 89 // The provider which supplied the current |position_| | 89 // The provider which supplied the current |position_| |
| 90 const LocationProvider* position_provider_; | 90 const LocationProvider* position_provider_; |
| 91 bool is_permission_granted_; | 91 bool is_permission_granted_; |
| 92 // The current best estimate of our position. | 92 // The current best estimate of our position. |
| 93 Geoposition position_; | 93 Geoposition position_; |
| 94 | 94 |
| 95 // Tracks whether providers should be running. | 95 // Tracks whether providers should be running. |
| 96 bool is_running_; | 96 bool is_running_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl); | 98 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Factory functions for the various types of location provider to abstract | 101 // Factory functions for the various types of location provider to abstract |
| 102 // over the platform-dependent implementations. | 102 // over the platform-dependent implementations. |
| 103 LocationProvider* NewSystemLocationProvider(); | 103 LocationProvider* NewSystemLocationProvider(); |
| 104 | 104 |
| 105 } // namespace content | 105 } // namespace content |
| 106 | 106 |
| 107 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ | 107 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
| OLD | NEW |