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

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

Issue 2825383003: Fix stylus tools palette. (Closed)
Patch Set: Fix nits. Created 3 years, 7 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/system/palette/palette_utils.h ('k') | ash/system/status_area_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/palette/palette_utils.cc
diff --git a/ash/system/palette/palette_utils.cc b/ash/system/palette/palette_utils.cc
index 7181d6c5addf6bcfab86b78c472dfc6c2475d078..97b7928537c1dc1cb25687c0141a37ede93b1135 100644
--- a/ash/system/palette/palette_utils.cc
+++ b/ash/system/palette/palette_utils.cc
@@ -5,12 +5,15 @@
#include "ash/system/palette/palette_utils.h"
#include "ash/ash_switches.h"
+#include "ash/palette_delegate.h"
#include "ash/shelf/wm_shelf.h"
+#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/system/palette/palette_tray.h"
#include "ash/system/status_area_widget.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
+#include "ui/display/display.h"
#include "ui/events/devices/input_device_manager.h"
#include "ui/events/devices/touchscreen_device.h"
#include "ui/gfx/geometry/point.h"
@@ -22,7 +25,7 @@ bool HasStylusInput() {
// Allow the user to force enable or disable by passing a switch. If both are
// present, enabling takes precedence over disabling.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshForceEnablePalette)) {
+ switches::kAshForceEnableStylusTools)) {
return true;
}
@@ -43,6 +46,14 @@ bool IsPaletteEnabledOnEveryDisplay() {
switches::kAshEnablePaletteOnAllDisplays);
}
+bool ShouldShowPalette() {
+ return HasStylusInput() &&
+ (display::Display::HasInternalDisplay() ||
+ IsPaletteEnabledOnEveryDisplay()) &&
+ Shell::Get()->palette_delegate() &&
+ Shell::Get()->palette_delegate()->ShouldShowPalette();
+}
+
bool PaletteContainsPointInScreen(const gfx::Point& point) {
for (WmWindow* window : ShellPort::Get()->GetAllRootWindows()) {
PaletteTray* palette_tray =
« no previous file with comments | « ash/system/palette/palette_utils.h ('k') | ash/system/status_area_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698