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_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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE; | 49 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE; |
50 | 50 |
51 // Gets a pointer to the singleton instance of the location relayer, which | 51 // Gets a pointer to the singleton instance of the location relayer, which |
52 // is in turn bound to the browser's global context objects. Ownership is NOT | 52 // is in turn bound to the browser's global context objects. Ownership is NOT |
53 // returned. | 53 // returned. |
54 static GeolocationProvider* GetInstance(); | 54 static GeolocationProvider* GetInstance(); |
55 | 55 |
56 typedef std::map<GeolocationObserver*, GeolocationObserverOptions> | 56 typedef std::map<GeolocationObserver*, GeolocationObserverOptions> |
57 ObserverMap; | 57 ObserverMap; |
58 | 58 |
59 private: | 59 protected: |
60 friend struct DefaultSingletonTraits<GeolocationProvider>; | 60 friend struct DefaultSingletonTraits<GeolocationProvider>; |
Joao da Silva
2012/04/20 09:49:57
I'm not familiar with this code, but a singleton w
John Knottenbelt
2012/04/20 12:50:42
Agree.
On 2012/04/20 09:49:57, Joao da Silva wrot
bartfab (slow)
2012/04/20 14:10:15
Done.
| |
61 virtual ~GeolocationProvider(); | 61 virtual ~GeolocationProvider(); |
62 | 62 |
63 private: | |
63 bool OnClientThread() const; | 64 bool OnClientThread() const; |
64 bool OnGeolocationThread() const; | 65 bool OnGeolocationThread() const; |
65 | 66 |
66 // When the observer list changes, we may start the thread and the required | 67 // When the observer list changes, we may start the thread and the required |
67 // providers, or stop them. | 68 // providers, or stop them. |
68 void OnObserversChanged(); | 69 void OnObserversChanged(); |
69 | 70 |
70 // Stop the providers when there are no more observers. Note that once our | 71 // Stop the providers when there are no more observers. Note that once our |
71 // thread is started, we'll keep it alive (but with no pending messages). | 72 // thread is started, we'll keep it alive (but with no pending messages). |
72 void StopProviders(); | 73 void StopProviders(); |
(...skipping 19 matching lines...) Expand all Loading... | |
92 bool is_permission_granted_; | 93 bool is_permission_granted_; |
93 Geoposition position_; | 94 Geoposition position_; |
94 | 95 |
95 // Only to be used on the geolocation thread. | 96 // Only to be used on the geolocation thread. |
96 GeolocationArbitrator* arbitrator_; | 97 GeolocationArbitrator* arbitrator_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(GeolocationProvider); | 99 DISALLOW_COPY_AND_ASSIGN(GeolocationProvider); |
99 }; | 100 }; |
100 | 101 |
101 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ | 102 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PROVIDER_H_ |
OLD | NEW |