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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Hide the palette (if shown). | 42 // Hide the palette (if shown). |
43 virtual void HidePalette() = 0; | 43 virtual void HidePalette() = 0; |
44 | 44 |
45 // Called when the active tool has changed. | 45 // Called when the active tool has changed. |
46 virtual void OnActiveToolChanged() = 0; | 46 virtual void OnActiveToolChanged() = 0; |
47 | 47 |
48 // Return the window associated with this palette. | 48 // Return the window associated with this palette. |
49 virtual WmWindow* GetWindow() = 0; | 49 virtual WmWindow* GetWindow() = 0; |
50 | 50 |
| 51 // Record usage of each pen palette option. |
| 52 virtual void RecordPaletteMetrics(ash::PaletteTrayOptions option) = 0; |
| 53 |
51 private: | 54 private: |
52 DISALLOW_COPY_AND_ASSIGN(Delegate); | 55 DISALLOW_COPY_AND_ASSIGN(Delegate); |
53 }; | 56 }; |
54 | 57 |
55 // Creates the tool manager. | 58 // Creates the tool manager. |
56 PaletteToolManager(Delegate* delegate); | 59 PaletteToolManager(Delegate* delegate); |
57 ~PaletteToolManager() override; | 60 ~PaletteToolManager() override; |
58 | 61 |
59 // Adds the given |tool| to the tool manager. The tool is assumed to be in a | 62 // Adds the given |tool| to the tool manager. The tool is assumed to be in a |
60 // deactivated state. This class takes ownership over |tool|. | 63 // deactivated state. This class takes ownership over |tool|. |
(...skipping 22 matching lines...) Expand all Loading... |
83 // Called when the views returned by CreateViews have been destroyed. This | 86 // Called when the views returned by CreateViews have been destroyed. This |
84 // should clear any (now) stale references. | 87 // should clear any (now) stale references. |
85 void NotifyViewsDestroyed(); | 88 void NotifyViewsDestroyed(); |
86 | 89 |
87 private: | 90 private: |
88 // PaleteTool::Delegate overrides. | 91 // PaleteTool::Delegate overrides. |
89 void EnableTool(PaletteToolId tool_id) override; | 92 void EnableTool(PaletteToolId tool_id) override; |
90 void DisableTool(PaletteToolId tool_id) override; | 93 void DisableTool(PaletteToolId tool_id) override; |
91 void HidePalette() override; | 94 void HidePalette() override; |
92 WmWindow* GetWindow() override; | 95 WmWindow* GetWindow() override; |
| 96 void RecordPaletteMetrics(ash::PaletteTrayOptions option) override; |
93 | 97 |
94 PaletteTool* FindToolById(PaletteToolId tool_id); | 98 PaletteTool* FindToolById(PaletteToolId tool_id); |
95 | 99 |
96 // Unowned pointer to the delegate to provide external functionality. | 100 // Unowned pointer to the delegate to provide external functionality. |
97 Delegate* delegate_; | 101 Delegate* delegate_; |
98 | 102 |
99 // Unowned pointer to the active tool / group. | 103 // Unowned pointer to the active tool / group. |
100 std::map<PaletteGroup, PaletteTool*> active_tools_; | 104 std::map<PaletteGroup, PaletteTool*> active_tools_; |
101 | 105 |
102 // Owned list of all tools. | 106 // Owned list of all tools. |
103 std::vector<std::unique_ptr<PaletteTool>> tools_; | 107 std::vector<std::unique_ptr<PaletteTool>> tools_; |
104 | 108 |
105 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); | 109 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); |
106 }; | 110 }; |
107 | 111 |
108 } // namespace ash | 112 } // namespace ash |
109 | 113 |
110 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 114 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
OLD | NEW |