Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: content/browser/device_orientation/device_data.cc

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Handles null device_data in observer Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <cmath>
6
7 #include "content/browser/device_orientation/device_data.h"
8
9 namespace device_orientation {
10
11 bool DeviceData::IsElementSignificantlyDifferent(bool can_provide_element1,
12 bool can_provide_element2, double element1, double element2) {
13 const double kThreshold = 0.1;
14
15 if (can_provide_element1 != can_provide_element2)
16 return true;
17 if (can_provide_element1 && std::fabs(element1 - element2) >= kThreshold)
18 return true;
19 return false;
20 }
21
22 } // namespace device_orientation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698