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

Unified Diff: ash/common/system/chromeos/palette/eject_controller.cc

Issue 2234203002: Auto open and close the palette on an eject event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tool-note
Patch Set: Rebase on master Created 4 years, 4 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: 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

Powered by Google App Engine
This is Rietveld 408576698