OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/device_orientation/orientation.h" | 5 #include "content/browser/device_orientation/orientation.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "content/common/device_orientation_messages.h" | 9 #include "content/common/device_orientation_messages.h" |
10 | 10 |
11 namespace device_orientation { | 11 namespace content { |
12 | 12 |
13 Orientation::Orientation() | 13 Orientation::Orientation() |
14 : can_provide_alpha_(false), | 14 : can_provide_alpha_(false), |
15 can_provide_beta_(false), | 15 can_provide_beta_(false), |
16 can_provide_gamma_(false), | 16 can_provide_gamma_(false), |
17 can_provide_absolute_(false) { | 17 can_provide_absolute_(false) { |
18 } | 18 } |
19 | 19 |
20 Orientation::~Orientation() { | 20 Orientation::~Orientation() { |
21 } | 21 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 bool can_provide_element2, double element1, double element2) { | 60 bool can_provide_element2, double element1, double element2) { |
61 const double kThreshold = 0.1; | 61 const double kThreshold = 0.1; |
62 | 62 |
63 if (can_provide_element1 != can_provide_element2) | 63 if (can_provide_element1 != can_provide_element2) |
64 return true; | 64 return true; |
65 if (can_provide_element1 && std::fabs(element1 - element2) >= kThreshold) | 65 if (can_provide_element1 && std::fabs(element1 - element2) >= kThreshold) |
66 return true; | 66 return true; |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 } // namespace device_orientation | 70 } // namespace content |
OLD | NEW |