Commit 6f83c7da authored by pkotwicz's avatar pkotwicz Committed by Commit bot

Remove useless InputDevice::name field

BUG=None
TEST=None
R=sadrul
TBR=oshima

Review URL: https://codereview.chromium.org/904733002

Cr-Commit-Position: refs/heads/master@{#315072}
parent e2b6ce8d
......@@ -17,14 +17,13 @@ void VirtualKeyboardTestHelper::SuppressKeyboard() {
ui::DeviceHotplugEventObserver* manager =
ui::DeviceDataManager::GetInstance();
std::vector<ui::TouchscreenDevice> screens;
screens.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
screens.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
manager->OnTouchscreenDevicesUpdated(screens);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
manager->OnKeyboardDevicesUpdated(keyboards);
}
......
......@@ -33,7 +33,7 @@ DisplayInfo CreateDisplayInfo(int64 id,
ui::TouchscreenDevice CreateTouchscreenDevice(unsigned int id,
const gfx::Size& size) {
return ui::TouchscreenDevice(id, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL,
std::string(), size, 0);
size, 0);
}
} // namespace
......
......@@ -76,12 +76,10 @@ TEST_F(TouchscreenUtilTest, NoTouchscreens) {
TEST_F(TouchscreenUtilTest, OneToOneMapping) {
std::vector<ui::TouchscreenDevice> devices;
devices.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(800, 600), 0));
devices.push_back(
ui::TouchscreenDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(1024, 768), 0));
devices.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(800, 600), 0));
devices.push_back(ui::TouchscreenDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(1024, 768), 0));
AssociateTouchscreens(&displays_, devices);
......@@ -93,9 +91,8 @@ TEST_F(TouchscreenUtilTest, OneToOneMapping) {
TEST_F(TouchscreenUtilTest, MapToCorrectDisplaySize) {
std::vector<ui::TouchscreenDevice> devices;
devices.push_back(
ui::TouchscreenDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(1024, 768), 0));
devices.push_back(ui::TouchscreenDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(1024, 768), 0));
AssociateTouchscreens(&displays_, devices);
......@@ -107,12 +104,10 @@ TEST_F(TouchscreenUtilTest, MapToCorrectDisplaySize) {
TEST_F(TouchscreenUtilTest, MapWhenSizeDiffersByOne) {
std::vector<ui::TouchscreenDevice> devices;
devices.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(801, 600), 0));
devices.push_back(
ui::TouchscreenDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(1023, 768), 0));
devices.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(801, 600), 0));
devices.push_back(ui::TouchscreenDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(1023, 768), 0));
AssociateTouchscreens(&displays_, devices);
......@@ -124,12 +119,10 @@ TEST_F(TouchscreenUtilTest, MapWhenSizeDiffersByOne) {
TEST_F(TouchscreenUtilTest, MapWhenSizesDoNotMatch) {
std::vector<ui::TouchscreenDevice> devices;
devices.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(1022, 768), 0));
devices.push_back(
ui::TouchscreenDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(802, 600), 0));
devices.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(1022, 768), 0));
devices.push_back(ui::TouchscreenDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(802, 600), 0));
AssociateTouchscreens(&displays_, devices);
......@@ -141,12 +134,10 @@ TEST_F(TouchscreenUtilTest, MapWhenSizesDoNotMatch) {
TEST_F(TouchscreenUtilTest, MapInternalTouchscreen) {
std::vector<ui::TouchscreenDevice> devices;
devices.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "",
gfx::Size(1920, 1080), 0));
devices.push_back(
ui::TouchscreenDevice(2, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "",
gfx::Size(9999, 888), 0));
devices.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(1920, 1080), 0));
devices.push_back(ui::TouchscreenDevice(
2, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(9999, 888), 0));
AssociateTouchscreens(&displays_, devices);
......
......@@ -84,8 +84,8 @@ class MockEventBlocker : public ScopedDisableInternalMouseAndKeyboard {
MockEventBlocker() {}
~MockEventBlocker() override {
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
ui::DeviceHotplugEventObserver* manager =
ui::DeviceDataManager::GetInstance();
manager->OnKeyboardDevicesUpdated(keyboards);
......@@ -157,13 +157,12 @@ class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
// present.
TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) {
std::vector<ui::TouchscreenDevice> screens;
screens.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
screens.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
UpdateKeyboardDevices(keyboards);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
// Remove the internal keyboard. Virtual keyboard should now show.
......@@ -177,9 +176,8 @@ TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) {
TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfNoTouchScreen) {
std::vector<ui::TouchscreenDevice> devices;
// Add a touchscreen. Keyboard should deploy.
devices.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL,
"Touchscreen", gfx::Size(800, 600), 0));
devices.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, gfx::Size(800, 600), 0));
UpdateTouchscreenDevices(devices);
EXPECT_TRUE(keyboard::IsKeyboardEnabled());
// Remove touchscreen. Keyboard should hide.
......@@ -189,13 +187,12 @@ TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfNoTouchScreen) {
TEST_F(VirtualKeyboardControllerAutoTest, SuppressedIfExternalKeyboardPresent) {
std::vector<ui::TouchscreenDevice> screens;
screens.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
screens.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
UpdateKeyboardDevices(keyboards);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
ASSERT_TRUE(notified());
......@@ -228,12 +225,12 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedIfExternalKeyboardPresent) {
// Tests handling multiple keyboards. Catches crbug.com/430252
TEST_F(VirtualKeyboardControllerAutoTest, HandleMultipleKeyboardsPresent) {
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
keyboards.push_back(ui::KeyboardDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
keyboards.push_back(ui::KeyboardDevice(
3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
keyboards.push_back(
ui::KeyboardDevice(2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
keyboards.push_back(
ui::KeyboardDevice(3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
UpdateKeyboardDevices(keyboards);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
}
......@@ -259,13 +256,12 @@ class VirtualKeyboardControllerAlwaysEnabledTest
// keyboard always enabled flag is active.
TEST_F(VirtualKeyboardControllerAlwaysEnabledTest, DoesNotSuppressKeyboard) {
std::vector<ui::TouchscreenDevice> screens;
screens.push_back(
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
screens.push_back(ui::TouchscreenDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL));
UpdateKeyboardDevices(keyboards);
ASSERT_TRUE(keyboard::IsKeyboardEnabled());
}
......
......@@ -15,10 +15,8 @@ InputDevice::InputDevice()
: id(kInvalidId), type(InputDeviceType::INPUT_DEVICE_UNKNOWN) {
}
InputDevice::InputDevice(unsigned int id,
InputDeviceType type,
const std::string& name)
: id(id), type(type), name(name) {
InputDevice::InputDevice(unsigned int id, InputDeviceType type)
: id(id), type(type) {
}
InputDevice::~InputDevice() {
......
......@@ -24,7 +24,7 @@ struct EVENTS_DEVICES_EXPORT InputDevice {
// Creates an invalid input device.
InputDevice();
InputDevice(unsigned int id, InputDeviceType type, const std::string& name);
InputDevice(unsigned int id, InputDeviceType type);
virtual ~InputDevice();
// ID of the device. This ID is unique between all input devices.
......@@ -32,9 +32,6 @@ struct EVENTS_DEVICES_EXPORT InputDevice {
// The type of the input device.
InputDeviceType type;
// Name of the device.
std::string name;
};
} // namespace ui
......
......@@ -10,10 +10,8 @@
namespace ui {
KeyboardDevice::KeyboardDevice(int id,
InputDeviceType type,
const std::string& name)
: InputDevice(id, type, name) {
KeyboardDevice::KeyboardDevice(int id, InputDeviceType type)
: InputDevice(id, type) {
}
} // namespace ui
......@@ -14,7 +14,7 @@ namespace ui {
// Represents a Keyboard device state.
struct EVENTS_DEVICES_EXPORT KeyboardDevice : public InputDevice {
KeyboardDevice(int id, InputDeviceType type, const std::string& name);
KeyboardDevice(int id, InputDeviceType type);
};
} // namespace ui
......
......@@ -15,10 +15,9 @@ TouchscreenDevice::TouchscreenDevice() : touch_points(0) {
TouchscreenDevice::TouchscreenDevice(unsigned int id,
InputDeviceType type,
const std::string& name,
const gfx::Size& size,
int touch_points)
: InputDevice(id, type, name), size(size), touch_points(touch_points) {
: InputDevice(id, type), size(size), touch_points(touch_points) {
}
} // namespace ui
......@@ -20,7 +20,6 @@ struct EVENTS_DEVICES_EXPORT TouchscreenDevice : public InputDevice {
TouchscreenDevice(unsigned int id,
InputDeviceType type,
const std::string& name,
const gfx::Size& size,
int touch_points);
......
......@@ -80,10 +80,10 @@ TEST_F(DeviceDataManagerX11Test, NotifyOnDisable) {
DeviceDataManagerX11* manager = DeviceDataManagerX11::GetInstance();
TestInputDeviceObserver observer(manager);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
keyboards.push_back(ui::KeyboardDevice(
2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
keyboards.push_back(
ui::KeyboardDevice(2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
SetKeyboardDevices(keyboards);
EXPECT_TRUE(observer.change_notified());
std::vector<KeyboardDevice> devices = manager->keyboard_devices();
......@@ -111,10 +111,10 @@ TEST_F(DeviceDataManagerX11Test, TestMultipleDisable) {
DeviceDataManagerX11* manager = DeviceDataManagerX11::GetInstance();
TestInputDeviceObserver observer(manager);
std::vector<ui::KeyboardDevice> keyboards;
keyboards.push_back(ui::KeyboardDevice(
1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
keyboards.push_back(ui::KeyboardDevice(
2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
keyboards.push_back(
ui::KeyboardDevice(1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
keyboards.push_back(
ui::KeyboardDevice(2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
SetKeyboardDevices(keyboards);
EXPECT_TRUE(observer.change_notified());
std::vector<KeyboardDevice> devices = manager->keyboard_devices();
......@@ -150,10 +150,10 @@ TEST_F(DeviceDataManagerX11Test, UnblockOnDeviceUnplugged) {
DeviceDataManagerX11* manager = DeviceDataManagerX11::GetInstance();
TestInputDeviceObserver observer(manager);
std::vector<ui::KeyboardDevice> all_keyboards;
all_keyboards.push_back(ui::KeyboardDevice(
1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
all_keyboards.push_back(ui::KeyboardDevice(
2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
all_keyboards.push_back(
ui::KeyboardDevice(1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
all_keyboards.push_back(
ui::KeyboardDevice(2u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
SetKeyboardDevices(all_keyboards);
EXPECT_TRUE(observer.change_notified());
std::vector<KeyboardDevice> devices = manager->keyboard_devices();
......@@ -168,8 +168,8 @@ TEST_F(DeviceDataManagerX11Test, UnblockOnDeviceUnplugged) {
// Unplug the disabled device. Should not be notified, since the active list
// did not change.
std::vector<ui::KeyboardDevice> subset_keyboards;
subset_keyboards.push_back(ui::KeyboardDevice(
1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
subset_keyboards.push_back(
ui::KeyboardDevice(1u, ui::InputDeviceType::INPUT_DEVICE_INTERNAL));
SetKeyboardDevices(subset_keyboards);
EXPECT_FALSE(observer.change_notified());
// Replug in the first device. Should be notified of the new device.
......
......@@ -440,9 +440,9 @@ void InputDeviceFactoryEvdev::NotifyTouchscreensUpdated() {
// TODO(spang): Extract the number of touch-points supported by the
// device.
const int touch_points = 11;
touchscreens.push_back(TouchscreenDevice(
it->second->id(), it->second->type(), std::string() /* Device name */,
it->second->GetTouchscreenSize(), touch_points));
touchscreens.push_back(
TouchscreenDevice(it->second->id(), it->second->type(),
it->second->GetTouchscreenSize(), touch_points));
}
}
......@@ -453,8 +453,7 @@ void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() {
std::vector<KeyboardDevice> keyboards;
for (auto it = converters_.begin(); it != converters_.end(); ++it) {
if (it->second->HasKeyboard()) {
keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type(),
std::string() /* Device name */));
keyboards.push_back(KeyboardDevice(it->second->id(), it->second->type()));
}
}
......@@ -464,10 +463,8 @@ void InputDeviceFactoryEvdev::NotifyKeyboardsUpdated() {
void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() {
std::vector<InputDevice> mice;
for (auto it = converters_.begin(); it != converters_.end(); ++it) {
if (it->second->HasMouse()) {
mice.push_back(InputDevice(it->second->id(), it->second->type(),
std::string() /* Device name */));
}
if (it->second->HasMouse())
mice.push_back(InputDevice(it->second->id(), it->second->type()));
}
dispatcher_->DispatchMouseDevicesUpdated(mice);
......@@ -476,10 +473,8 @@ void InputDeviceFactoryEvdev::NotifyMouseDevicesUpdated() {
void InputDeviceFactoryEvdev::NotifyTouchpadDevicesUpdated() {
std::vector<InputDevice> touchpads;
for (auto it = converters_.begin(); it != converters_.end(); ++it) {
if (it->second->HasTouchpad()) {
touchpads.push_back(InputDevice(it->second->id(), it->second->type(),
std::string() /* Device name */));
}
if (it->second->HasTouchpad())
touchpads.push_back(InputDevice(it->second->id(), it->second->type()));
}
dispatcher_->DispatchTouchpadDevicesUpdated(touchpads);
......
......@@ -225,8 +225,7 @@ void HandleKeyboardDevicesInWorker(
if (IsKnownInvalidKeyboardDevice(device_name))
continue; // Skip invalid devices.
InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path);
devices.push_back(
KeyboardDevice(device_info.id, type, device_name));
devices.push_back(KeyboardDevice(device_info.id, type));
}
reply_runner->PostTask(FROM_HERE, base::Bind(callback, devices));
......@@ -278,10 +277,9 @@ void HandleTouchscreenDevicesInWorker(
InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path);
// |max_x| and |max_y| are inclusive values, so we need to add 1 to get
// the size.
devices.push_back(
TouchscreenDevice(device_info.id, type, device_info.name,
gfx::Size(max_x + 1, max_y + 1),
device_info.touch_class_info.num_touches));
devices.push_back(TouchscreenDevice(
device_info.id, type, gfx::Size(max_x + 1, max_y + 1),
device_info.touch_class_info.num_touches));
}
}
......
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