Chromium Code Reviews| Index: components/exo/gamepad_delegate.h |
| diff --git a/components/exo/gamepad_delegate.h b/components/exo/gamepad_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..56107fa1509d19ce0fbab9e80ecefb7c9c21da86 |
| --- /dev/null |
| +++ b/components/exo/gamepad_delegate.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ |
| +#define COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| + |
| +namespace exo { |
| +class Gamepad; |
| + |
| +// Handles events on multiple gamepad |
| +class GamepadDelegate { |
| + public: |
| + // Gives the delegate a chance to clean up when the Gamepad instance is |
| + // destroyed. |
| + virtual void OnGamepadDestroying(Gamepad* gamepad) = 0; |
| + |
| + // Called when the state of the gamepad has changed. |
| + virtual void OnStateChange(bool connected) = 0; |
| + |
| + // Called when the user moved an axis of the gamepad. Valid axes are defined |
| + // by the W3C 'standard gamepad' specification. |
| + virtual void OnAxis(int axis, double value) = 0; |
| + |
| + // Called when the user pressed or moved a button of the gamepad. |
| + // Valid buttons are defined by the W3C 'standard gamepad' specification. |
| + virtual void OnButton(int button, bool pressed, double value) = 0; |
| + |
| + // Called after all gamepad information of this frame has been set and the |
| + // client should evaluate the updated state. |
| + virtual void OnFrame() = 0; |
| + |
| + // Used to obtain a weak pointer to this delegate. |
| + virtual base::WeakPtr<GamepadDelegate> GetWeakPtr() = 0; |
|
reveman
2016/06/30 01:19:05
Please handle this in the Gamepad implementation i
denniskempin
2016/06/30 17:08:29
Done. Also no longer needed.
|
| + |
| + protected: |
| + virtual ~GamepadDelegate() {} |
| +}; |
| + |
| +} // namespace exo |
| + |
| +#endif // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ |