| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file is based on the SMSLib library. | 5 // This file is based on the SMSLib library. |
| 6 // | 6 // |
| 7 // SMSLib Sudden Motion Sensor Access Library | 7 // SMSLib Sudden Motion Sensor Access Library |
| 8 // Copyright (c) 2010 Suitable Systems | 8 // Copyright (c) 2010 Suitable Systems |
| 9 // All rights reserved. | 9 // All rights reserved. |
| 10 // | 10 // |
| 11 // Developed by: Daniel Griscom | 11 // Developed by: Daniel Griscom |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // (781) 665-0053 | 49 // (781) 665-0053 |
| 50 | 50 |
| 51 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ | 51 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ |
| 52 #define CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ | 52 #define CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ |
| 53 #pragma once | 53 #pragma once |
| 54 | 54 |
| 55 #include <vector> | 55 #include <vector> |
| 56 | 56 |
| 57 #include <IOKit/IOKitLib.h> | 57 #include <IOKit/IOKitLib.h> |
| 58 | 58 |
| 59 #include "base/compiler_specific.h" |
| 59 #include "content/browser/device_orientation/data_fetcher.h" | 60 #include "content/browser/device_orientation/data_fetcher.h" |
| 60 | 61 |
| 61 namespace device_orientation { | 62 namespace device_orientation { |
| 62 | 63 |
| 63 // Provides an easy-to-use interface to retrieve data | 64 // Provides an easy-to-use interface to retrieve data |
| 64 // from the MacBook family accelerometer. | 65 // from the MacBook family accelerometer. |
| 65 class AccelerometerMac : public DataFetcher { | 66 class AccelerometerMac : public DataFetcher { |
| 66 public: | 67 public: |
| 67 static DataFetcher* Create(); | 68 static DataFetcher* Create(); |
| 68 | 69 |
| 69 // Implement DataFetcher. | 70 // Implement DataFetcher. |
| 70 virtual bool GetOrientation(Orientation* orientation); | 71 virtual bool GetOrientation(Orientation* orientation) OVERRIDE; |
| 71 | 72 |
| 72 virtual ~AccelerometerMac(); | 73 virtual ~AccelerometerMac(); |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 AccelerometerMac(); | 76 AccelerometerMac(); |
| 76 bool Init(); | 77 bool Init(); |
| 77 | 78 |
| 78 // Extend the sign of an integer of size bytes to a 32-bit one. | 79 // Extend the sign of an integer of size bytes to a 32-bit one. |
| 79 static int ExtendSign(int value, size_t size); | 80 static int ExtendSign(int value, size_t size); |
| 80 | 81 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 // Input memory used for sensor I/O. | 96 // Input memory used for sensor I/O. |
| 96 std::vector<char> input_record_; | 97 std::vector<char> input_record_; |
| 97 | 98 |
| 98 // Output memory used for sensor I/O. | 99 // Output memory used for sensor I/O. |
| 99 std::vector<char> output_record_; | 100 std::vector<char> output_record_; |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 } // namespace device_orientation | 103 } // namespace device_orientation |
| 103 | 104 |
| 104 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ | 105 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_ACCELEROMETER_MAC_H_ |
| OLD | NEW |