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

Unified Diff: components/exo/gaming_seat_ozone.h

Issue 2900773003: Allow gaming_seat to use ozone gamepad as back-end (Closed)
Patch Set: Add gaming_seat_ozone to exo Created 3 years, 7 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/gaming_seat_ozone.h
diff --git a/components/exo/gaming_seat_ozone.h b/components/exo/gaming_seat_ozone.h
new file mode 100644
index 0000000000000000000000000000000000000000..91d9f7ec6436fff64d12b92af4f6d8c3fe679a8f
--- /dev/null
+++ b/components/exo/gaming_seat_ozone.h
@@ -0,0 +1,54 @@
+// Copyright 2017 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_GAMING_SEAT_OZONE_H_
+#define COMPONENTS_EXO_GAMING_SEAT_OZONE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/exo/gaming_seat.h"
+#include "components/exo/wm_helper.h"
+#include "ui/events/ozone/gamepad/gamepad_observer.h"
+
+namespace ui {
+class GamepadProviderOzone;
+}
+
+namespace exo {
+class GamingSeatDelegate;
+class GamepadDelegate;
+
+class GamingSeatOzone : public GamingSeat, public ui::GamepadObserver {
+ public:
+ GamingSeatOzone(GamingSeatDelegate* delegate);
+
+ ~GamingSeatOzone() override;
+
+ // Overriden ui::GamepadObserver.
+ void OnGamepadDevicesUpdated() override;
+ void OnGamepadEvent(const ui::GamepadEvent& event) override;
+
+ // Overridden WMHelper::FocusObserver:
+ void OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) override;
+
+ private:
+ // Enable or disable this gaming seat.
+ void Enable(bool enable);
+
+ // The delegate that handles gamepad_added.
+ GamingSeatDelegate* const delegate_;
+
+ // This map maps device id to gamepad delegates.
+ std::map<int, GamepadDelegate*> gamepads_;
+
+ ui::GamepadProviderOzone* gamepad_provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(GamingSeatOzone);
+};
+
+} // namespace exo
+
+#endif // COMPONENTS_EXO_GAMING_SEAT_JOYDEV_H_

Powered by Google App Engine
This is Rietveld 408576698