This source file includes following definitions.
- GamepadsHaveUserGesture
#include "content/common/gamepad_user_gesture.h"
#include <algorithm>
#include "third_party/WebKit/public/platform/WebGamepads.h"
namespace content {
bool GamepadsHaveUserGesture(const blink::WebGamepads& gamepads) {
for (unsigned i = 0; i < blink::WebGamepads::itemsLengthCap; i++) {
const blink::WebGamepad& pad = gamepads.items[i];
if (pad.connected) {
const unsigned kPrimaryInteractionButtons = 4;
unsigned buttons_to_check = std::min(pad.buttonsLength,
kPrimaryInteractionButtons);
for (unsigned button_index = 0; button_index < buttons_to_check;
button_index++) {
if (pad.buttons[button_index].pressed)
return true;
}
}
}
return false;
}
}