1 // Copyright 2014 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.
5 #ifndef ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
6 #define ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chromeos/accelerometer/accelerometer_reader.h"
13 #include "ui/gfx/display.h"
21 // Monitors accelerometers, detecting orientation changes. When a change is
22 // detected rotates the root window to match.
23 class OrientationController
24 : public chromeos::AccelerometerReader::Delegate
{
26 OrientationController();
27 virtual ~OrientationController();
29 void InitWith(scoped_refptr
<base::TaskRunner
> blocking_task_runner
);
32 // chromeos::AccelerometerReader::Delegate
33 virtual void HandleAccelerometerUpdate(
34 const ui::AccelerometerUpdate
& update
) OVERRIDE
;
37 // The last configured rotation.
38 gfx::Display::Rotation current_rotation_
;
40 scoped_ptr
<chromeos::AccelerometerReader
> accelerometer_reader_
;
42 DISALLOW_COPY_AND_ASSIGN(OrientationController
);
47 #endif // ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_