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 |