18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2008 Apple Inc. All Rights Reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef PositionOptions_h 278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define PositionOptions_h 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include <wtf/PassRefPtr.h> 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include <wtf/RefCounted.h> 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass PositionOptions : public RefCounted<PositionOptions> { 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic: 36231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions()); } 378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool enableHighAccuracy() const { return m_highAccuracy; } 398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } 40d5e1fd5fdf2c3c2bb987470577a7914e016b5f79Andrei Popescu bool hasTimeout() const { return m_hasTimeout; } 419ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block int timeout() const 426453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block { 439ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block ASSERT(hasTimeout()); 449ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block return m_timeout; 459ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block } 469ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block void setTimeout(int timeout) 479ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block { 489ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block ASSERT(timeout >= 0); 496453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block m_hasTimeout = true; 509ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block m_timeout = timeout; 516453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block } 524bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block bool hasMaximumAge() const { return m_hasMaximumAge; } 534bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block int maximumAge() const 544bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block { 554bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block ASSERT(hasMaximumAge()); 564bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block return m_maximumAge; 574bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block } 584bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block void clearMaximumAge() { m_hasMaximumAge = false; } 599ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block void setMaximumAge(int age) 606453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block { 619ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block ASSERT(age >= 0); 624bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block m_hasMaximumAge = true; 639ed228a1884b7bb7ec3896c0b3487c5ea45ec6bdSteve Block m_maximumAge = age; 646453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block } 658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate: 676453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block PositionOptions() 686453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block : m_highAccuracy(false) 696453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block , m_hasTimeout(false) 708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project { 714bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block setMaximumAge(0); 728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool m_highAccuracy; 756453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block bool m_hasTimeout; 766453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block int m_timeout; 774bb414d51f2850c0da64c0832fb0dbb0378a5707Steve Block bool m_hasMaximumAge; 786453d21822fbf87a3fec6a6351a56933d2d9d730Steve Block int m_maximumAge; 798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore 828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // PositionOptions_h 84