- add third_party src.
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / geolocation / tizen / location_provider_tizen.h
1 // Copyright (c) 2013 Intel Corporation. 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.
4
5 #ifndef XWALK_RUNTIME_BROWSER_GEOLOCATION_TIZEN_LOCATION_PROVIDER_TIZEN_H_
6 #define XWALK_RUNTIME_BROWSER_GEOLOCATION_TIZEN_LOCATION_PROVIDER_TIZEN_H_
7
8 #include <locations.h>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/geolocation/location_provider_base.h"
13
14 namespace content {
15 struct Geoposition;
16 }
17
18 namespace base {
19 class MessageLoop;
20 }
21
22 namespace xwalk {
23 class LocationProviderTizen : public content::LocationProviderBase {
24  public:
25   LocationProviderTizen();
26   virtual ~LocationProviderTizen();
27
28   // LocationProvider.
29   virtual bool StartProvider(bool high_accuracy) OVERRIDE;
30   virtual void StopProvider() OVERRIDE;
31   virtual void GetPosition(content::Geoposition* position) OVERRIDE;
32   virtual void RequestRefresh() OVERRIDE;
33   virtual void OnPermissionGranted() OVERRIDE;
34
35  private:
36   bool InitLocationManager();
37   void NotifyLocationProvider();
38   static void OnStateChanged(location_service_state_e state, void *data);
39
40  private:
41   location_manager_h manager_;
42   content::Geoposition last_position_;
43   base::MessageLoop* geolocation_message_loop_;
44   bool is_permission_granted_;
45   DISALLOW_COPY_AND_ASSIGN(LocationProviderTizen);
46 };
47
48 }  // namespace xwalk
49
50 #endif  // XWALK_RUNTIME_BROWSER_GEOLOCATION_TIZEN_LOCATION_PROVIDER_TIZEN_H_