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

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

Issue 2825383003: Fix stylus tools palette. (Closed)
Patch Set: Load palette_tray all the time. Only check when show it Created 3 years, 8 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/system/palette/palette_tray.cc
diff --git a/ash/system/palette/palette_tray.cc b/ash/system/palette/palette_tray.cc
index f6c46f8ca65698b80e9b07bc98aae4e304d35503..73ce3064991be7d947c391d6e5c0c105becb635c 100644
--- a/ash/system/palette/palette_tray.cc
+++ b/ash/system/palette/palette_tray.cc
@@ -28,6 +28,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"
@@ -70,6 +71,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) {
@@ -400,7 +411,7 @@ void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) {
void PaletteTray::UpdateIconVisibility() {
SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
- IsInUserSession());
+ ShouldShowOnDisplay(this) && IsInUserSession());
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698