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 RecordPaletteOptionsUsage(ash::PaletteTrayOptions option) = 0; |
| 53 |
| 54 // Record mode cancellation of pen palette. |
| 55 virtual void RecordPaletteModeCancellation(PaletteModeCancelType type) = 0; |
| 56 |
51 private: | 57 private: |
52 DISALLOW_COPY_AND_ASSIGN(Delegate); | 58 DISALLOW_COPY_AND_ASSIGN(Delegate); |
53 }; | 59 }; |
54 | 60 |
55 // Creates the tool manager. | 61 // Creates the tool manager. |
56 PaletteToolManager(Delegate* delegate); | 62 PaletteToolManager(Delegate* delegate); |
57 ~PaletteToolManager() override; | 63 ~PaletteToolManager() override; |
58 | 64 |
59 // Adds the given |tool| to the tool manager. The tool is assumed to be in a | 65 // 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|. | 66 // 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 | 89 // Called when the views returned by CreateViews have been destroyed. This |
84 // should clear any (now) stale references. | 90 // should clear any (now) stale references. |
85 void NotifyViewsDestroyed(); | 91 void NotifyViewsDestroyed(); |
86 | 92 |
87 private: | 93 private: |
88 // PaleteTool::Delegate overrides. | 94 // PaleteTool::Delegate overrides. |
89 void EnableTool(PaletteToolId tool_id) override; | 95 void EnableTool(PaletteToolId tool_id) override; |
90 void DisableTool(PaletteToolId tool_id) override; | 96 void DisableTool(PaletteToolId tool_id) override; |
91 void HidePalette() override; | 97 void HidePalette() override; |
92 WmWindow* GetWindow() override; | 98 WmWindow* GetWindow() override; |
| 99 void RecordPaletteOptionsUsage(ash::PaletteTrayOptions option) override; |
| 100 void RecordPaletteModeCancellation(PaletteModeCancelType type) override; |
93 | 101 |
94 PaletteTool* FindToolById(PaletteToolId tool_id) const; | 102 PaletteTool* FindToolById(PaletteToolId tool_id) const; |
95 | 103 |
96 // Unowned pointer to the delegate to provide external functionality. | 104 // Unowned pointer to the delegate to provide external functionality. |
97 Delegate* delegate_; | 105 Delegate* delegate_; |
98 | 106 |
99 // Unowned pointer to the active tool / group. | 107 // Unowned pointer to the active tool / group. |
100 std::map<PaletteGroup, PaletteTool*> active_tools_; | 108 std::map<PaletteGroup, PaletteTool*> active_tools_; |
101 | 109 |
102 // Owned list of all tools. | 110 // Owned list of all tools. |
103 std::vector<std::unique_ptr<PaletteTool>> tools_; | 111 std::vector<std::unique_ptr<PaletteTool>> tools_; |
104 | 112 |
105 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); | 113 DISALLOW_COPY_AND_ASSIGN(PaletteToolManager); |
106 }; | 114 }; |
107 | 115 |
108 } // namespace ash | 116 } // namespace ash |
109 | 117 |
110 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ | 118 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_MANAGER_H_ |
OLD | NEW |