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
3 // found in the LICENSE file.
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
7 // providers all live on the IO thread
9 #ifndef CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_
10 #define CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_nsobject.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/common/geoposition.h"
17 #import <Foundation/Foundation.h>
19 @
class CoreLocationWrapperMac
;
22 class CoreLocationProviderMac
;
24 // Data provider class that allows CoreLocation to run in Chrome's UI thread
25 // while existing on any of Chrome's threads (in this case the IO thread)
26 class CoreLocationDataProviderMac
27 : public base::RefCountedThreadSafe
<CoreLocationDataProviderMac
> {
29 CoreLocationDataProviderMac();
31 bool StartUpdating(CoreLocationProviderMac
* provider
);
34 void UpdatePosition(Geoposition
* position
);
37 friend class base::RefCountedThreadSafe
<CoreLocationDataProviderMac
>;
38 ~CoreLocationDataProviderMac();
41 // These must execute in BrowserThread::UI
42 void StartUpdatingTask();
43 void StopUpdatingTask();
44 // This must execute in the origin thread (IO thread)
45 void PositionUpdated(Geoposition position
);
47 // The wrapper class that supplies this class with position data
48 scoped_nsobject
<CoreLocationWrapperMac
> wrapper_
;
49 // The LocationProviderBase class that should receive position data
50 CoreLocationProviderMac
* provider_
;
53 } // namespace content
55 #endif // CONTENT_BROWSER_GEOLOCATION_CORE_LOCATION_DATA_PROVIDER_H_