[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / content / browser / geolocation / core_location_data_provider_mac.h
blobeab0e88594f582dd2dd6a4dea09b4709a5a5c39f
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;
21 namespace content {
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> {
28 public:
29 CoreLocationDataProviderMac();
31 bool StartUpdating(CoreLocationProviderMac* provider);
32 void StopUpdating();
34 void UpdatePosition(Geoposition* position);
36 protected:
37 friend class base::RefCountedThreadSafe<CoreLocationDataProviderMac>;
38 ~CoreLocationDataProviderMac();
40 private:
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_