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" |
18 #include "base/memory/weak_ptr.h" | |
17 | 19 |
18 namespace views { | 20 namespace views { |
19 class ImageView; | 21 class ImageView; |
20 class Widget; | 22 class Widget; |
21 } | 23 } |
22 | 24 |
23 namespace ash { | 25 namespace ash { |
24 | 26 |
25 class TrayBubbleWrapper; | 27 class TrayBubbleWrapper; |
26 class PaletteToolManager; | 28 class PaletteToolManager; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 // Creates a new border for the icon. The padding is determined based on the | 77 // Creates a new border for the icon. The padding is determined based on the |
76 // alignment of the shelf. | 78 // alignment of the shelf. |
77 void SetIconBorderForShelfAlignment(); | 79 void SetIconBorderForShelfAlignment(); |
78 | 80 |
79 // Updates the tray icon from the palette tool manager. | 81 // Updates the tray icon from the palette tool manager. |
80 void UpdateTrayIcon(); | 82 void UpdateTrayIcon(); |
81 | 83 |
82 // Sets the icon to visible if the palette can be used. | 84 // Sets the icon to visible if the palette can be used. |
83 void UpdateIconVisibility(); | 85 void UpdateIconVisibility(); |
84 | 86 |
87 // Called when the palette enabled pref has changed. | |
88 void OnPaletteEnabledPrefChanged(bool enabled); | |
89 | |
85 bool OpenBubble(); | 90 bool OpenBubble(); |
86 void AddToolsToView(views::View* host); | 91 void AddToolsToView(views::View* host); |
87 | 92 |
88 std::unique_ptr<PaletteToolManager> palette_tool_manager_; | 93 std::unique_ptr<PaletteToolManager> palette_tool_manager_; |
89 std::unique_ptr<TrayBubbleWrapper> bubble_; | 94 std::unique_ptr<TrayBubbleWrapper> bubble_; |
90 | 95 |
96 // Manages the callback OnPaletteEnabledPrefChanged callback registered to | |
97 // the PaletteDelegate instance. | |
98 std::unique_ptr<PaletteDelegate::EnableListenerSubscription> palette_enabled_; | |
stevenjb
2016/08/23 17:36:41
This is a confusing variable name, I would use pal
jdufault
2016/08/23 22:49:56
Done.
| |
99 | |
91 // Weak pointer, will be parented by TrayContainer for its lifetime. | 100 // Weak pointer, will be parented by TrayContainer for its lifetime. |
92 views::ImageView* icon_; | 101 views::ImageView* icon_; |
93 | 102 |
103 base::WeakPtrFactory<PaletteTray> weak_factory_; | |
104 | |
94 DISALLOW_COPY_AND_ASSIGN(PaletteTray); | 105 DISALLOW_COPY_AND_ASSIGN(PaletteTray); |
95 }; | 106 }; |
96 | 107 |
97 } // namespace ash | 108 } // namespace ash |
98 | 109 |
99 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | 110 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ |
OLD | NEW |