| Index: athena/system/orientation_controller.h
|
| diff --git a/athena/system/orientation_controller.h b/athena/system/orientation_controller.h
|
| index 93887889e50bdb22cdb66237d79c385e8336150d..c02a5b0fb7f8c688507e6520482288de3fef55cc 100644
|
| --- a/athena/system/orientation_controller.h
|
| +++ b/athena/system/orientation_controller.h
|
| @@ -5,16 +5,14 @@
|
| #ifndef ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
|
| #define ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
|
|
|
| -#include "athena/system/device_socket_listener.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "chromeos/accelerometer/accelerometer_reader.h"
|
| #include "ui/gfx/display.h"
|
|
|
| namespace base {
|
| -class FilePath;
|
| -class FilePathWatcher;
|
| class TaskRunner;
|
| }
|
|
|
| @@ -23,50 +21,23 @@ namespace athena {
|
| // Monitors accelerometers, detecting orientation changes. When a change is
|
| // detected rotates the root window to match.
|
| class OrientationController
|
| - : public DeviceSocketListener,
|
| - public base::RefCountedThreadSafe<OrientationController> {
|
| + : public chromeos::AccelerometerReader::Delegate {
|
| public:
|
| OrientationController();
|
| -
|
| - void InitWith(scoped_refptr<base::TaskRunner> file_task_runner);
|
| -
|
| - void Shutdown();
|
| -
|
| - private:
|
| - friend class base::RefCountedThreadSafe<OrientationController>;
|
| -
|
| virtual ~OrientationController();
|
|
|
| - void ShutdownOnFILE();
|
| - // Watch for the socket path to be created, called on the FILE thread.
|
| - void WatchForSocketPathOnFILE();
|
| - void OnFilePathChangedOnFILE(const base::FilePath& path, bool error);
|
| -
|
| - // Overridden from device::DeviceSocketListener:
|
| - virtual void OnDataAvailableOnFILE(const void* data) OVERRIDE;
|
| + void InitWith(scoped_refptr<base::TaskRunner> blocking_task_runner);
|
| + void Shutdown();
|
|
|
| - // Rotates the display to |rotation|, called on the UI thread.
|
| - void RotateOnUI(gfx::Display::Rotation rotation);
|
| + // chromeos::AccelerometerReader::Delegate
|
| + virtual void HandleAccelerometerUpdate(
|
| + const ui::AccelerometerUpdate& update) OVERRIDE;
|
|
|
| + private:
|
| // The last configured rotation.
|
| gfx::Display::Rotation current_rotation_;
|
|
|
| - // The timestamp of the last applied orientation change.
|
| - int64_t last_orientation_change_time_;
|
| -
|
| - // True if the OrientaionController has already been shutdown.
|
| - // This is initialized on UI thread, but must be accessed / modified
|
| - // only on FILE thread.
|
| - bool shutdown_;
|
| -
|
| - // A task runner for the UI thread.
|
| - scoped_refptr<base::TaskRunner> ui_task_runner_;
|
| -
|
| - // A task runner for the FILE thread.
|
| - scoped_refptr<base::TaskRunner> file_task_runner_;
|
| -
|
| - // File path watcher used to detect when sensors are present.
|
| - scoped_ptr<base::FilePathWatcher> watcher_;
|
| + scoped_ptr<chromeos::AccelerometerReader> accelerometer_reader_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(OrientationController);
|
| };
|
|
|