| 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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 PaletteToolId PaletteToolManager::GetActiveTool(PaletteGroup group) { | 67 PaletteToolId PaletteToolManager::GetActiveTool(PaletteGroup group) { |
| 68 PaletteTool* active_tool = active_tools_[group]; | 68 PaletteTool* active_tool = active_tools_[group]; |
| 69 return active_tool ? active_tool->GetToolId() : PaletteToolId::NONE; | 69 return active_tool ? active_tool->GetToolId() : PaletteToolId::NONE; |
| 70 } | 70 } |
| 71 | 71 |
| 72 gfx::VectorIconId PaletteToolManager::GetActiveTrayIcon(PaletteToolId tool_id) { | 72 gfx::VectorIconId PaletteToolManager::GetActiveTrayIcon(PaletteToolId tool_id) { |
| 73 PaletteTool* tool = FindToolById(tool_id); | 73 PaletteTool* tool = FindToolById(tool_id); |
| 74 if (!tool) | 74 if (!tool) |
| 75 return gfx::VectorIconId::VECTOR_ICON_NONE; | 75 return gfx::VectorIconId::PALETTE_TRAY_ICON_DEFAULT; |
| 76 | 76 |
| 77 return tool->GetActiveTrayIcon(); | 77 return tool->GetActiveTrayIcon(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::vector<PaletteToolView> PaletteToolManager::CreateViews() { | 80 std::vector<PaletteToolView> PaletteToolManager::CreateViews() { |
| 81 std::vector<PaletteToolView> views(tools_.size()); | 81 std::vector<PaletteToolView> views(tools_.size()); |
| 82 | 82 |
| 83 for (size_t i = 0; i < tools_.size(); ++i) { | 83 for (size_t i = 0; i < tools_.size(); ++i) { |
| 84 PaletteToolView* view = &views[i]; | 84 PaletteToolView* view = &views[i]; |
| 85 view->group = tools_[i]->GetGroup(); | 85 view->group = tools_[i]->GetGroup(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 114 PaletteTool* PaletteToolManager::FindToolById(PaletteToolId tool_id) { | 114 PaletteTool* PaletteToolManager::FindToolById(PaletteToolId tool_id) { |
| 115 for (std::unique_ptr<PaletteTool>& tool : tools_) { | 115 for (std::unique_ptr<PaletteTool>& tool : tools_) { |
| 116 if (tool->GetToolId() == tool_id) | 116 if (tool->GetToolId() == tool_id) |
| 117 return tool.get(); | 117 return tool.get(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 return nullptr; | 120 return nullptr; |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace ash | 123 } // namespace ash |
| OLD | NEW |