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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | 51 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
52 void SetShelfAlignment(ShelfAlignment alignment) override; | 52 void SetShelfAlignment(ShelfAlignment alignment) override; |
53 void AnchorUpdated() override; | 53 void AnchorUpdated() override; |
54 | 54 |
55 // PaletteToolManager::Delegate: | 55 // PaletteToolManager::Delegate: |
56 void HidePalette() override; | 56 void HidePalette() override; |
57 | 57 |
58 // Returns true if the shelf should not autohide. | 58 // Returns true if the shelf should not autohide. |
59 bool ShouldBlockShelfAutoHide() const; | 59 bool ShouldBlockShelfAutoHide() const; |
60 | 60 |
| 61 // Opens up the palette if it is not already open. Returns true if the palette |
| 62 // was opened. |
| 63 bool ShowPalette(); |
| 64 |
61 private: | 65 private: |
62 // views::TrayBubbleView::Delegate: | 66 // views::TrayBubbleView::Delegate: |
63 void BubbleViewDestroyed() override; | 67 void BubbleViewDestroyed() override; |
64 void OnMouseEnteredView() override; | 68 void OnMouseEnteredView() override; |
65 void OnMouseExitedView() override; | 69 void OnMouseExitedView() override; |
66 base::string16 GetAccessibleNameForBubble() override; | 70 base::string16 GetAccessibleNameForBubble() override; |
67 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, | 71 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
68 AnchorType anchor_type, | 72 AnchorType anchor_type, |
69 AnchorAlignment anchor_alignment) const override; | 73 AnchorAlignment anchor_alignment) const override; |
70 void OnBeforeBubbleWidgetInit( | 74 void OnBeforeBubbleWidgetInit( |
(...skipping 15 matching lines...) Expand all Loading... |
86 | 90 |
87 // Sets the icon to visible if the palette can be used. | 91 // Sets the icon to visible if the palette can be used. |
88 void UpdateIconVisibility(); | 92 void UpdateIconVisibility(); |
89 | 93 |
90 // Called when a stylus inserted or removed event is received. | 94 // Called when a stylus inserted or removed event is received. |
91 void OnStylusStateChanged(ui::StylusState stylus_state); | 95 void OnStylusStateChanged(ui::StylusState stylus_state); |
92 | 96 |
93 // Called when the palette enabled pref has changed. | 97 // Called when the palette enabled pref has changed. |
94 void OnPaletteEnabledPrefChanged(bool enabled); | 98 void OnPaletteEnabledPrefChanged(bool enabled); |
95 | 99 |
96 bool OpenBubble(); | |
97 void AddToolsToView(views::View* host); | 100 void AddToolsToView(views::View* host); |
98 | 101 |
99 std::unique_ptr<PaletteToolManager> palette_tool_manager_; | 102 std::unique_ptr<PaletteToolManager> palette_tool_manager_; |
100 std::unique_ptr<TrayBubbleWrapper> bubble_; | 103 std::unique_ptr<TrayBubbleWrapper> bubble_; |
101 | 104 |
102 // Manages the callback OnPaletteEnabledPrefChanged callback registered to | 105 // Manages the callback OnPaletteEnabledPrefChanged callback registered to |
103 // the PaletteDelegate instance. | 106 // the PaletteDelegate instance. |
104 std::unique_ptr<PaletteDelegate::EnableListenerSubscription> | 107 std::unique_ptr<PaletteDelegate::EnableListenerSubscription> |
105 palette_enabled_subscription_; | 108 palette_enabled_subscription_; |
106 | 109 |
107 // Weak pointer, will be parented by TrayContainer for its lifetime. | 110 // Weak pointer, will be parented by TrayContainer for its lifetime. |
108 views::ImageView* icon_; | 111 views::ImageView* icon_; |
109 | 112 |
110 base::WeakPtrFactory<PaletteTray> weak_factory_; | 113 base::WeakPtrFactory<PaletteTray> weak_factory_; |
111 | 114 |
112 DISALLOW_COPY_AND_ASSIGN(PaletteTray); | 115 DISALLOW_COPY_AND_ASSIGN(PaletteTray); |
113 }; | 116 }; |
114 | 117 |
115 } // namespace ash | 118 } // namespace ash |
116 | 119 |
117 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | 120 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ |
OLD | NEW |