Chromium Code Reviews| 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); | 49 ASSERT(timeout >= 0); |
|
Michael van Ouwerkerk
2014/05/13 16:15:17
Would this assert ever trigger on an unsigned int?
kihong
2014/05/14 03:44:25
Done.
| |
| 50 m_hasTimeout = true; | 50 m_hasTimeout = true; |
| 51 m_timeout = timeout; | 51 m_timeout = timeout; |
| 52 } | 52 } |
| 53 bool hasMaximumAge() const { return m_hasMaximumAge; } | 53 bool hasMaximumAge() const { return m_hasMaximumAge; } |
| 54 int maximumAge() const | 54 unsigned maximumAge() const |
| 55 { | 55 { |
| 56 ASSERT(hasMaximumAge()); | 56 ASSERT(hasMaximumAge()); |
| 57 return m_maximumAge; | 57 return m_maximumAge; |
| 58 } | 58 } |
| 59 void clearMaximumAge() { m_hasMaximumAge = false; } | 59 void clearMaximumAge() { m_hasMaximumAge = false; } |
| 60 void setMaximumAge(int age) | 60 void setMaximumAge(unsigned age) |
| 61 { | 61 { |
| 62 ASSERT(age >= 0); | 62 ASSERT(age >= 0); |
|
Michael van Ouwerkerk
2014/05/13 16:15:17
Same here.
kihong
2014/05/14 03:44:25
Done.
| |
| 63 m_hasMaximumAge = true; | 63 m_hasMaximumAge = true; |
| 64 m_maximumAge = age; | 64 m_maximumAge = age; |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 PositionOptions() | 68 PositionOptions() |
| 69 : m_highAccuracy(false) | 69 : m_highAccuracy(false) |
| 70 , m_hasTimeout(false) | 70 , m_hasTimeout(false) |
| 71 { | 71 { |
| 72 setMaximumAge(0); | 72 setMaximumAge(0); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool m_highAccuracy; | 75 bool m_highAccuracy; |
| 76 bool m_hasTimeout; | 76 bool m_hasTimeout; |
| 77 int m_timeout; | 77 unsigned m_timeout; |
| 78 bool m_hasMaximumAge; | 78 bool m_hasMaximumAge; |
| 79 int m_maximumAge; | 79 unsigned m_maximumAge; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace WebCore | 82 } // namespace WebCore |
| 83 | 83 |
| 84 #endif // PositionOptions_h | 84 #endif // PositionOptions_h |
| OLD | NEW |