| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ARBITRATOR_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_ARBITRATOR_DEPENDENCY_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_ARBITRATOR_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_ARBITRATOR_DEPENDENCY_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 class AccessTokenStore; | |
| 14 class GURL; | 13 class GURL; |
| 15 class LocationProviderBase; | 14 class LocationProviderBase; |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 class Time; | 17 class Time; |
| 19 } | 18 } |
| 20 | 19 |
| 20 namespace content { |
| 21 class AccessTokenStore; |
| 22 } |
| 23 |
| 21 namespace net { | 24 namespace net { |
| 22 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 23 } | 26 } |
| 24 | 27 |
| 25 // Allows injection of factory methods for creating the location providers. | 28 // Allows injection of factory methods for creating the location providers. |
| 26 // RefCounted for simplicity of writing tests. | 29 // RefCounted for simplicity of writing tests. |
| 27 class CONTENT_EXPORT GeolocationArbitratorDependencyFactory | 30 class CONTENT_EXPORT GeolocationArbitratorDependencyFactory |
| 28 : public base::RefCounted<GeolocationArbitratorDependencyFactory> { | 31 : public base::RefCounted<GeolocationArbitratorDependencyFactory> { |
| 29 public: | 32 public: |
| 30 // Defines a function that returns the current time. | 33 // Defines a function that returns the current time. |
| 31 typedef base::Time (*GetTimeNow)(); | 34 typedef base::Time (*GetTimeNow)(); |
| 32 | 35 |
| 33 virtual GetTimeNow GetTimeFunction() = 0; | 36 virtual GetTimeNow GetTimeFunction() = 0; |
| 34 virtual AccessTokenStore* NewAccessTokenStore() = 0; | 37 virtual content::AccessTokenStore* NewAccessTokenStore() = 0; |
| 35 virtual LocationProviderBase* NewNetworkLocationProvider( | 38 virtual LocationProviderBase* NewNetworkLocationProvider( |
| 36 AccessTokenStore* access_token_store, | 39 content::AccessTokenStore* access_token_store, |
| 37 net::URLRequestContextGetter* context, | 40 net::URLRequestContextGetter* context, |
| 38 const GURL& url, | 41 const GURL& url, |
| 39 const string16& access_token) = 0; | 42 const string16& access_token) = 0; |
| 40 virtual LocationProviderBase* NewSystemLocationProvider() = 0; | 43 virtual LocationProviderBase* NewSystemLocationProvider() = 0; |
| 41 | 44 |
| 42 protected: | 45 protected: |
| 43 friend class base::RefCounted<GeolocationArbitratorDependencyFactory>; | 46 friend class base::RefCounted<GeolocationArbitratorDependencyFactory>; |
| 44 virtual ~GeolocationArbitratorDependencyFactory(); | 47 virtual ~GeolocationArbitratorDependencyFactory(); |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 // The default dependency factory, exposed so that it is possible | 50 // The default dependency factory, exposed so that it is possible |
| 48 // to override only certain parts (e.g. the location providers). | 51 // to override only certain parts (e.g. the location providers). |
| 49 class CONTENT_EXPORT DefaultGeolocationArbitratorDependencyFactory | 52 class CONTENT_EXPORT DefaultGeolocationArbitratorDependencyFactory |
| 50 : public GeolocationArbitratorDependencyFactory { | 53 : public GeolocationArbitratorDependencyFactory { |
| 51 public: | 54 public: |
| 52 // GeolocationArbitratorDependencyFactory | 55 // GeolocationArbitratorDependencyFactory |
| 53 virtual GetTimeNow GetTimeFunction() OVERRIDE; | 56 virtual GetTimeNow GetTimeFunction() OVERRIDE; |
| 54 virtual AccessTokenStore* NewAccessTokenStore() OVERRIDE; | 57 virtual content::AccessTokenStore* NewAccessTokenStore() OVERRIDE; |
| 55 virtual LocationProviderBase* NewNetworkLocationProvider( | 58 virtual LocationProviderBase* NewNetworkLocationProvider( |
| 56 AccessTokenStore* access_token_store, | 59 content::AccessTokenStore* access_token_store, |
| 57 net::URLRequestContextGetter* context, | 60 net::URLRequestContextGetter* context, |
| 58 const GURL& url, | 61 const GURL& url, |
| 59 const string16& access_token) OVERRIDE; | 62 const string16& access_token) OVERRIDE; |
| 60 virtual LocationProviderBase* NewSystemLocationProvider() OVERRIDE; | 63 virtual LocationProviderBase* NewSystemLocationProvider() OVERRIDE; |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 #endif // CONTENT_BROWSER_GEOLOCATION_ARBITRATOR_DEPENDENCY_FACTORY_H_ | 66 #endif // CONTENT_BROWSER_GEOLOCATION_ARBITRATOR_DEPENDENCY_FACTORY_H_ |
| OLD | NEW |