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 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void DeactivateTool(PaletteToolId tool_id); | 68 void DeactivateTool(PaletteToolId tool_id); |
69 | 69 |
70 // Returns true if the given tool is active. | 70 // Returns true if the given tool is active. |
71 bool IsToolActive(PaletteToolId tool_id); | 71 bool IsToolActive(PaletteToolId tool_id); |
72 | 72 |
73 // Returns the active tool for the given group. | 73 // Returns the active tool for the given group. |
74 PaletteToolId GetActiveTool(PaletteGroup group); | 74 PaletteToolId GetActiveTool(PaletteGroup group); |
75 | 75 |
76 // Fetch the active tray icon for the given tool. Returns | 76 // Fetch the active tray icon for the given tool. Returns |
77 // gfx::VectorIconId::VECTOR_ICON_NONE if not available. | 77 // gfx::VectorIconId::VECTOR_ICON_NONE if not available. |
78 gfx::VectorIconId GetActiveTrayIcon(PaletteToolId tool_id); | 78 const gfx::VectorIcon& GetActiveTrayIcon(PaletteToolId tool_id) const; |
79 | 79 |
80 // Create views for all of the registered tools. | 80 // Create views for all of the registered tools. |
81 std::vector<PaletteToolView> CreateViews(); | 81 std::vector<PaletteToolView> CreateViews(); |
82 | 82 |
83 // Called when the views returned by CreateViews have been destroyed. This | 83 // Called when the views returned by CreateViews have been destroyed. This |
84 // should clear any (now) stale references. | 84 // should clear any (now) stale references. |
85 void NotifyViewsDestroyed(); | 85 void NotifyViewsDestroyed(); |
86 | 86 |
87 private: | 87 private: |
88 // PaleteTool::Delegate overrides. | 88 // PaleteTool::Delegate overrides. |
89 void EnableTool(PaletteToolId tool_id) override; | 89 void EnableTool(PaletteToolId tool_id) override; |
90 void DisableTool(PaletteToolId tool_id) override; | 90 void DisableTool(PaletteToolId tool_id) override; |
91 void HidePalette() override; | 91 void HidePalette() override; |
92 WmWindow* GetWindow() override; | 92 WmWindow* GetWindow() override; |
93 | 93 |
94 PaletteTool* FindToolById(PaletteToolId tool_id); | 94 PaletteTool* FindToolById(PaletteToolId tool_id) const; |
95 | 95 |
96 // Unowned pointer to the delegate to provide external functionality. | 96 // Unowned pointer to the delegate to provide external functionality. |
97 Delegate* delegate_; | 97 Delegate* delegate_; |
98 | 98 |
99 // Unowned pointer to the active tool / group. | 99 // Unowned pointer to the active tool / group. |
100 std::map<PaletteGroup, PaletteTool*> active_tools_; | 100 std::map<PaletteGroup, PaletteTool*> active_tools_; |
101 | 101 |
102 // Owned list of all tools. | 102 // Owned list of all tools. |
103 std::vector<std::unique_ptr<PaletteTool>> tools_; | 103 std::vector<std::unique_ptr<PaletteTool>> tools_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); | 105 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace ash | 108 } // namespace ash |
109 | 109 |
110 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 110 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
OLD | NEW |