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

Unified Diff: content/common/gamepad_user_gesture.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: Next attempt 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: content/common/gamepad_user_gesture.cc
diff --git a/content/common/gamepad_user_gesture.cc b/content/common/gamepad_user_gesture.cc
deleted file mode 100644
index 54220d0e83982ebe7b37c76ff8fb807a7c513f4f..0000000000000000000000000000000000000000
--- a/content/common/gamepad_user_gesture.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/common/gamepad_user_gesture.h"
-
-#include <math.h>
-
-#include <algorithm>
-
-#include "third_party/WebKit/public/platform/WebGamepads.h"
-
-namespace {
-// A big enough deadzone to detect accidental presses.
-const float kAxisMoveAmountThreshold = 0.5;
-}
-
-namespace content {
-
-bool GamepadsHaveUserGesture(const blink::WebGamepads& gamepads) {
- for (unsigned int i = 0; i < blink::WebGamepads::itemsLengthCap; i++) {
- const blink::WebGamepad& pad = gamepads.items[i];
-
- // If the device is physically connected, then check the buttons and axes
- // to see if there is currently an intentional user action.
- if (pad.connected) {
- for (unsigned int button_index = 0; button_index < pad.buttonsLength;
- button_index++) {
- if (pad.buttons[button_index].pressed)
- return true;
- }
-
- for (unsigned int axes_index = 0; axes_index < pad.axesLength;
- axes_index++) {
- if (fabs(pad.axes[axes_index]) > kAxisMoveAmountThreshold)
- return true;
- }
- }
- }
- return false;
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698