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

Unified Diff: chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h

Issue 2006083002: Use fake Input Device Settings with chrome://device-emulator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DevicePageTestsFixes
Patch Set: Created 4 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: chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
index 0af60a94ed3439a657eaafb3bab3cf3503b69062..e3853bc0bbda27e372503cf9cb03bd3fadfa7bbd 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
@@ -8,6 +8,8 @@
#include <memory>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/system/pointer_device_observer.h"
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "content/public/browser/web_ui_message_handler.h"
@@ -28,9 +30,14 @@ namespace chromeos {
class FakeCrasAudioClient;
class FakePowerManagerClient;
+namespace system {
+class FakeInputDeviceSettings;
+}
+
// Handler class for the Device Emulator page operations.
class DeviceEmulatorMessageHandler
- : public content::WebUIMessageHandler {
+ : public content::WebUIMessageHandler,
+ public system::PointerDeviceObserver::Observer {
public:
DeviceEmulatorMessageHandler();
~DeviceEmulatorMessageHandler() override;
@@ -72,6 +79,12 @@ class DeviceEmulatorMessageHandler
// based on the node id.
void HandleRemoveAudioNode(const base::ListValue* args);
+ // Connects or disconnects a fake mouse.
+ void HandleSetHasMouse(const base::ListValue* args);
+
+ // Connects or disconnects a fake touchpad.
+ void HandleSetHasTouchpad(const base::ListValue* args);
+
// Callbacks for JS update methods. All these methods work
// asynchronously.
void UpdateBatteryPercent(const base::ListValue* args);
@@ -108,6 +121,15 @@ class DeviceEmulatorMessageHandler
std::unique_ptr<base::DictionaryValue> GetDeviceInfo(
const dbus::ObjectPath& object_path);
+ // Ensures the fake_input_device_settings_ pointer is valid (equal to the
+ // global InputDeviceSettings instance) or creates a new one. Returns a valid
+ // FakeInputDeviceSettings.
+ system::FakeInputDeviceSettings* CreateFakeInputDeviceSettingsIfNecessary();
+
+ // system::PointerDeviceObserver::Observer:
+ void TouchpadExists(bool exists) override;
+ void MouseExists(bool exists) override;
+
bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
std::unique_ptr<BluetoothObserver> bluetooth_observer_;
@@ -117,6 +139,10 @@ class DeviceEmulatorMessageHandler
FakePowerManagerClient* fake_power_manager_client_;
std::unique_ptr<PowerObserver> power_observer_;
+ system::FakeInputDeviceSettings* fake_input_device_settings_;
+
+ base::WeakPtrFactory<DeviceEmulatorMessageHandler> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DeviceEmulatorMessageHandler);
};

Powered by Google App Engine
This is Rietveld 408576698