Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: ash/common/system/chromeos/palette/palette_tool_manager.cc

Issue 2148573002: Add palette tray to ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stylus-tool-structure
Patch Set: Nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/common/system/chromeos/palette/palette_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/common/system/chromeos/palette/palette_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698