1/*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef WebGeolocationPosition_h
27#define WebGeolocationPosition_h
28
29#if WEBKIT_IMPLEMENTATION
30#include <wtf/PassRefPtr.h>
31namespace WebCore { class GeolocationPosition; }
32#endif
33
34namespace WebKit {
35
36class WebGeolocationPosition {
37public:
38 WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy,
39 bool providesAltitude, double altitude, bool providesAltitudeAccuracy,
40 double altitudeAccuracy, bool providesHeading, double heading,
41 bool providesSpeed, double speed)
42 : m_timestamp(timestamp),
43 m_latitude(latitude),
44 m_longitude(longitude),
45 m_accuracy(accuracy),
46 m_altitude(altitude),
47 m_altitudeAccuracy(altitudeAccuracy),
48 m_heading(heading),
49 m_speed(speed),
50 m_canProvideAltitude(providesAltitude),
51 m_canProvideAltitudeAccuracy(providesAltitudeAccuracy),
52 m_canProvideHeading(providesHeading),
53 m_canProvideSpeed(providesSpeed)
54 {
55 }
56
57 WebGeolocationPosition()
58 {
59 }
60
61 double timestamp() const { return m_timestamp; }
62
63 double latitude() const { return m_latitude; }
64 double longitude() const { return m_longitude; }
65 double accuracy() const { return m_accuracy; }
66 double altitude() const { return m_altitude; }
67 double altitudeAccuracy() const { return m_altitudeAccuracy; }
68 double heading() const { return m_heading; }
69 double speed() const { return m_speed; }
70
71 bool canProvideAltitude() const { return m_canProvideAltitude; }
72 bool canProvideAltitudeAccuracy() const { return m_canProvideAltitudeAccuracy; }
73 bool canProvideHeading() const { return m_canProvideHeading; }
74 bool canProvideSpeed() const { return m_canProvideSpeed; }
75
76#if WEBKIT_IMPLEMENTATION
77 WebGeolocationPosition(const WebCore::GeolocationPosition& position)
78 {
79 copyFrom(position);
80 }
81 WebGeolocationPosition& operator=(const WebCore::GeolocationPosition&);
82 operator WTF::PassRefPtr<WebCore::GeolocationPosition>() const;
83#endif
84
85private:
86
87#if WEBKIT_IMPLEMENTATION
88 void copyFrom(const WebCore::GeolocationPosition&);
89#endif
90
91 double m_timestamp;
92
93 double m_latitude;
94 double m_longitude;
95 double m_accuracy;
96 double m_altitude;
97 double m_altitudeAccuracy;
98 double m_heading;
99 double m_speed;
100
101 bool m_canProvideAltitude;
102 bool m_canProvideAltitudeAccuracy;
103 bool m_canProvideHeading;
104 bool m_canProvideSpeed;
105};
106
107} // namespace WebKit
108
109#endif // WebGeolocationPosition_h