Commit f464d9f1 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Move WebGamepadListener out of public/platform

//third_party/blink/renderer/modules/gamepad is the only user of
blink::WebGamepadListener. Move its definition there as
blink::GamepadListener.

Also remove blink::WebPlatformEventListener, which was only used by
blink::WebGamepadListener as an empty parent class.

Bug: 919392
Change-Id: If7831dccc0ff405264320c2bd08c586a872f0422
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886891Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarBalazs Kelemen <b.kelemen@samsung.com>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#712248}
parent 5253e325
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include "content/shell/test_runner/gamepad_controller.h" #include "content/shell/test_runner/gamepad_controller.h"
#include <string.h> #include <string>
#include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include "gin/wrappable.h" #include "gin/wrappable.h"
#include "mojo/public/cpp/system/platform_handle.h" #include "mojo/public/cpp/system/platform_handle.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/web_gamepad_listener.h"
#include "third_party/blink/public/web/blink.h" #include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
......
...@@ -219,7 +219,6 @@ source_set("blink_headers") { ...@@ -219,7 +219,6 @@ source_set("blink_headers") {
"platform/web_font.h", "platform/web_font.h",
"platform/web_font_description.h", "platform/web_font_description.h",
"platform/web_font_render_style.h", "platform/web_font_render_style.h",
"platform/web_gamepad_listener.h",
"platform/web_gesture_curve.h", "platform/web_gesture_curve.h",
"platform/web_gesture_device.h", "platform/web_gesture_device.h",
"platform/web_gesture_event.h", "platform/web_gesture_event.h",
...@@ -261,7 +260,6 @@ source_set("blink_headers") { ...@@ -261,7 +260,6 @@ source_set("blink_headers") {
"platform/web_mouse_wheel_event.h", "platform/web_mouse_wheel_event.h",
"platform/web_navigation_body_loader.h", "platform/web_navigation_body_loader.h",
"platform/web_network_state_notifier.h", "platform/web_network_state_notifier.h",
"platform/web_platform_event_listener.h",
"platform/web_point.h", "platform/web_point.h",
"platform/web_pointer_event.h", "platform/web_pointer_event.h",
"platform/web_pointer_properties.h", "platform/web_pointer_properties.h",
......
// Copyright 2014 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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_PLATFORM_EVENT_LISTENER_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_PLATFORM_EVENT_LISTENER_H_
namespace blink {
class WebPlatformEventListener {
public:
virtual ~WebPlatformEventListener() = default;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_PLATFORM_EVENT_LISTENER_H_
...@@ -24,6 +24,7 @@ blink_modules_sources("gamepad") { ...@@ -24,6 +24,7 @@ blink_modules_sources("gamepad") {
"gamepad_haptic_actuator.h", "gamepad_haptic_actuator.h",
"gamepad_list.cc", "gamepad_list.cc",
"gamepad_list.h", "gamepad_list.h",
"gamepad_listener.h",
"gamepad_shared_memory_reader.cc", "gamepad_shared_memory_reader.cc",
"gamepad_shared_memory_reader.h", "gamepad_shared_memory_reader.h",
"navigator_gamepad.cc", "navigator_gamepad.cc",
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "device/gamepad/public/mojom/gamepad.mojom-blink.h" #include "device/gamepad/public/mojom/gamepad.mojom-blink.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/platform/web_gamepad_listener.h"
#include "third_party/blink/renderer/core/frame/platform_event_dispatcher.h" #include "third_party/blink/renderer/core/frame/platform_event_dispatcher.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_listener.h"
namespace device { namespace device {
class Gamepad; class Gamepad;
...@@ -24,7 +24,7 @@ class GamepadSharedMemoryReader; ...@@ -24,7 +24,7 @@ class GamepadSharedMemoryReader;
class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>, class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>,
public PlatformEventDispatcher, public PlatformEventDispatcher,
public WebGamepadListener { public GamepadListener {
USING_GARBAGE_COLLECTED_MIXIN(GamepadDispatcher); USING_GARBAGE_COLLECTED_MIXIN(GamepadDispatcher);
public: public:
...@@ -48,7 +48,7 @@ class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>, ...@@ -48,7 +48,7 @@ class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>,
private: private:
void InitializeHaptics(); void InitializeHaptics();
// WebGamepadListener // GamepadListener
void DidConnectGamepad(uint32_t index, const device::Gamepad&) override; void DidConnectGamepad(uint32_t index, const device::Gamepad&) override;
void DidDisconnectGamepad(uint32_t index, const device::Gamepad&) override; void DidDisconnectGamepad(uint32_t index, const device::Gamepad&) override;
void ButtonOrAxisDidChange(uint32_t index, const device::Gamepad&) override; void ButtonOrAxisDidChange(uint32_t index, const device::Gamepad&) override;
...@@ -69,4 +69,4 @@ class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>, ...@@ -69,4 +69,4 @@ class GamepadDispatcher final : public GarbageCollected<GamepadDispatcher>,
} // namespace blink } // namespace blink
#endif #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_DISPATCHER_H_
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_GAMEPAD_LISTENER_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_LISTENER_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_GAMEPAD_LISTENER_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_LISTENER_H_
#include "third_party/blink/public/platform/web_platform_event_listener.h"
namespace device { namespace device {
class Gamepad; class Gamepad;
...@@ -13,8 +11,10 @@ class Gamepad; ...@@ -13,8 +11,10 @@ class Gamepad;
namespace blink { namespace blink {
class WebGamepadListener : public WebPlatformEventListener { class GamepadListener {
public: public:
virtual ~GamepadListener() = default;
// Called when a gamepad is connected. |index| is the index of the gamepad in // Called when a gamepad is connected. |index| is the index of the gamepad in
// the gamepad array, and |gamepad| is a reference to the connected gamepad. // the gamepad array, and |gamepad| is a reference to the connected gamepad.
virtual void DidConnectGamepad(uint32_t index, virtual void DidConnectGamepad(uint32_t index,
...@@ -31,11 +31,8 @@ class WebGamepadListener : public WebPlatformEventListener { ...@@ -31,11 +31,8 @@ class WebGamepadListener : public WebPlatformEventListener {
// to the gamepad. // to the gamepad.
virtual void ButtonOrAxisDidChange(uint32_t index, virtual void ButtonOrAxisDidChange(uint32_t index,
const device::Gamepad& gamepad) = 0; const device::Gamepad& gamepad) = 0;
protected:
~WebGamepadListener() override = default;
}; };
} // namespace blink } // namespace blink
#endif #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_GAMEPAD_GAMEPAD_LISTENER_H_
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/interface_provider.h" #include "third_party/blink/public/platform/interface_provider.h"
#include "third_party/blink/public/platform/web_gamepad_listener.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad_listener.h"
namespace blink { namespace blink {
...@@ -39,7 +39,7 @@ void GamepadSharedMemoryReader::SendStopMessage() { ...@@ -39,7 +39,7 @@ void GamepadSharedMemoryReader::SendStopMessage() {
} }
} }
void GamepadSharedMemoryReader::Start(blink::WebGamepadListener* listener) { void GamepadSharedMemoryReader::Start(blink::GamepadListener* listener) {
DCHECK(!listener_); DCHECK(!listener_);
listener_ = listener; listener_ = listener;
......
...@@ -25,8 +25,8 @@ class Gamepads; ...@@ -25,8 +25,8 @@ class Gamepads;
namespace blink { namespace blink {
class GamepadListener;
class LocalFrame; class LocalFrame;
class WebGamepadListener;
class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver { class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver {
public: public:
...@@ -34,7 +34,7 @@ class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver { ...@@ -34,7 +34,7 @@ class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver {
~GamepadSharedMemoryReader() override; ~GamepadSharedMemoryReader() override;
void SampleGamepads(device::Gamepads& gamepads); void SampleGamepads(device::Gamepads& gamepads);
void Start(blink::WebGamepadListener* listener); void Start(blink::GamepadListener* listener);
void Stop(); void Stop();
protected: protected:
...@@ -58,7 +58,7 @@ class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver { ...@@ -58,7 +58,7 @@ class GamepadSharedMemoryReader : public device::mojom::blink::GamepadObserver {
mojo::Receiver<device::mojom::blink::GamepadObserver> receiver_{this}; mojo::Receiver<device::mojom::blink::GamepadObserver> receiver_{this};
mojo::Remote<device::mojom::blink::GamepadMonitor> gamepad_monitor_remote_; mojo::Remote<device::mojom::blink::GamepadMonitor> gamepad_monitor_remote_;
blink::WebGamepadListener* listener_ = nullptr; blink::GamepadListener* listener_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader); DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment