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

Unified Diff: device/gamepad/gamepad_standard_mappings.cc

Issue 2081583002: Migrating majority of gamepad from content/browser/ to device/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Android and Unit tests Created 4 years, 6 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/gamepad/gamepad_standard_mappings.cc
diff --git a/content/browser/gamepad/gamepad_standard_mappings.cc b/device/gamepad/gamepad_standard_mappings.cc
similarity index 78%
rename from content/browser/gamepad/gamepad_standard_mappings.cc
rename to device/gamepad/gamepad_standard_mappings.cc
index 687d4ce154d5e6a0303a9b64b9210bef65aa5da8..d76d06dd9f273648fe5955b42719ad43fd958c88 100644
--- a/content/browser/gamepad/gamepad_standard_mappings.cc
+++ b/device/gamepad/gamepad_standard_mappings.cc
@@ -2,30 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/gamepad/gamepad_standard_mappings.h"
+#include "device/gamepad/gamepad_standard_mappings.h"
-namespace content {
+namespace device {
blink::WebGamepadButton AxisToButton(float input) {
float value = (input + 1.f) / 2.f;
- return blink::WebGamepadButton(
- value > kDefaultButtonPressedThreshold, value);
+ return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
}
blink::WebGamepadButton AxisNegativeAsButton(float input) {
float value = (input < -0.5f) ? 1.f : 0.f;
- return blink::WebGamepadButton(
- value > kDefaultButtonPressedThreshold, value);
+ return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
}
blink::WebGamepadButton AxisPositiveAsButton(float input) {
float value = (input > 0.5f) ? 1.f : 0.f;
- return blink::WebGamepadButton(
- value > kDefaultButtonPressedThreshold, value);
+ return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
}
-blink::WebGamepadButton ButtonFromButtonAndAxis(
- blink::WebGamepadButton button, float axis) {
+blink::WebGamepadButton ButtonFromButtonAndAxis(blink::WebGamepadButton button,
+ float axis) {
float value = (axis + 1.f) / 2.f;
return blink::WebGamepadButton(button.pressed, value);
}
@@ -61,4 +58,4 @@ void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
mapped->buttons[BUTTON_INDEX_DPAD_LEFT].value = left ? 1.f : 0.f;
}
-} // namespace content
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698