OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const char* GetClassName() const override; | 74 const char* GetClassName() const override; |
75 void ChildPreferredSizeChanged(views::View* child) override; | 75 void ChildPreferredSizeChanged(views::View* child) override; |
76 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 76 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
77 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 77 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
78 void OnPaint(gfx::Canvas* canvas) override; | 78 void OnPaint(gfx::Canvas* canvas) override; |
79 | 79 |
80 // ActionableView: | 80 // ActionableView: |
81 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 81 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
82 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 82 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
83 const override; | 83 const override; |
84 void OnGestureEvent(ui::GestureEvent* event) override; | |
85 | 84 |
86 // Called whenever the shelf alignment changes. | 85 // Called whenever the shelf alignment changes. |
87 virtual void SetShelfAlignment(ShelfAlignment alignment); | 86 virtual void SetShelfAlignment(ShelfAlignment alignment); |
88 | 87 |
89 // Called when the anchor (tray or bubble) may have moved or changed. | 88 // Called when the anchor (tray or bubble) may have moved or changed. |
90 virtual void AnchorUpdated() {} | 89 virtual void AnchorUpdated() {} |
91 | 90 |
92 // Called from GetAccessibleNodeData, must return a valid accessible name. | 91 // Called from GetAccessibleNodeData, must return a valid accessible name. |
93 virtual base::string16 GetAccessibleNameForTray() = 0; | 92 virtual base::string16 GetAccessibleNameForTray() = 0; |
94 | 93 |
95 // Called when the bubble is resized. | 94 // Called when the bubble is resized. |
96 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} | 95 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} |
97 | 96 |
98 // Hides the bubble associated with |bubble_view|. Called when the widget | 97 // Hides the bubble associated with |bubble_view|. Called when the widget |
99 // is closed. | 98 // is closed. |
100 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; | 99 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; |
101 | 100 |
102 // Called by the bubble wrapper when a click event occurs outside the bubble. | 101 // Called by the bubble wrapper when a click event occurs outside the bubble. |
103 // May close the bubble. | 102 // May close the bubble. |
104 virtual void ClickedOutsideBubble() = 0; | 103 virtual void ClickedOutsideBubble() = 0; |
105 | 104 |
106 // Sets |contents| as a child. | 105 // Sets |contents| as a child. |
107 void SetContents(views::View* contents); | 106 void SetContents(views::View* contents); |
108 | 107 |
109 // Creates and sets contents background to |background_|. |draws_active| | 108 // Creates and sets contents background to |background_|. |
110 // determines if the view's background should be drawn as active when the view | 109 void SetContentsBackground(); |
111 // is in the active state. | |
112 void SetContentsBackground(bool draws_active); | |
113 | 110 |
114 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 111 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
115 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 112 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
116 | 113 |
117 void SetIsActive(bool is_active); | 114 void SetIsActive(bool is_active); |
118 bool is_active() const { return is_active_; } | 115 bool is_active() const { return is_active_; } |
119 | 116 |
120 TrayContainer* tray_container() const { return tray_container_; } | 117 TrayContainer* tray_container() const { return tray_container_; } |
121 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 118 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
122 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 119 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Convenience pointer to the contents view. | 168 // Convenience pointer to the contents view. |
172 TrayContainer* tray_container_; | 169 TrayContainer* tray_container_; |
173 | 170 |
174 // Shelf alignment. | 171 // Shelf alignment. |
175 // TODO(jamescook): Don't cache this, get it from WmShelf. | 172 // TODO(jamescook): Don't cache this, get it from WmShelf. |
176 ShelfAlignment shelf_alignment_; | 173 ShelfAlignment shelf_alignment_; |
177 | 174 |
178 // Owned by the view passed to SetContents(). | 175 // Owned by the view passed to SetContents(). |
179 TrayBackground* background_; | 176 TrayBackground* background_; |
180 | 177 |
181 // Determines if the view is active. This changes how the background is drawn | 178 // Determines if the view is active. This changes how the ink drop ripples |
182 // in non-MD version and how the ink drop ripples behave in MD version. | 179 // behave. |
183 bool is_active_; | 180 bool is_active_; |
184 | 181 |
185 // Visibility of this tray's separator which is a line of 1x32px and 4px to | 182 // Visibility of this tray's separator which is a line of 1x32px and 4px to |
186 // right of tray. | 183 // right of tray. |
187 bool separator_visible_; | 184 bool separator_visible_; |
188 | 185 |
189 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 186 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
190 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 187 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
191 | 188 |
192 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 189 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
193 }; | 190 }; |
194 | 191 |
195 } // namespace ash | 192 } // namespace ash |
196 | 193 |
197 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 194 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |