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

Unified Diff: athena/system/orientation_controller.cc

Issue 795333002: Refactor AccelerometerReader to provide an Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: athena/system/orientation_controller.cc
diff --git a/athena/system/orientation_controller.cc b/athena/system/orientation_controller.cc
index 93d0bf10023ec850f1f47670847efee5e4a0c184..6b294af25e7f5e4d087d2df9f84e82c7f5dff305 100644
--- a/athena/system/orientation_controller.cc
+++ b/athena/system/orientation_controller.cc
@@ -24,18 +24,20 @@ OrientationController::OrientationController() {
void OrientationController::InitWith(
scoped_refptr<base::TaskRunner> blocking_task_runner) {
- accelerometer_reader_.reset(
- new chromeos::AccelerometerReader(blocking_task_runner, this));
+ accelerometer_reader_.reset(new chromeos::AccelerometerReader());
+ accelerometer_reader_->Initialize(blocking_task_runner);
+ accelerometer_reader_->AddObserver(this);
}
OrientationController::~OrientationController() {
}
void OrientationController::Shutdown() {
+ accelerometer_reader_->RemoveObserver(this);
accelerometer_reader_.reset();
}
-void OrientationController::HandleAccelerometerUpdate(
+void OrientationController::OnAccelerometerUpdated(
const ui::AccelerometerUpdate& update) {
if (!update.has(ui::ACCELEROMETER_SOURCE_SCREEN))
return;

Powered by Google App Engine
This is Rietveld 408576698