| 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_GEOLOCATION_PROVIDER_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const GeolocationObserverOptions& update_options); | 40 const GeolocationObserverOptions& update_options); |
| 41 | 41 |
| 42 // Remove a previously registered observer. No-op if not previously registered | 42 // Remove a previously registered observer. No-op if not previously registered |
| 43 // via AddObserver(). Returns true if the observer was removed. | 43 // via AddObserver(). Returns true if the observer was removed. |
| 44 bool RemoveObserver(GeolocationObserver* delegate); | 44 bool RemoveObserver(GeolocationObserver* delegate); |
| 45 | 45 |
| 46 void OnPermissionGranted(const GURL& requesting_frame); | 46 void OnPermissionGranted(const GURL& requesting_frame); |
| 47 bool HasPermissionBeenGranted() const; | 47 bool HasPermissionBeenGranted() const; |
| 48 | 48 |
| 49 // GeolocationObserver | 49 // GeolocationObserver |
| 50 virtual void OnLocationUpdate(const Geoposition& position); | 50 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE; |
| 51 | 51 |
| 52 // Gets a pointer to the singleton instance of the location relayer, which | 52 // Gets a pointer to the singleton instance of the location relayer, which |
| 53 // is in turn bound to the browser's global context objects. Ownership is NOT | 53 // is in turn bound to the browser's global context objects. Ownership is NOT |
| 54 // returned. | 54 // returned. |
| 55 static GeolocationProvider* GetInstance(); | 55 static GeolocationProvider* GetInstance(); |
| 56 | 56 |
| 57 typedef std::map<GeolocationObserver*, GeolocationObserverOptions> | 57 typedef std::map<GeolocationObserver*, GeolocationObserverOptions> |
| 58 ObserverMap; | 58 ObserverMap; |
| 59 | 59 |
| 60 private: | 60 private: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 // (delegates to arbitrator). | 76 // (delegates to arbitrator). |
| 77 void StartProviders(const GeolocationObserverOptions& options); | 77 void StartProviders(const GeolocationObserverOptions& options); |
| 78 | 78 |
| 79 // Update the providers on the geolocation thread, which must be running. | 79 // Update the providers on the geolocation thread, which must be running. |
| 80 void InformProvidersPermissionGranted(const GURL& requesting_frame); | 80 void InformProvidersPermissionGranted(const GURL& requesting_frame); |
| 81 | 81 |
| 82 // Notifies observers when a new position fix is available. | 82 // Notifies observers when a new position fix is available. |
| 83 void NotifyObservers(const Geoposition& position); | 83 void NotifyObservers(const Geoposition& position); |
| 84 | 84 |
| 85 // Thread | 85 // Thread |
| 86 virtual void Init(); | 86 virtual void Init() OVERRIDE; |
| 87 virtual void CleanUp(); | 87 virtual void CleanUp() OVERRIDE; |
| 88 | 88 |
| 89 scoped_refptr<base::MessageLoopProxy> client_loop_; | 89 scoped_refptr<base::MessageLoopProxy> client_loop_; |
| 90 | 90 |
| 91 // Only used on client thread | 91 // Only used on client thread |
| 92 ObserverMap observers_; | 92 ObserverMap observers_; |
| 93 GURL most_recent_authorized_frame_; | 93 GURL most_recent_authorized_frame_; |
| 94 Geoposition position_; | 94 Geoposition position_; |
| 95 | 95 |
| 96 // Only to be used on the geolocation thread. | 96 // Only to be used on the geolocation thread. |
| 97 GeolocationArbitrator* arbitrator_; | 97 GeolocationArbitrator* arbitrator_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(GeolocationProvider); | 99 DISALLOW_COPY_AND_ASSIGN(GeolocationProvider); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ | 102 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ |
| OLD | NEW |