| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 HidePalette(); | 429 HidePalette(); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 | 432 |
| 433 // Disable any active modes if the stylus has been inserted. | 433 // Disable any active modes if the stylus has been inserted. |
| 434 if (stylus_state == ui::StylusState::INSERTED) | 434 if (stylus_state == ui::StylusState::INSERTED) |
| 435 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); | 435 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) { | 438 void PaletteTray::OnPaletteEnabledPrefChanged(bool enabled) { |
| 439 is_palette_enabled_ = enabled; |
| 440 |
| 439 if (!enabled) { | 441 if (!enabled) { |
| 440 SetVisible(false); | 442 SetVisible(false); |
| 441 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); | 443 palette_tool_manager_->DisableActiveTool(PaletteGroup::MODE); |
| 442 } else { | 444 } else { |
| 443 UpdateIconVisibility(); | 445 UpdateIconVisibility(); |
| 444 } | 446 } |
| 445 } | 447 } |
| 446 | 448 |
| 447 void PaletteTray::UpdateIconVisibility() { | 449 void PaletteTray::UpdateIconVisibility() { |
| 448 SetVisible(IsInUserSession()); | 450 SetVisible(is_palette_enabled_ && IsInUserSession()); |
| 449 } | 451 } |
| 450 | 452 |
| 451 } // namespace ash | 453 } // namespace ash |
| OLD | NEW |