Index: ash/common/system/chromeos/palette/eject_controller.cc |
diff --git a/ash/common/system/chromeos/palette/eject_controller.cc b/ash/common/system/chromeos/palette/eject_controller.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e4109d98d89a28e9034105928261401cb37e482d |
--- /dev/null |
+++ b/ash/common/system/chromeos/palette/eject_controller.cc |
@@ -0,0 +1,25 @@ |
+// 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 "ash/common/system/chromeos/palette/eject_controller.h" |
+ |
+#include "ash/common/wm_shell.h" |
+#include "ui/events/devices/input_device_manager.h" |
+ |
+namespace ash { |
+ |
+EjectController::EjectController(const OnEjectCallback& on_eject) |
+ : on_eject_(on_eject) { |
+ ui::InputDeviceManager::GetInstance()->AddObserver(this); |
+} |
+ |
+EjectController::~EjectController() { |
+ ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
+} |
+ |
+void EjectController::OnStylusStateChanged(ui::StylusState state) { |
+ on_eject_.Run(state); |
+} |
+ |
+} // namespace ash |