OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef PositionOptions_h | 26 #ifndef PositionOptions_h |
27 #define PositionOptions_h | 27 #define PositionOptions_h |
28 | 28 |
29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
30 #include "wtf/RefCounted.h" | 30 #include "wtf/RefCounted.h" |
| 31 #include <limits.h> |
31 | 32 |
32 namespace WebCore { | 33 namespace WebCore { |
33 | 34 |
34 class PositionOptions : public RefCountedWillBeGarbageCollected<PositionOptions>
{ | 35 class PositionOptions : public RefCountedWillBeGarbageCollected<PositionOptions>
{ |
35 public: | 36 public: |
36 static PassRefPtrWillBeRawPtr<PositionOptions> create() { return adoptRefWil
lBeNoop(new PositionOptions()); } | 37 static PassRefPtrWillBeRawPtr<PositionOptions> create() { return adoptRefWil
lBeNoop(new PositionOptions()); } |
37 void trace(Visitor*) { } | 38 void trace(Visitor*) { } |
38 | 39 |
39 bool enableHighAccuracy() const { return m_highAccuracy; } | 40 bool enableHighAccuracy() const { return m_highAccuracy; } |
40 void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } | 41 void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } |
41 bool hasTimeout() const { return m_hasTimeout; } | |
42 unsigned timeout() const | 42 unsigned timeout() const |
43 { | 43 { |
44 ASSERT(hasTimeout()); | |
45 return m_timeout; | 44 return m_timeout; |
46 } | 45 } |
47 void setTimeout(unsigned timeout) | 46 void setTimeout(unsigned timeout) |
48 { | 47 { |
49 m_hasTimeout = true; | |
50 m_timeout = timeout; | 48 m_timeout = timeout; |
51 } | 49 } |
52 bool hasMaximumAge() const { return m_hasMaximumAge; } | |
53 unsigned maximumAge() const | 50 unsigned maximumAge() const |
54 { | 51 { |
55 ASSERT(hasMaximumAge()); | |
56 return m_maximumAge; | 52 return m_maximumAge; |
57 } | 53 } |
58 void clearMaximumAge() { m_hasMaximumAge = false; } | |
59 void setMaximumAge(unsigned age) | 54 void setMaximumAge(unsigned age) |
60 { | 55 { |
61 m_hasMaximumAge = true; | |
62 m_maximumAge = age; | 56 m_maximumAge = age; |
63 } | 57 } |
64 | 58 |
65 private: | 59 private: |
66 PositionOptions() | 60 PositionOptions() |
67 : m_highAccuracy(false) | 61 : m_highAccuracy(false) |
68 , m_hasTimeout(false) | 62 , m_maximumAge(0) |
| 63 , m_timeout(std::numeric_limits<unsigned>::max()) |
| 64 |
69 { | 65 { |
70 setMaximumAge(0); | 66 setMaximumAge(0); |
71 } | 67 } |
72 | 68 |
73 bool m_highAccuracy; | 69 bool m_highAccuracy; |
74 bool m_hasTimeout; | 70 int m_maximumAge; |
75 unsigned m_timeout; | 71 int m_timeout; |
76 bool m_hasMaximumAge; | |
77 unsigned m_maximumAge; | |
78 }; | 72 }; |
79 | 73 |
80 } // namespace WebCore | 74 } // namespace WebCore |
81 | 75 |
82 #endif // PositionOptions_h | 76 #endif // PositionOptions_h |
OLD | NEW |