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

Unified Diff: components/mus/input_devices/input_device_server.cc

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « components/mus/input_devices/input_device_server.h ('k') | components/mus/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/input_devices/input_device_server.cc
diff --git a/components/mus/input_devices/input_device_server.cc b/components/mus/input_devices/input_device_server.cc
deleted file mode 100644
index 3514eb3566951bf5fad79cf94174182367528903..0000000000000000000000000000000000000000
--- a/components/mus/input_devices/input_device_server.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2016 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 "components/mus/input_devices/input_device_server.h"
-
-#include <utility>
-#include <vector>
-
-#include "mojo/public/cpp/bindings/array.h"
-#include "ui/events/devices/input_device.h"
-#include "ui/events/devices/touchscreen_device.h"
-
-namespace mus {
-
-InputDeviceServer::InputDeviceServer() {}
-
-InputDeviceServer::~InputDeviceServer() {
- if (manager_ && ui::DeviceDataManager::HasInstance()) {
- manager_->RemoveObserver(this);
- manager_ = nullptr;
- }
-}
-
-void InputDeviceServer::RegisterAsObserver() {
- if (!manager_ && ui::DeviceDataManager::HasInstance()) {
- manager_ = ui::DeviceDataManager::GetInstance();
- manager_->AddObserver(this);
- }
-}
-
-bool InputDeviceServer::IsRegisteredAsObserver() const {
- return manager_ != nullptr;
-}
-
-void InputDeviceServer::AddInterface(shell::Connection* connection) {
- DCHECK(manager_);
- connection->AddInterface<mojom::InputDeviceServer>(this);
-}
-
-void InputDeviceServer::AddObserver(
- mojom::InputDeviceObserverMojoPtr observer) {
- // We only want to send this message once, so we need to check to make sure
- // device lists are actually complete before sending it to a new observer.
- if (manager_->AreDeviceListsComplete())
- SendDeviceListsComplete(observer.get());
- observers_.AddPtr(std::move(observer));
-}
-
-void InputDeviceServer::OnKeyboardDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetKeyboardDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnKeyboardDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnTouchscreenDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetTouchscreenDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnTouchscreenDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnMouseDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetMouseDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnMouseDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnTouchpadDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetTouchpadDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnTouchpadDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnDeviceListsComplete() {
- observers_.ForAllPtrs([this](mojom::InputDeviceObserverMojo* observer) {
- SendDeviceListsComplete(observer);
- });
-}
-
-void InputDeviceServer::SendDeviceListsComplete(
- mojom::InputDeviceObserverMojo* observer) {
- DCHECK(manager_->AreDeviceListsComplete());
-
- observer->OnDeviceListsComplete(
- manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(),
- manager_->GetMouseDevices(), manager_->GetTouchpadDevices());
-}
-
-void InputDeviceServer::Create(shell::Connection* connection,
- mojom::InputDeviceServerRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-} // namespace mus
« no previous file with comments | « components/mus/input_devices/input_device_server.h ('k') | components/mus/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698