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

Unified Diff: athena/system/orientation_controller.h

Issue 576113002: Reland "Use chromeos accelerometer reader and support only lid accelerometer. (patchset #3 id:60001… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile. Created 6 years, 3 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/device_socket_listener.cc ('k') | athena/system/orientation_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/system/orientation_controller.h
diff --git a/athena/system/orientation_controller.h b/athena/system/orientation_controller.h
index 93887889e50bdb22cdb66237d79c385e8336150d..c02a5b0fb7f8c688507e6520482288de3fef55cc 100644
--- a/athena/system/orientation_controller.h
+++ b/athena/system/orientation_controller.h
@@ -5,16 +5,14 @@
#ifndef ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
#define ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
-#include "athena/system/device_socket_listener.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "chromeos/accelerometer/accelerometer_reader.h"
#include "ui/gfx/display.h"
namespace base {
-class FilePath;
-class FilePathWatcher;
class TaskRunner;
}
@@ -23,50 +21,23 @@ namespace athena {
// Monitors accelerometers, detecting orientation changes. When a change is
// detected rotates the root window to match.
class OrientationController
- : public DeviceSocketListener,
- public base::RefCountedThreadSafe<OrientationController> {
+ : public chromeos::AccelerometerReader::Delegate {
public:
OrientationController();
-
- void InitWith(scoped_refptr<base::TaskRunner> file_task_runner);
-
- void Shutdown();
-
- private:
- friend class base::RefCountedThreadSafe<OrientationController>;
-
virtual ~OrientationController();
- void ShutdownOnFILE();
- // Watch for the socket path to be created, called on the FILE thread.
- void WatchForSocketPathOnFILE();
- void OnFilePathChangedOnFILE(const base::FilePath& path, bool error);
-
- // Overridden from device::DeviceSocketListener:
- virtual void OnDataAvailableOnFILE(const void* data) OVERRIDE;
+ void InitWith(scoped_refptr<base::TaskRunner> blocking_task_runner);
+ void Shutdown();
- // Rotates the display to |rotation|, called on the UI thread.
- void RotateOnUI(gfx::Display::Rotation rotation);
+ // chromeos::AccelerometerReader::Delegate
+ virtual void HandleAccelerometerUpdate(
+ const ui::AccelerometerUpdate& update) OVERRIDE;
+ private:
// The last configured rotation.
gfx::Display::Rotation current_rotation_;
- // The timestamp of the last applied orientation change.
- int64_t last_orientation_change_time_;
-
- // True if the OrientaionController has already been shutdown.
- // This is initialized on UI thread, but must be accessed / modified
- // only on FILE thread.
- bool shutdown_;
-
- // A task runner for the UI thread.
- scoped_refptr<base::TaskRunner> ui_task_runner_;
-
- // A task runner for the FILE thread.
- scoped_refptr<base::TaskRunner> file_task_runner_;
-
- // File path watcher used to detect when sensors are present.
- scoped_ptr<base::FilePathWatcher> watcher_;
+ scoped_ptr<chromeos::AccelerometerReader> accelerometer_reader_;
DISALLOW_COPY_AND_ASSIGN(OrientationController);
};
« no previous file with comments | « athena/system/device_socket_listener.cc ('k') | athena/system/orientation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698