Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / accelerometer / accelerometer_controller.cc
bloba8de559e1d4a7881c669ccf7f614f67cb8f42638
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"
10 namespace ash {
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));
22 #endif
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));
40 #endif
42 } // namespace ash