| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // A location provider provides position information from a particular source | 5 // A location provider provides position information from a particular source |
| 6 // (GPS, network etc). The GearsGeolocation object uses a set of location | 6 // (GPS, network etc). The GearsGeolocation object uses a set of location |
| 7 // providers to obtain a position fix. | 7 // providers to obtain a position fix. |
| 8 // | 8 // |
| 9 // This file declares a base class to be used by all location providers. | 9 // This file declares a base class to be used by all location providers. |
| 10 // Primarily, this class declares interface methods to be implemented by derived | 10 // Primarily, this class declares interface methods to be implemented by derived |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // Clients of the location provider must implement this interface. All call- | 44 // Clients of the location provider must implement this interface. All call- |
| 45 // backs to this interface will happen in the context of the thread on which | 45 // backs to this interface will happen in the context of the thread on which |
| 46 // the location provider was created. | 46 // the location provider was created. |
| 47 class ListenerInterface { | 47 class ListenerInterface { |
| 48 public: | 48 public: |
| 49 // Used to inform listener that a new position fix is available or that a | 49 // Used to inform listener that a new position fix is available or that a |
| 50 // fatal error has occurred. Providers should call this for new listeners | 50 // fatal error has occurred. Providers should call this for new listeners |
| 51 // as soon as a position is available. | 51 // as soon as a position is available. |
| 52 virtual void LocationUpdateAvailable(LocationProviderBase* provider) = 0; | 52 virtual bool LocationUpdateAvailable(LocationProviderBase* provider) = 0; |
| 53 // Used to inform listener that movement has been detected. If obtaining the | 53 // Used to inform listener that movement has been detected. If obtaining the |
| 54 // position succeeds, this will be followed by a call to | 54 // position succeeds, this will be followed by a call to |
| 55 // LocationUpdateAvailable. Some providers may not be able to detect | 55 // LocationUpdateAvailable. Some providers may not be able to detect |
| 56 // movement before a new fix is obtained, so will never call this method. | 56 // movement before a new fix is obtained, so will never call this method. |
| 57 // Note that this is not called in response to registration of a new | 57 // Note that this is not called in response to registration of a new |
| 58 // listener. | 58 // listener. |
| 59 virtual void MovementDetected(LocationProviderBase* provider) = 0; | 59 virtual bool MovementDetected(LocationProviderBase* provider) = 0; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual ~ListenerInterface() {} | 62 virtual ~ListenerInterface() {} |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // TODO(joth): Make register / unregister non-virtual. | 65 // TODO(joth): Make register / unregister non-virtual. |
| 66 // Registers a listener, which will be called back on | 66 // Registers a listener, which will be called back on |
| 67 // ListenerInterface::LocationUpdateAvailable as soon as a position is | 67 // ListenerInterface::LocationUpdateAvailable as soon as a position is |
| 68 // available and again whenever a new position is available. Ref counts the | 68 // available and again whenever a new position is available. Ref counts the |
| 69 // listener to handle multiple calls to this method. | 69 // listener to handle multiple calls to this method. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // the platform-dependent implementations. | 135 // the platform-dependent implementations. |
| 136 LocationProviderBase* NewMockLocationProvider(); | 136 LocationProviderBase* NewMockLocationProvider(); |
| 137 LocationProviderBase* NewGpsLocationProvider(); | 137 LocationProviderBase* NewGpsLocationProvider(); |
| 138 LocationProviderBase* NewNetworkLocationProvider( | 138 LocationProviderBase* NewNetworkLocationProvider( |
| 139 LocationProviderBase::AccessTokenStore* access_token_store, | 139 LocationProviderBase::AccessTokenStore* access_token_store, |
| 140 URLRequestContextGetter* context, | 140 URLRequestContextGetter* context, |
| 141 const GURL& url, | 141 const GURL& url, |
| 142 const string16& host_name); | 142 const string16& host_name); |
| 143 | 143 |
| 144 #endif // CHROME_BROWSER_GEOLOCATION_LOCATION_PROVIDER_H_ | 144 #endif // CHROME_BROWSER_GEOLOCATION_LOCATION_PROVIDER_H_ |
| OLD | NEW |