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 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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. 24 */ 25 26 #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_DEVICE_ORIENTATION_DEVICE_ORIENTATION_DATA_H_ 27 #define THIRD_PARTY_BLINK_RENDERER_MODULES_DEVICE_ORIENTATION_DEVICE_ORIENTATION_DATA_H_ 28 29 #include "base/optional.h" 30 #include "third_party/blink/renderer/modules/modules_export.h" 31 #include "third_party/blink/renderer/platform/heap/handle.h" 32 33 namespace blink { 34 35 class DeviceOrientationEventInit; 36 37 class MODULES_EXPORT DeviceOrientationData final 38 : public GarbageCollected<DeviceOrientationData> { 39 public: 40 static DeviceOrientationData* Create(); 41 static DeviceOrientationData* Create(const base::Optional<double>& alpha, 42 const base::Optional<double>& beta, 43 const base::Optional<double>& gamma, 44 bool absolute); 45 static DeviceOrientationData* Create(const DeviceOrientationEventInit*); 46 47 DeviceOrientationData(); 48 DeviceOrientationData(const base::Optional<double>& alpha, 49 const base::Optional<double>& beta, 50 const base::Optional<double>& gamma, 51 bool absolute); 52 Trace(Visitor * visitor)53 void Trace(Visitor* visitor) const {} 54 55 double Alpha() const; 56 double Beta() const; 57 double Gamma() const; 58 bool Absolute() const; 59 bool CanProvideAlpha() const; 60 bool CanProvideBeta() const; 61 bool CanProvideGamma() const; 62 63 bool CanProvideEventData() const; 64 65 private: 66 base::Optional<double> alpha_; 67 base::Optional<double> beta_; 68 base::Optional<double> gamma_; 69 bool absolute_; 70 }; 71 72 } // namespace blink 73 74 #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_DEVICE_ORIENTATION_DEVICE_ORIENTATION_DATA_H_ 75