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 // This file declares a CoreLocation data provider class that allows the | 5 // This file declares a CoreLocation data provider class that allows the |
6 // CoreLocation framework to run on the UI thread, since the Geolocation API's | 6 // CoreLocation framework to run on the UI thread, since the Geolocation API's |
7 // providers all live on the IO thread | 7 // providers all live on the IO thread |
8 | 8 |
9 #ifndef CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ | 9 #ifndef CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ |
10 #define CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ | 10 #define CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_nsobject.h" | 14 #include "base/memory/scoped_nsobject.h" |
15 #include "content/common/geoposition.h" | |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/common/geoposition.h" |
17 | 17 |
18 #import <Foundation/Foundation.h> | 18 #import <Foundation/Foundation.h> |
19 | 19 |
20 class CoreLocationProviderMac; | 20 class CoreLocationProviderMac; |
21 @class CoreLocationWrapperMac; | 21 @class CoreLocationWrapperMac; |
22 | 22 |
23 // Data provider class that allows CoreLocation to run in Chrome's UI thread | 23 // Data provider class that allows CoreLocation to run in Chrome's UI thread |
24 // while existing on any of Chrome's threads (in this case the IO thread) | 24 // while existing on any of Chrome's threads (in this case the IO thread) |
25 class CoreLocationDataProviderMac | 25 class CoreLocationDataProviderMac |
26 : public base::RefCountedThreadSafe<CoreLocationDataProviderMac> { | 26 : public base::RefCountedThreadSafe<CoreLocationDataProviderMac> { |
27 public: | 27 public: |
28 CoreLocationDataProviderMac(); | 28 CoreLocationDataProviderMac(); |
29 | 29 |
30 bool StartUpdating(CoreLocationProviderMac* provider); | 30 bool StartUpdating(CoreLocationProviderMac* provider); |
31 void StopUpdating(); | 31 void StopUpdating(); |
32 | 32 |
33 void UpdatePosition(Geoposition *position); | 33 void UpdatePosition(content::Geoposition* position); |
34 | 34 |
35 protected: | 35 protected: |
36 friend class base::RefCountedThreadSafe<CoreLocationDataProviderMac>; | 36 friend class base::RefCountedThreadSafe<CoreLocationDataProviderMac>; |
37 ~CoreLocationDataProviderMac(); | 37 ~CoreLocationDataProviderMac(); |
38 | 38 |
39 private: | 39 private: |
40 // These must execute in BrowserThread::UI | 40 // These must execute in BrowserThread::UI |
41 void StartUpdatingTask(); | 41 void StartUpdatingTask(); |
42 void StopUpdatingTask(); | 42 void StopUpdatingTask(); |
43 // This must execute in the origin thread (IO thread) | 43 // This must execute in the origin thread (IO thread) |
44 void PositionUpdated(Geoposition position); | 44 void PositionUpdated(content::Geoposition position); |
45 | 45 |
46 // The wrapper class that supplies this class with position data | 46 // The wrapper class that supplies this class with position data |
47 scoped_nsobject<CoreLocationWrapperMac> wrapper_; | 47 scoped_nsobject<CoreLocationWrapperMac> wrapper_; |
48 // The LocationProviderBase class that should receive position data | 48 // The LocationProviderBase class that should receive position data |
49 CoreLocationProviderMac* provider_; | 49 CoreLocationProviderMac* provider_; |
50 }; | 50 }; |
51 | 51 |
52 #endif // CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ | 52 #endif // CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_ |
OLD | NEW |