| Index: chrome/browser/chromeos/device/fake_input_service_proxy.cc
|
| diff --git a/chrome/browser/chromeos/device/fake_input_service_proxy.cc b/chrome/browser/chromeos/device/fake_input_service_proxy.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..602ba85d7e3c8fdd09f8747c6a9fe2e5d16b57c2
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/device/fake_input_service_proxy.cc
|
| @@ -0,0 +1,53 @@
|
| +// 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.
|
| +
|
| +#include <vector>
|
| +
|
| +#include "chrome/browser/chromeos/device/fake_input_service_proxy.h"
|
| +
|
| +typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo;
|
| +
|
| +namespace chromeos {
|
| +
|
| +FakeInputServiceProxy::FakeInputServiceProxy() {
|
| +}
|
| +
|
| +FakeInputServiceProxy::~FakeInputServiceProxy() {
|
| +}
|
| +
|
| +// static
|
| +void FakeInputServiceProxy::WarmUp() {
|
| +}
|
| +
|
| +void FakeInputServiceProxy::GetDevices(const GetDevicesCallback& callback) {
|
| + std::vector<InputDeviceInfo> devices;
|
| + for (auto& device_entry : devices_) {
|
| + devices.push_back(device_entry.second);
|
| + }
|
| + callback.Run(devices);
|
| +}
|
| +
|
| +void FakeInputServiceProxy::GetDeviceInfo(const std::string& id,
|
| + const GetDeviceInfoCallback& callback) {
|
| + InputDeviceInfo info;
|
| + DeviceMap::const_iterator it = devices_.find(id);
|
| + if (it == devices_.end()) {
|
| + callback.Run(false, info);
|
| + return;
|
| + }
|
| + info = it->second;
|
| + callback.Run(true, info);
|
| +}
|
| +
|
| +void FakeInputServiceProxy::AddDevice(InputDeviceInfo& info) {
|
| + devices_[info.id] = info;
|
| + FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceAdded(info));
|
| +}
|
| +
|
| +void FakeInputServiceProxy::RemoveDevice(const std::string& id) {
|
| + devices_.erase(id);
|
| + FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceRemoved(id));
|
| +}
|
| +
|
| +} // namespace chromeos
|
|
|