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

Unified Diff: ash/system/palette/palette_tray.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_tray.h ('k') | ash/system/palette/palette_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/palette/palette_tray.cc
diff --git a/ash/system/palette/palette_tray.cc b/ash/system/palette/palette_tray.cc
index ab54c99bc80cbd5079af5296f0ed191b8a1012a2..d248d518cf6dbdb6cca88cd28ab981a175b343e2 100644
--- a/ash/system/palette/palette_tray.cc
+++ b/ash/system/palette/palette_tray.cc
@@ -27,6 +27,7 @@
#include "base/metrics/histogram_macros.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/display/display.h"
#include "ui/events/devices/input_device_manager.h"
#include "ui/events/devices/stylus_state.h"
#include "ui/gfx/color_palette.h"
@@ -69,6 +70,16 @@ bool IsInUserSession() {
LoginStatus::KIOSK_APP;
}
+// Returns true if the |palette_tray| is on an internal display or on every
+// display if requested from the command line.
+bool ShouldShowOnDisplay(PaletteTray* palette_tray) {
+ const display::Display& display =
+ WmWindow::Get(palette_tray->GetWidget()->GetNativeWindow())
+ ->GetDisplayNearestWindow();
+ return display.IsInternal() ||
+ palette_utils::IsPaletteEnabledOnEveryDisplay();
+}
+
class TitleView : public views::View, public views::ButtonListener {
public:
explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) {
@@ -390,7 +401,7 @@ void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) {
void PaletteTray::UpdateIconVisibility() {
SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
- IsInUserSession());
+ ShouldShowOnDisplay(this) && IsInUserSession());
}
} // namespace ash
« no previous file with comments | « ash/system/palette/palette_tray.h ('k') | ash/system/palette/palette_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698