| OLD | NEW |
| 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "content/browser/geolocation/location_provider.h" | 12 #include "content/browser/geolocation/location_provider.h" |
| 13 #include "content/browser/geolocation/geolocation_observer.h" | 13 #include "content/browser/geolocation/geolocation_observer.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/common/geoposition.h" | 15 #include "content/common/geoposition.h" |
| 16 #include "content/public/browser/access_token_store.h" | 16 #include "content/public/browser/access_token_store.h" |
| 17 #include "googleurl/src/gurl.h" | |
| 18 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 19 | 18 |
| 20 class GeolocationArbitratorDependencyFactory; | 19 class GeolocationArbitratorDependencyFactory; |
| 21 class GURL; | |
| 22 class LocationProviderBase; | 20 class LocationProviderBase; |
| 23 | 21 |
| 24 namespace content { | 22 namespace content { |
| 25 class AccessTokenStore; | 23 class AccessTokenStore; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace net { | 26 namespace net { |
| 29 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
| 30 } | 28 } |
| 31 | 29 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 51 | 49 |
| 52 // See more details in geolocation_provider. | 50 // See more details in geolocation_provider. |
| 53 void StartProviders(const GeolocationObserverOptions& options); | 51 void StartProviders(const GeolocationObserverOptions& options); |
| 54 void StopProviders(); | 52 void StopProviders(); |
| 55 | 53 |
| 56 // Called everytime permission is granted to a page for using geolocation. | 54 // Called everytime permission is granted to a page for using geolocation. |
| 57 // This may either be through explicit user action (e.g. responding to the | 55 // This may either be through explicit user action (e.g. responding to the |
| 58 // infobar prompt) or inferred from a persisted site permission. | 56 // infobar prompt) or inferred from a persisted site permission. |
| 59 // The arbitrator will inform all providers of this, which may in turn use | 57 // The arbitrator will inform all providers of this, which may in turn use |
| 60 // this information to modify their internal policy. | 58 // this information to modify their internal policy. |
| 61 void OnPermissionGranted(const GURL& requesting_frame); | 59 void OnPermissionGranted(); |
| 62 | 60 |
| 63 // Returns true if this arbitrator has received at least one call to | 61 // Returns true if this arbitrator has received at least one call to |
| 64 // OnPermissionGranted(). | 62 // OnPermissionGranted(). |
| 65 bool HasPermissionBeenGranted() const; | 63 bool HasPermissionBeenGranted() const; |
| 66 | 64 |
| 67 // Call this function every time you need to create an specially parameterised | 65 // Call this function every time you need to create an specially parameterised |
| 68 // arbitrator. | 66 // arbitrator. |
| 69 static void SetDependencyFactoryForTest( | 67 static void SetDependencyFactoryForTest( |
| 70 GeolocationArbitratorDependencyFactory* factory); | 68 GeolocationArbitratorDependencyFactory* factory); |
| 71 | 69 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 91 bool from_same_provider) const; | 89 bool from_same_provider) const; |
| 92 | 90 |
| 93 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; | 91 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; |
| 94 scoped_refptr<content::AccessTokenStore> access_token_store_; | 92 scoped_refptr<content::AccessTokenStore> access_token_store_; |
| 95 GetTimeNow get_time_now_; | 93 GetTimeNow get_time_now_; |
| 96 GeolocationObserver* observer_; | 94 GeolocationObserver* observer_; |
| 97 ScopedVector<LocationProviderBase> providers_; | 95 ScopedVector<LocationProviderBase> providers_; |
| 98 GeolocationObserverOptions current_provider_options_; | 96 GeolocationObserverOptions current_provider_options_; |
| 99 // The provider which supplied the current |position_| | 97 // The provider which supplied the current |position_| |
| 100 const LocationProviderBase* position_provider_; | 98 const LocationProviderBase* position_provider_; |
| 101 GURL most_recent_authorized_frame_; | 99 bool is_permission_granted_; |
| 102 // The current best estimate of our position. | 100 // The current best estimate of our position. |
| 103 Geoposition position_; | 101 Geoposition position_; |
| 104 | 102 |
| 105 DISALLOW_COPY_AND_ASSIGN(GeolocationArbitrator); | 103 DISALLOW_COPY_AND_ASSIGN(GeolocationArbitrator); |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ | 106 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ |
| OLD | NEW |