| 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_SYSTEM_PALETTE_PALETTE_TOOL_H_ | 5 #ifndef ASH_SYSTEM_PALETTE_PALETTE_TOOL_H_ |
| 6 #define ASH_SYSTEM_PALETTE_PALETTE_TOOL_H_ | 6 #define ASH_SYSTEM_PALETTE_PALETTE_TOOL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "ash/system/palette/palette_ids.h" | 13 #include "ash/system/palette/palette_ids.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "ui/gfx/vector_icon_types.h" | 16 #include "ui/gfx/vector_icon_types.h" |
| 17 | 17 |
| 18 namespace aura { |
| 19 class Window; |
| 20 } |
| 21 |
| 18 namespace gfx { | 22 namespace gfx { |
| 19 struct VectorIcon; | 23 struct VectorIcon; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace views { | 26 namespace views { |
| 23 class View; | 27 class View; |
| 24 } | 28 } |
| 25 | 29 |
| 26 namespace ash { | 30 namespace ash { |
| 27 | 31 |
| 28 class WmWindow; | |
| 29 | |
| 30 enum class PaletteGroup; | 32 enum class PaletteGroup; |
| 31 enum class PaletteToolId; | 33 enum class PaletteToolId; |
| 32 class PaletteToolManager; | 34 class PaletteToolManager; |
| 33 | 35 |
| 34 // A PaletteTool is a generalized action inside of the palette menu in the | 36 // A PaletteTool is a generalized action inside of the palette menu in the |
| 35 // shelf. Only one tool per group is active at any given time. When the tool is | 37 // shelf. Only one tool per group is active at any given time. When the tool is |
| 36 // active, it should be showing some specializied UI. The tool is no longer | 38 // active, it should be showing some specializied UI. The tool is no longer |
| 37 // active if it completes its action, if the user selects another tool with the | 39 // active if it completes its action, if the user selects another tool with the |
| 38 // same group, or if the user just cancels the action from the palette. | 40 // same group, or if the user just cancels the action from the palette. |
| 39 class ASH_EXPORT PaletteTool { | 41 class ASH_EXPORT PaletteTool { |
| 40 public: | 42 public: |
| 41 class Delegate { | 43 class Delegate { |
| 42 public: | 44 public: |
| 43 Delegate() {} | |
| 44 virtual ~Delegate() {} | |
| 45 | |
| 46 // Enable or disable a specific tool. | 45 // Enable or disable a specific tool. |
| 47 virtual void EnableTool(PaletteToolId tool_id) = 0; | 46 virtual void EnableTool(PaletteToolId tool_id) = 0; |
| 48 virtual void DisableTool(PaletteToolId tool_id) = 0; | 47 virtual void DisableTool(PaletteToolId tool_id) = 0; |
| 49 | 48 |
| 50 // Hide the entire palette. This should not change any tool state. | 49 // Hide the entire palette. This should not change any tool state. |
| 51 virtual void HidePalette() = 0; | 50 virtual void HidePalette() = 0; |
| 52 | 51 |
| 53 // Hide the entire palette without showing a hide animation. | 52 // Hide the entire palette without showing a hide animation. |
| 54 virtual void HidePaletteImmediately() = 0; | 53 virtual void HidePaletteImmediately() = 0; |
| 55 | 54 |
| 56 // Returns the root window. | 55 // Returns the root window. |
| 57 virtual WmWindow* GetWindow() = 0; | 56 virtual aura::Window* GetWindow() = 0; |
| 58 | 57 |
| 59 // Record usage of each pen palette option. | 58 // Record usage of each pen palette option. |
| 60 virtual void RecordPaletteOptionsUsage(PaletteTrayOptions option) = 0; | 59 virtual void RecordPaletteOptionsUsage(PaletteTrayOptions option) = 0; |
| 61 | 60 |
| 62 // Record mode cancellation of pen palette. | 61 // Record mode cancellation of pen palette. |
| 63 virtual void RecordPaletteModeCancellation(PaletteModeCancelType type) = 0; | 62 virtual void RecordPaletteModeCancellation(PaletteModeCancelType type) = 0; |
| 64 | 63 |
| 65 private: | 64 protected: |
| 66 DISALLOW_COPY_AND_ASSIGN(Delegate); | 65 virtual ~Delegate() {} |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 // Adds all available PaletteTool instances to the tool_manager. | 68 // Adds all available PaletteTool instances to the tool_manager. |
| 70 static void RegisterToolInstances(PaletteToolManager* tool_manager); | 69 static void RegisterToolInstances(PaletteToolManager* tool_manager); |
| 71 | 70 |
| 72 // |delegate| must outlive this tool instance. | 71 // |delegate| must outlive this tool instance. |
| 73 explicit PaletteTool(Delegate* delegate); | 72 explicit PaletteTool(Delegate* delegate); |
| 74 virtual ~PaletteTool(); | 73 virtual ~PaletteTool(); |
| 75 | 74 |
| 76 // The group this tool belongs to. Only one tool per group can be active at | 75 // The group this tool belongs to. Only one tool per group can be active at |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 110 |
| 112 // Unowned pointer to the delegate. The delegate should outlive this instance. | 111 // Unowned pointer to the delegate. The delegate should outlive this instance. |
| 113 Delegate* delegate_; | 112 Delegate* delegate_; |
| 114 | 113 |
| 115 DISALLOW_COPY_AND_ASSIGN(PaletteTool); | 114 DISALLOW_COPY_AND_ASSIGN(PaletteTool); |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 } // namespace ash | 117 } // namespace ash |
| 119 | 118 |
| 120 #endif // ASH_SYSTEM_PALETTE_PALETTE_TOOL_H_ | 119 #endif // ASH_SYSTEM_PALETTE_PALETTE_TOOL_H_ |
| OLD | NEW |