| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/system/chromeos/palette/palette_tray.h" | 5 #include "ash/common/system/chromeos/palette/palette_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 HidePalette(); | 449 HidePalette(); |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 // Disable any active modes if the stylus has been inserted. | 453 // Disable any active modes if the stylus has been inserted. |
| 454 if (stylus_state == ui::StylusState::INSERTED) | 454 if (stylus_state == ui::StylusState::INSERTED) |
| 455 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); | 455 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) { | 458 void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) { |
| 459 is_palette_enabled_ = enabled; |
| 460 |
| 459 if (!enabled) { | 461 if (!enabled) { |
| 460 SetVisible(false); | 462 SetVisible(false); |
| 461 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); | 463 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); |
| 462 } else { | 464 } else { |
| 463 UpdateIconVisibility(); | 465 UpdateIconVisibility(); |
| 464 } | 466 } |
| 465 } | 467 } |
| 466 | 468 |
| 467 void PaletteTray::UpdateIconVisibility() { | 469 void PaletteTray::UpdateIconVisibility() { |
| 468 SetVisible(IsInUserSession()); | 470 SetVisible(is_palette_enabled_ && IsInUserSession()); |
| 469 } | 471 } |
| 470 | 472 |
| 471 } // namespace ash | 473 } // namespace ash |
| OLD | NEW |