| Index: athena/system/orientation_controller.cc
|
| diff --git a/athena/system/orientation_controller.cc b/athena/system/orientation_controller.cc
|
| deleted file mode 100644
|
| index f52b2ed9d2aaa000aa51d80547e68427d0805e09..0000000000000000000000000000000000000000
|
| --- a/athena/system/orientation_controller.cc
|
| +++ /dev/null
|
| @@ -1,68 +0,0 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "athena/screen/public/screen_manager.h"
|
| -#include "athena/system/orientation_controller.h"
|
| -#include "base/bind.h"
|
| -#include "base/files/file_path_watcher.h"
|
| -#include "base/files/file_util.h"
|
| -#include "base/message_loop/message_loop.h"
|
| -#include "base/task_runner.h"
|
| -#include "chromeos/accelerometer/accelerometer_reader.h"
|
| -
|
| -namespace athena {
|
| -
|
| -namespace {
|
| -
|
| -// Threshold after which to rotate in a given direction.
|
| -const int kGravityThreshold = 6.0f;
|
| -
|
| -} // namespace
|
| -
|
| -OrientationController::OrientationController() {
|
| -}
|
| -
|
| -void OrientationController::InitWith(
|
| - scoped_refptr<base::TaskRunner> blocking_task_runner) {
|
| - chromeos::AccelerometerReader::GetInstance()->Initialize(
|
| - blocking_task_runner);
|
| - chromeos::AccelerometerReader::GetInstance()->AddObserver(this);
|
| -}
|
| -
|
| -OrientationController::~OrientationController() {
|
| -}
|
| -
|
| -void OrientationController::Shutdown() {
|
| - chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this);
|
| -}
|
| -
|
| -void OrientationController::OnAccelerometerUpdated(
|
| - const ui::AccelerometerUpdate& update) {
|
| - if (!update.has(ui::ACCELEROMETER_SOURCE_SCREEN))
|
| - return;
|
| -
|
| - float gravity_x = update.get(ui::ACCELEROMETER_SOURCE_SCREEN).x();
|
| - float gravity_y = update.get(ui::ACCELEROMETER_SOURCE_SCREEN).y();
|
| - gfx::Display::Rotation rotation;
|
| - if (gravity_x < -kGravityThreshold) {
|
| - rotation = gfx::Display::ROTATE_270;
|
| - } else if (gravity_x > kGravityThreshold) {
|
| - rotation = gfx::Display::ROTATE_90;
|
| - } else if (gravity_y < -kGravityThreshold) {
|
| - rotation = gfx::Display::ROTATE_180;
|
| - } else if (gravity_y > kGravityThreshold) {
|
| - rotation = gfx::Display::ROTATE_0;
|
| - } else {
|
| - // No rotation as gravity threshold was not hit.
|
| - return;
|
| - }
|
| -
|
| - if (rotation == current_rotation_)
|
| - return;
|
| -
|
| - current_rotation_ = rotation;
|
| - ScreenManager::Get()->SetRotation(rotation);
|
| -}
|
| -
|
| -} // namespace athena
|
|
|