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_BUTTON_TRAY_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/common/palette_delegate.h" |
12 #include "ash/common/session/session_state_observer.h" | 13 #include "ash/common/session/session_state_observer.h" |
13 #include "ash/common/shell_observer.h" | 14 #include "ash/common/shell_observer.h" |
14 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" | 15 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
15 #include "ash/common/system/tray/tray_background_view.h" | 16 #include "ash/common/system/tray/tray_background_view.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "ui/events/devices/input_device_manager.h" | |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class ImageView; | 21 class ImageView; |
22 class Widget; | 22 class Widget; |
23 } | 23 } |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 | 26 |
27 class TrayBubbleWrapper; | 27 class TrayBubbleWrapper; |
28 class PaletteToolManager; | 28 class PaletteToolManager; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Updates the tray icon from the palette tool manager. | 84 // Updates the tray icon from the palette tool manager. |
85 void UpdateTrayIcon(); | 85 void UpdateTrayIcon(); |
86 | 86 |
87 // Sets the icon to visible if the palette can be used. | 87 // Sets the icon to visible if the palette can be used. |
88 void UpdateIconVisibility(); | 88 void UpdateIconVisibility(); |
89 | 89 |
90 // Called when a stylus inserted or removed event is received. | 90 // Called when a stylus inserted or removed event is received. |
91 void OnStylusStateChanged(ui::StylusState stylus_state); | 91 void OnStylusStateChanged(ui::StylusState stylus_state); |
92 | 92 |
| 93 // Called when the palette enabled pref has changed. |
| 94 void OnPaletteEnabledPrefChanged(bool enabled); |
| 95 |
93 bool OpenBubble(); | 96 bool OpenBubble(); |
94 void AddToolsToView(views::View* host); | 97 void AddToolsToView(views::View* host); |
95 | 98 |
96 std::unique_ptr<PaletteToolManager> palette_tool_manager_; | 99 std::unique_ptr<PaletteToolManager> palette_tool_manager_; |
97 std::unique_ptr<TrayBubbleWrapper> bubble_; | 100 std::unique_ptr<TrayBubbleWrapper> bubble_; |
98 | 101 |
| 102 // Manages the callback OnPaletteEnabledPrefChanged callback registered to |
| 103 // the PaletteDelegate instance. |
| 104 std::unique_ptr<PaletteDelegate::EnableListenerSubscription> |
| 105 palette_enabled_subscription_; |
| 106 |
99 // Weak pointer, will be parented by TrayContainer for its lifetime. | 107 // Weak pointer, will be parented by TrayContainer for its lifetime. |
100 views::ImageView* icon_; | 108 views::ImageView* icon_; |
101 | 109 |
102 base::WeakPtrFactory<PaletteTray> weak_factory_; | 110 base::WeakPtrFactory<PaletteTray> weak_factory_; |
103 | 111 |
104 DISALLOW_COPY_AND_ASSIGN(PaletteTray); | 112 DISALLOW_COPY_AND_ASSIGN(PaletteTray); |
105 }; | 113 }; |
106 | 114 |
107 } // namespace ash | 115 } // namespace ash |
108 | 116 |
109 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | 117 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ |
OLD | NEW |