Split GamepadActiveState into separate flags

The Gamepad service allows gamepads to be enumerated by a number
of distinct data fetchers which feed into a central gamepad provider.
The provider is responsible for managing the state and ordering of
connected gamepads as well as issuing notifications when gamepads are
connected or disconnected.

PadState's |active_state| member indicates the gamepad's current
connection status as "inactive" (not receiving updates), "active"
(recently received an update), or "newly active" (just connected).
This state used for three tasks:

* A connection event is fired when the gamepad is first connected.
* A disconnection event is fired when the gamepad is no longer
  connected.
* The data fetcher performs some first-time initialization when the
  gamepad is first connected.

This CL splits |active_state| into separate flags to address each case.

* |is_active| is used to detect the current connection status. It is
  initialized to false for each polling cycle and set to true once
  the PadState is accessed. If this flag is false after a polling
  cycle, the gamepad is considered disconnected.
* |is_newly_active| is initialized to true when the PadState slot is
  allocated and set to false once the gamepad connection event has
  been issued.
* |is_initialized| is initialized to false when the PadState slot is
  allocated and may be set to true by the data fetcher to indicate
  that it has performed first-time initialization for this gamepad.

BUG=749295

Change-Id: I2c99e766c900c9c92a5bffecb12ec283739f2597
Reviewed-on: https://chromium-review.googlesource.com/896028
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534503}
10 files changed