Index: ash/common/system/chromeos/palette/palette_tray.cc |
diff --git a/ash/common/system/chromeos/palette/palette_tray.cc b/ash/common/system/chromeos/palette/palette_tray.cc |
index 95db0eb52129b14519923333ddcda48946a8de90..b47ed1900bf025112871158848dafd07149bf4af 100644 |
--- a/ash/common/system/chromeos/palette/palette_tray.cc |
+++ b/ash/common/system/chromeos/palette/palette_tray.cc |
@@ -4,10 +4,12 @@ |
#include "ash/common/system/chromeos/palette/palette_tray.h" |
+#include "ash/common/palette_delegate.h" |
#include "ash/common/shelf/shelf_constants.h" |
#include "ash/common/shelf/wm_shelf.h" |
#include "ash/common/shelf/wm_shelf_util.h" |
#include "ash/common/shell_window_ids.h" |
+#include "ash/common/system/chromeos/palette/eject_controller.h" |
#include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
#include "ash/common/system/chromeos/palette/palette_utils.h" |
#include "ash/common/system/tray/system_tray_delegate.h" |
@@ -118,6 +120,9 @@ class TitleView : public views::View, public views::ButtonListener { |
PaletteTray::PaletteTray(WmShelf* wm_shelf) |
: TrayBackgroundView(wm_shelf), |
palette_tool_manager_(new PaletteToolManager(this)) { |
+ eject_controller_.reset(new EjectController( |
+ base::Bind(&PaletteTray::OnEject, base::Unretained(this)))); |
+ |
PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); |
SetContentsBackground(); |
@@ -308,6 +313,17 @@ void PaletteTray::UpdateTrayIcon() { |
icon_->SetImage(CreateVectorIcon(icon, kShelfIconColor)); |
} |
+void PaletteTray::OnEject(bool eject) { |
+ if (!WmShell::Get()->palette_delegate()->ShouldAutoOpenPalette()) |
+ return; |
+ |
+ if (eject && !bubble_) |
+ OpenBubble(); |
+ |
+ if (!eject && bubble_) |
+ HidePalette(); |
+} |
+ |
void PaletteTray::UpdateIconVisibility() { |
if (!IsPaletteEnabled()) |
return; |