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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // gfx::VectorIconId::VECTOR_ICON_NONE if not available. | 83 // gfx::VectorIconId::VECTOR_ICON_NONE if not available. |
84 const gfx::VectorIcon& GetActiveTrayIcon(PaletteToolId tool_id) const; | 84 const gfx::VectorIcon& GetActiveTrayIcon(PaletteToolId tool_id) const; |
85 | 85 |
86 // Create views for all of the registered tools. | 86 // Create views for all of the registered tools. |
87 std::vector<PaletteToolView> CreateViews(); | 87 std::vector<PaletteToolView> CreateViews(); |
88 | 88 |
89 // Called when the views returned by CreateViews have been destroyed. This | 89 // Called when the views returned by CreateViews have been destroyed. This |
90 // should clear any (now) stale references. | 90 // should clear any (now) stale references. |
91 void NotifyViewsDestroyed(); | 91 void NotifyViewsDestroyed(); |
92 | 92 |
| 93 // Helper method to disable any active tool in the given |group|. |
| 94 void DisableActiveTool(PaletteGroup group); |
| 95 |
93 private: | 96 private: |
94 // PaleteTool::Delegate overrides. | 97 // PaleteTool::Delegate overrides. |
95 void EnableTool(PaletteToolId tool_id) override; | 98 void EnableTool(PaletteToolId tool_id) override; |
96 void DisableTool(PaletteToolId tool_id) override; | 99 void DisableTool(PaletteToolId tool_id) override; |
97 void HidePalette() override; | 100 void HidePalette() override; |
98 WmWindow* GetWindow() override; | 101 WmWindow* GetWindow() override; |
99 void RecordPaletteOptionsUsage(ash::PaletteTrayOptions option) override; | 102 void RecordPaletteOptionsUsage(ash::PaletteTrayOptions option) override; |
100 void RecordPaletteModeCancellation(PaletteModeCancelType type) override; | 103 void RecordPaletteModeCancellation(PaletteModeCancelType type) override; |
101 | 104 |
102 PaletteTool* FindToolById(PaletteToolId tool_id) const; | 105 PaletteTool* FindToolById(PaletteToolId tool_id) const; |
103 | 106 |
104 // Unowned pointer to the delegate to provide external functionality. | 107 // Unowned pointer to the delegate to provide external functionality. |
105 Delegate* delegate_; | 108 Delegate* delegate_; |
106 | 109 |
107 // Unowned pointer to the active tool / group. | 110 // Unowned pointer to the active tool / group. |
108 std::map<PaletteGroup, PaletteTool*> active_tools_; | 111 std::map<PaletteGroup, PaletteTool*> active_tools_; |
109 | 112 |
110 // Owned list of all tools. | 113 // Owned list of all tools. |
111 std::vector<std::unique_ptr<PaletteTool>> tools_; | 114 std::vector<std::unique_ptr<PaletteTool>> tools_; |
112 | 115 |
113 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); | 116 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); |
114 }; | 117 }; |
115 | 118 |
116 } // namespace ash | 119 } // namespace ash |
117 | 120 |
118 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 121 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
OLD | NEW |