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

Unified Diff: components/exo/gamepad_delegate.h

Issue 2076013002: exo: Implement wayland gamepad support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serv
Patch Set: Focus handling. Process gamepad delta on origin thread. Add focus unittest. 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: 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..53044134b6c7325c1231ef20a6fec2f890a5b509
--- /dev/null
+++ b/components/exo/gamepad_delegate.h
@@ -0,0 +1,46 @@
+// 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;
+class Surface;
+
+// 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;
+
+ // This should return true if |surface| is a valid target for this gamepad.
+ // E.g. the surface is owned by the same client as the gamepad.
+ virtual bool CanAcceptGamepadEventsForSurface(Surface* surface) const = 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;
+
+ protected:
+ virtual ~GamepadDelegate() {}
+};
+
+} // namespace exo
+
+#endif // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698