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_tool_manager.h" | 5 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/system/chromeos/palette/palette_tool.h" | 9 #include "ash/common/system/chromeos/palette/palette_tool.h" |
10 #include "ash/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 return views; | 101 return views; |
102 } | 102 } |
103 | 103 |
104 void PaletteToolManager::NotifyViewsDestroyed() { | 104 void PaletteToolManager::NotifyViewsDestroyed() { |
105 for (std::unique_ptr<PaletteTool>& tool : tools_) | 105 for (std::unique_ptr<PaletteTool>& tool : tools_) |
106 tool->OnViewDestroyed(); | 106 tool->OnViewDestroyed(); |
107 } | 107 } |
108 | 108 |
| 109 void PaletteToolManager::DisableActiveTool(PaletteGroup group) { |
| 110 PaletteToolId tool_id = GetActiveTool(group); |
| 111 if (tool_id != PaletteToolId::NONE) |
| 112 DeactivateTool(tool_id); |
| 113 } |
| 114 |
109 void PaletteToolManager::EnableTool(PaletteToolId tool_id) { | 115 void PaletteToolManager::EnableTool(PaletteToolId tool_id) { |
110 ActivateTool(tool_id); | 116 ActivateTool(tool_id); |
111 } | 117 } |
112 | 118 |
113 void PaletteToolManager::DisableTool(PaletteToolId tool_id) { | 119 void PaletteToolManager::DisableTool(PaletteToolId tool_id) { |
114 DeactivateTool(tool_id); | 120 DeactivateTool(tool_id); |
115 } | 121 } |
116 | 122 |
117 void PaletteToolManager::HidePalette() { | 123 void PaletteToolManager::HidePalette() { |
118 delegate_->HidePalette(); | 124 delegate_->HidePalette(); |
(...skipping 15 matching lines...) Expand all Loading... |
134 PaletteTool* PaletteToolManager::FindToolById(PaletteToolId tool_id) const { | 140 PaletteTool* PaletteToolManager::FindToolById(PaletteToolId tool_id) const { |
135 for (const std::unique_ptr<PaletteTool>& tool : tools_) { | 141 for (const std::unique_ptr<PaletteTool>& tool : tools_) { |
136 if (tool->GetToolId() == tool_id) | 142 if (tool->GetToolId() == tool_id) |
137 return tool.get(); | 143 return tool.get(); |
138 } | 144 } |
139 | 145 |
140 return nullptr; | 146 return nullptr; |
141 } | 147 } |
142 | 148 |
143 } // namespace ash | 149 } // namespace ash |
OLD | NEW |