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 #include "ash/accelerometer/accelerometer_controller.h"
7 #include "ash/accelerometer/accelerometer_observer.h"
8 #include "ui/gfx/geometry/vector3d_f.h"
12 AccelerometerController::AccelerometerController() {
15 AccelerometerController::~AccelerometerController() {
18 void AccelerometerController::Initialize(
19 scoped_refptr
<base::TaskRunner
> blocking_task_runner
) {
20 #if defined(OS_CHROMEOS)
21 reader_
.reset(new chromeos::AccelerometerReader(blocking_task_runner
, this));
25 void AccelerometerController::AddObserver(AccelerometerObserver
* observer
) {
26 observers_
.AddObserver(observer
);
29 void AccelerometerController::RemoveObserver(AccelerometerObserver
* observer
) {
30 observers_
.RemoveObserver(observer
);
33 #if defined(OS_CHROMEOS)
34 void AccelerometerController::HandleAccelerometerReading(
35 const gfx::Vector3dF
& base
,
36 const gfx::Vector3dF
& lid
) {
37 FOR_EACH_OBSERVER(AccelerometerObserver
, observers_
,
38 OnAccelerometerUpdated(base
, lid
));