| Index: content/browser/device_orientation/device_data.cc
|
| diff --git a/content/browser/device_orientation/device_data.cc b/content/browser/device_orientation/device_data.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d52bf9ea2bc89866ec8d72bb23a3bdec04a12f8f
|
| --- /dev/null
|
| +++ b/content/browser/device_orientation/device_data.cc
|
| @@ -0,0 +1,22 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include <cmath>
|
| +
|
| +#include "content/browser/device_orientation/device_data.h"
|
| +
|
| +namespace device_orientation {
|
| +
|
| +bool DeviceData::IsElementSignificantlyDifferent(bool can_provide_element1,
|
| + bool can_provide_element2, double element1, double element2) {
|
| + const double kThreshold = 0.1;
|
| +
|
| + if (can_provide_element1 != can_provide_element2)
|
| + return true;
|
| + if (can_provide_element1 && std::fabs(element1 - element2) >= kThreshold)
|
| + return true;
|
| + return false;
|
| +}
|
| +
|
| +} // namespace device_orientation
|
|
|