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

Unified Diff: components/exo/gaming_seat.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.h
diff --git a/components/exo/gaming_seat.h b/components/exo/gaming_seat.h
index 40e44ae33352eeb4cf86c473177ce37d6e52c548..1f802875db554fb5c23575abcdff158e170142a7 100644
--- a/components/exo/gaming_seat.h
+++ b/components/exo/gaming_seat.h
@@ -5,72 +5,23 @@
#ifndef COMPONENTS_EXO_GAMING_SEAT_H_
#define COMPONENTS_EXO_GAMING_SEAT_H_
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/sequenced_task_runner.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "components/exo/wm_helper.h"
-#include "device/gamepad/gamepad_data_fetcher.h"
-#include "ui/aura/client/focus_change_observer.h"
+
+namespace base {
+class Thread;
+}
namespace exo {
class GamingSeatDelegate;
-class GamepadDelegate;
-using CreateGamepadDataFetcherCallback =
- base::Callback<std::unique_ptr<device::GamepadDataFetcher>()>;
-
-// This class represents one gaming seat, it uses a background thread
-// for polling gamepad devices and notifies the corresponding GampadDelegate of
-// any changes.
+// TODO(jkwang): Remove this GamingSeat and always use ozone gamepad once ozone
+// is default for all chrome os.
class GamingSeat : public WMHelper::FocusObserver {
public:
- // This class will post tasks to invoke the delegate on the thread runner
- // which is associated with the thread that is creating this instance.
- GamingSeat(GamingSeatDelegate* gaming_seat_delegate,
- base::SingleThreadTaskRunner* polling_task_runner);
-
- // Allows test cases to specify a CreateGamepadDataFetcherCallback that
- // overrides the default GamepadPlatformDataFetcher.
- GamingSeat(GamingSeatDelegate* gaming_seat_delegate,
- base::SingleThreadTaskRunner* polling_task_runner,
- CreateGamepadDataFetcherCallback create_fetcher_callback);
-
- ~GamingSeat() override;
-
- // Overridden WMHelper::FocusObserver:
- void OnWindowFocused(aura::Window* gained_focus,
- aura::Window* lost_focus) override;
-
- private:
- class ThreadSafeGamepadChangeFetcher;
-
- // Processes updates of gamepad data and passes changes on to delegate.
- void ProcessGamepadChanges(int index, const device::Gamepad new_pad);
-
- // Private implementation of methods and resources that are used on the
- // polling thread.
- scoped_refptr<ThreadSafeGamepadChangeFetcher> gamepad_change_fetcher_;
-
- // The delegate that handles gamepad_added.
- GamingSeatDelegate* const delegate_;
-
- // The delegate instances that all other events are dispatched to.
- GamepadDelegate* gamepad_delegates_[device::Gamepads::kItemsLengthCap];
-
- // The current state of the gamepad represented by this instance.
- device::Gamepads pad_state_;
-
- // ThreadChecker for the origin thread.
- base::ThreadChecker thread_checker_;
-
- base::WeakPtrFactory<GamingSeat> weak_ptr_factory_;
+ static base::Thread* CreatePollingThreadIfNeeded();
- DISALLOW_COPY_AND_ASSIGN(GamingSeat);
+ static GamingSeat* CreateGamingSeat(GamingSeatDelegate* gaming_seat_delegate,
reveman 2017/05/31 22:42:23 do we need to use a factory pattern if this is now
jkwang 2017/06/01 19:43:15 No..It does not need to be like this, but I would
reveman 2017/06/01 22:24:52 Performance is not a concern of mine. Making the c
+ base::Thread* polling_thread);
};
} // namespace exo

Powered by Google App Engine
This is Rietveld 408576698