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

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

Issue 2644713002: cros: Use runtime stylus detection for ash palette. (Closed)
Patch Set: Fix test Created 3 years, 10 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 | « ash/common/system/chromeos/palette/palette_utils.h ('k') | ash/common/system/status_area_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/palette/palette_utils.cc
diff --git a/ash/common/system/chromeos/palette/palette_utils.cc b/ash/common/system/chromeos/palette/palette_utils.cc
index 28f61d308880e09c765572d6d12d1b3bfdffd1f8..f32e40c2c1d241818618e559e1a171e39fca7768 100644
--- a/ash/common/system/chromeos/palette/palette_utils.cc
+++ b/ash/common/system/chromeos/palette/palette_utils.cc
@@ -11,13 +11,29 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "base/command_line.h"
+#include "ui/events/devices/input_device_manager.h"
+#include "ui/events/devices/touchscreen_device.h"
#include "ui/gfx/geometry/point.h"
namespace ash {
+namespace palette_utils {
-bool IsPaletteFeatureEnabled() {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnablePalette);
+bool HasStylusInput() {
+ // Allow the user to force-enable by passing a switch.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshForceEnablePalette)) {
+ return true;
+ }
+
+ for (const ui::TouchscreenDevice& device :
+ ui::InputDeviceManager::GetInstance()->GetTouchscreenDevices()) {
+ if (device.is_stylus &&
+ device.type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) {
+ return true;
+ }
+ }
+
+ return false;
}
bool IsPaletteEnabledOnEveryDisplay() {
@@ -36,4 +52,5 @@ bool PaletteContainsPointInScreen(const gfx::Point& point) {
return false;
}
+} // namespace palette_utils
} // namespace ash
« no previous file with comments | « ash/common/system/chromeos/palette/palette_utils.h ('k') | ash/common/system/status_area_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698