Chromium Code Reviews| Index: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc |
| diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc |
| index 219897a60bc8a0a15bbe6f11ccf5b7289bd3cf0d..9f7f391952872f3472d577d5d46c67a675fc94a6 100644 |
| --- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc |
| +++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc |
| @@ -57,7 +57,8 @@ GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate, |
| if (!success) |
| controller_api_.reset(nullptr); |
| - user_prefs_.reset(new gvr::UserPrefs(gvr_api->GetUserPrefs().cobj())); |
|
billorr
2016/11/18 22:27:52
I assume the bug is that the user_prefs_ object go
|
| + // TODO(bajones): Monitor changes to the controller handedness. |
| + handedness_ = gvr_api->GetUserPrefs().GetControllerHandedness(); |
| } |
| GvrGamepadDataFetcher::~GvrGamepadDataFetcher() {} |
| @@ -91,17 +92,15 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) { |
| pad.axesLength = 2; |
| pad.displayId = display_id_; |
| + |
| + pad.hand = (handedness_ == GVR_CONTROLLER_RIGHT_HANDED) ? GamepadHandRight |
| + : GamepadHandLeft; |
| } |
| controller_state_.Update(*controller_api_); |
| pad.timestamp = controller_state_.GetLastOrientationTimestamp(); |
| - // TODO: Query from API if avaialable. |
| - gvr::ControllerHandedness handedness = user_prefs_->GetControllerHandedness(); |
| - pad.hand = (handedness == GVR_CONTROLLER_RIGHT_HANDED) ? GamepadHandRight |
| - : GamepadHandLeft; |
| - |
| if (controller_state_.IsTouching()) { |
| gvr_vec2f touch_position = controller_state_.GetTouchPos(); |
| pad.axes[0] = (touch_position.x * 2.0f) - 1.0f; |