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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 private: | 53 private: |
54 void UpdateLayout(); | 54 void UpdateLayout(); |
55 | 55 |
56 ShelfAlignment alignment_; | 56 ShelfAlignment alignment_; |
57 int main_axis_margin_ = 0; | 57 int main_axis_margin_ = 0; |
58 int cross_axis_margin_ = 0; | 58 int cross_axis_margin_ = 0; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(TrayContainer); | 60 DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
61 }; | 61 }; |
62 | 62 |
63 explicit TrayBackgroundView(WmShelf* wm_shelf); | 63 TrayBackgroundView(WmShelf* wm_shelf, bool no_background); |
Evan Stade
2017/03/02 02:49:51
I would expect this to be inverted, i.e. bool draw
mohsen
2017/03/02 04:07:09
Done.
| |
64 ~TrayBackgroundView() override; | 64 ~TrayBackgroundView() override; |
65 | 65 |
66 // Called after the tray has been added to the widget containing it. | 66 // Called after the tray has been added to the widget containing it. |
67 virtual void Initialize(); | 67 virtual void Initialize(); |
68 | 68 |
69 // Initializes animations for the bubble. | 69 // Initializes animations for the bubble. |
70 static void InitializeBubbleAnimations(views::Widget* bubble_widget); | 70 static void InitializeBubbleAnimations(views::Widget* bubble_widget); |
71 | 71 |
72 // views::View: | 72 // views::View: |
73 void SetVisible(bool visible) override; | 73 void SetVisible(bool visible) override; |
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. | |
107 void SetContents(views::View* contents); | |
108 | |
109 // Creates and sets contents background to |background_|. |draws_active| | |
110 // determines if the view's background should be drawn as active when the view | |
111 // is in the active state. | |
112 void SetContentsBackground(bool draws_active); | |
113 | |
114 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 105 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
115 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 106 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
116 | 107 |
117 void SetIsActive(bool is_active); | 108 void SetIsActive(bool is_active); |
118 bool is_active() const { return is_active_; } | 109 bool is_active() const { return is_active_; } |
119 | 110 |
120 TrayContainer* tray_container() const { return tray_container_; } | 111 TrayContainer* tray_container() const { return tray_container_; } |
121 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 112 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
122 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 113 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
123 WmShelf* shelf() { return wm_shelf_; } | 114 WmShelf* shelf() { return wm_shelf_; } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 // Convenience pointer to the contents view. | 162 // Convenience pointer to the contents view. |
172 TrayContainer* tray_container_; | 163 TrayContainer* tray_container_; |
173 | 164 |
174 // Shelf alignment. | 165 // Shelf alignment. |
175 // TODO(jamescook): Don't cache this, get it from WmShelf. | 166 // TODO(jamescook): Don't cache this, get it from WmShelf. |
176 ShelfAlignment shelf_alignment_; | 167 ShelfAlignment shelf_alignment_; |
177 | 168 |
178 // Owned by the view passed to SetContents(). | 169 // Owned by the view passed to SetContents(). |
179 TrayBackground* background_; | 170 TrayBackground* background_; |
180 | 171 |
181 // Determines if the view is active. This changes how the background is drawn | 172 // 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. | 173 // behave. |
183 bool is_active_; | 174 bool is_active_; |
184 | 175 |
185 // Visibility of this tray's separator which is a line of 1x32px and 4px to | 176 // Visibility of this tray's separator which is a line of 1x32px and 4px to |
186 // right of tray. | 177 // right of tray. |
187 bool separator_visible_; | 178 bool separator_visible_; |
188 | 179 |
189 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 180 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
190 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 181 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
191 | 182 |
192 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 183 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
193 }; | 184 }; |
194 | 185 |
195 } // namespace ash | 186 } // namespace ash |
196 | 187 |
197 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 188 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |