Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: athena/system/orientation_controller.cc

Issue 863033002: Delete athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/system/orientation_controller.h ('k') | athena/system/public/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « athena/system/orientation_controller.h ('k') | athena/system/public/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698