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

Unified Diff: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc

Issue 2396663002: Reland gvr upgrade (Closed)
Patch Set: Created 4 years, 2 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
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 34b44272fb61e778aec2d84ffa291d13670c0d89..17bc49a7a358822c037493cbef2544a44c8ec9dd 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
@@ -54,6 +54,8 @@ GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate,
bool success = controller_api_->Init(options, gvr_api->GetContext());
if (!success)
controller_api_.reset(nullptr);
+
+ user_prefs_.reset(new gvr::UserPrefs(gvr_api->GetUserPrefs().cobj()));
}
GvrGamepadDataFetcher::~GvrGamepadDataFetcher() {}
@@ -94,7 +96,9 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
pad.timestamp = controller_state_.GetLastOrientationTimestamp();
// TODO: Query from API if avaialable.
- pad.hand = GamepadHandRight;
+ 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();

Powered by Google App Engine
This is Rietveld 408576698