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 21 matching lines...) Expand all Loading... |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 class PositionOptions : public RefCountedWillBeGarbageCollected<PositionOptions>
{ | 34 class PositionOptions : public RefCountedWillBeGarbageCollected<PositionOptions>
{ |
35 public: | 35 public: |
36 static PassRefPtrWillBeRawPtr<PositionOptions> create() { return adoptRefWil
lBeNoop(new PositionOptions()); } | 36 static PassRefPtrWillBeRawPtr<PositionOptions> create() { return adoptRefWil
lBeNoop(new PositionOptions()); } |
37 void trace(Visitor*) { } | 37 void trace(Visitor*) { } |
38 | 38 |
39 bool enableHighAccuracy() const { return m_highAccuracy; } | 39 bool enableHighAccuracy() const { return m_highAccuracy; } |
40 void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } | 40 void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } |
41 bool hasTimeout() const { return m_hasTimeout; } | 41 bool hasTimeout() const { return m_hasTimeout; } |
42 int timeout() const | 42 unsigned timeout() const |
43 { | 43 { |
44 ASSERT(hasTimeout()); | 44 ASSERT(hasTimeout()); |
45 return m_timeout; | 45 return m_timeout; |
46 } | 46 } |
47 void setTimeout(int timeout) | 47 void setTimeout(unsigned timeout) |
48 { | 48 { |
49 ASSERT(timeout >= 0); | |
50 m_hasTimeout = true; | 49 m_hasTimeout = true; |
51 m_timeout = timeout; | 50 m_timeout = timeout; |
52 } | 51 } |
53 bool hasMaximumAge() const { return m_hasMaximumAge; } | 52 bool hasMaximumAge() const { return m_hasMaximumAge; } |
54 int maximumAge() const | 53 unsigned maximumAge() const |
55 { | 54 { |
56 ASSERT(hasMaximumAge()); | 55 ASSERT(hasMaximumAge()); |
57 return m_maximumAge; | 56 return m_maximumAge; |
58 } | 57 } |
59 void clearMaximumAge() { m_hasMaximumAge = false; } | 58 void clearMaximumAge() { m_hasMaximumAge = false; } |
60 void setMaximumAge(int age) | 59 void setMaximumAge(unsigned age) |
61 { | 60 { |
62 ASSERT(age >= 0); | |
63 m_hasMaximumAge = true; | 61 m_hasMaximumAge = true; |
64 m_maximumAge = age; | 62 m_maximumAge = age; |
65 } | 63 } |
66 | 64 |
67 private: | 65 private: |
68 PositionOptions() | 66 PositionOptions() |
69 : m_highAccuracy(false) | 67 : m_highAccuracy(false) |
70 , m_hasTimeout(false) | 68 , m_hasTimeout(false) |
71 { | 69 { |
72 setMaximumAge(0); | 70 setMaximumAge(0); |
73 } | 71 } |
74 | 72 |
75 bool m_highAccuracy; | 73 bool m_highAccuracy; |
76 bool m_hasTimeout; | 74 bool m_hasTimeout; |
77 int m_timeout; | 75 unsigned m_timeout; |
78 bool m_hasMaximumAge; | 76 bool m_hasMaximumAge; |
79 int m_maximumAge; | 77 unsigned m_maximumAge; |
80 }; | 78 }; |
81 | 79 |
82 } // namespace WebCore | 80 } // namespace WebCore |
83 | 81 |
84 #endif // PositionOptions_h | 82 #endif // PositionOptions_h |
OLD | NEW |