| 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_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_H_ |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Called when the user activates the tool. Only one tool per group can be | 70 // Called when the user activates the tool. Only one tool per group can be |
| 71 // active at any given time. | 71 // active at any given time. |
| 72 virtual void OnEnable(); | 72 virtual void OnEnable(); |
| 73 | 73 |
| 74 // Disable the tool, either because this tool called DisableSelf(), the | 74 // Disable the tool, either because this tool called DisableSelf(), the |
| 75 // user cancelled the tool, or the user activated another tool within the | 75 // user cancelled the tool, or the user activated another tool within the |
| 76 // same group. | 76 // same group. |
| 77 virtual void OnDisable(); | 77 virtual void OnDisable(); |
| 78 | 78 |
| 79 // Create a view that will be used in the palette. The view is owned by the | 79 // Create a view that will be used in the palette, or nullptr if this tool |
| 80 // caller. OnViewDestroyed is called when the view has been deallocated by its | 80 // should not be displayed. The view is owned by the caller. OnViewDestroyed |
| 81 // owner. | 81 // is called when the view has been deallocated by its owner. |
| 82 virtual views::View* CreateView() = 0; | 82 virtual views::View* CreateView() = 0; |
| 83 virtual void OnViewDestroyed() = 0; | 83 virtual void OnViewDestroyed() = 0; |
| 84 | 84 |
| 85 // Returns an icon to use in the tray if this tool is active. Only one tool | 85 // Returns an icon to use in the tray if this tool is active. Only one tool |
| 86 // (per-group) should ever have an active icon at any given time. | 86 // (per-group) should ever have an active icon at any given time. |
| 87 virtual gfx::VectorIconId GetActiveTrayIcon(); | 87 virtual gfx::VectorIconId GetActiveTrayIcon(); |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 // Enables/disables the tool. | 90 // Enables/disables the tool. |
| 91 bool enabled() const { return enabled_; } | 91 bool enabled() const { return enabled_; } |
| 92 | 92 |
| 93 Delegate* delegate() { return delegate_; } | 93 Delegate* delegate() { return delegate_; } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 bool enabled_ = false; | 96 bool enabled_ = false; |
| 97 | 97 |
| 98 // Unowned pointer to the delegate. The delegate should outlive this instance. | 98 // Unowned pointer to the delegate. The delegate should outlive this instance. |
| 99 Delegate* delegate_; | 99 Delegate* delegate_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(PaletteTool); | 101 DISALLOW_COPY_AND_ASSIGN(PaletteTool); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace ash | 104 } // namespace ash |
| 105 | 105 |
| 106 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_H_ | 106 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_TOOL_H_ |
| OLD | NEW |