Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Side by Side Diff: ash/common/system/tray/tray_background_view.h

Issue 2499453002: Add ink drop ripple to overview mode button (Closed)
Patch Set: Addressed review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
82 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
83 const override;
84 bool ShouldEnterPushedState(const ui::Event& event) override;
81 bool PerformAction(const ui::Event& event) override; 85 bool PerformAction(const ui::Event& event) override;
86 void HandlePerformActionResult(bool action_performed,
87 const ui::Event& event) override;
82 gfx::Rect GetFocusBounds() override; 88 gfx::Rect GetFocusBounds() override;
83 void OnGestureEvent(ui::GestureEvent* event) override; 89 void OnGestureEvent(ui::GestureEvent* event) override;
84 90
85 // Called whenever the shelf alignment changes. 91 // Called whenever the shelf alignment changes.
86 virtual void SetShelfAlignment(ShelfAlignment alignment); 92 virtual void SetShelfAlignment(ShelfAlignment alignment);
87 93
88 // Called when the anchor (tray or bubble) may have moved or changed. 94 // Called when the anchor (tray or bubble) may have moved or changed.
89 virtual void AnchorUpdated() {} 95 virtual void AnchorUpdated() {}
90 96
91 // Called from GetAccessibleNodeData, must return a valid accessible name. 97 // Called from GetAccessibleNodeData, must return a valid accessible name.
92 virtual base::string16 GetAccessibleNameForTray() = 0; 98 virtual base::string16 GetAccessibleNameForTray() = 0;
93 99
94 // Called when the bubble is resized. 100 // Called when the bubble is resized.
95 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} 101 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {}
96 102
97 // Hides the bubble associated with |bubble_view|. Called when the widget 103 // Hides the bubble associated with |bubble_view|. Called when the widget
98 // is closed. 104 // is closed.
99 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; 105 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0;
100 106
101 // Called by the bubble wrapper when a click event occurs outside the bubble. 107 // Called by the bubble wrapper when a click event occurs outside the bubble.
102 // May close the bubble. 108 // May close the bubble.
103 virtual void ClickedOutsideBubble() = 0; 109 virtual void ClickedOutsideBubble() = 0;
104 110
105 // Sets |contents| as a child. 111 // Sets |contents| as a child.
106 void SetContents(views::View* contents); 112 void SetContents(views::View* contents);
107 113
108 // Creates and sets contents background to |background_|. 114 // Creates and sets contents background to |background_|. |draws_active|
109 void SetContentsBackground(); 115 // determines if the view needs its active background drawn.
tdanderson 2016/11/12 02:18:58 nit: I think a clearer wording would be "|draws_ac
mohsen 2016/11/13 05:10:04 Done.
116 void SetContentsBackground(bool draws_active);
110 117
111 // Returns the anchor rect for the bubble. 118 // Returns the anchor rect for the bubble.
112 gfx::Rect GetBubbleAnchorRect( 119 gfx::Rect GetBubbleAnchorRect(
113 views::Widget* anchor_widget, 120 views::Widget* anchor_widget,
114 views::TrayBubbleView::AnchorType anchor_type, 121 views::TrayBubbleView::AnchorType anchor_type,
115 views::TrayBubbleView::AnchorAlignment anchor_alignment) const; 122 views::TrayBubbleView::AnchorAlignment anchor_alignment) const;
116 123
117 // Returns the bubble anchor alignment based on |shelf_alignment_|. 124 // Returns the bubble anchor alignment based on |shelf_alignment_|.
118 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; 125 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const;
119 126
120 // Forces the background to be drawn active if set to true. 127 void SetIsActive(bool is_active);
121 void SetDrawBackgroundAsActive(bool visible); 128 bool is_active() const { return is_active_; }
122
123 // Returns true when the the background was overridden to be drawn as active.
124 bool draw_background_as_active() const { return draw_background_as_active_; }
125 129
126 TrayContainer* tray_container() const { return tray_container_; } 130 TrayContainer* tray_container() const { return tray_container_; }
127 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } 131 ShelfAlignment shelf_alignment() const { return shelf_alignment_; }
128 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } 132 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); }
129 WmShelf* shelf() { return wm_shelf_; } 133 WmShelf* shelf() { return wm_shelf_; }
130 134
131 // Updates the arrow visibility based on the launcher visibility. 135 // Updates the arrow visibility based on the launcher visibility.
132 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); 136 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view);
133 137
134 // ShelfBackgroundAnimatorObserver: 138 // ShelfBackgroundAnimatorObserver:
(...skipping 19 matching lines...) Expand all
154 // Convenience pointer to the contents view. 158 // Convenience pointer to the contents view.
155 TrayContainer* tray_container_; 159 TrayContainer* tray_container_;
156 160
157 // Shelf alignment. 161 // Shelf alignment.
158 // TODO(jamescook): Don't cache this, get it from WmShelf. 162 // TODO(jamescook): Don't cache this, get it from WmShelf.
159 ShelfAlignment shelf_alignment_; 163 ShelfAlignment shelf_alignment_;
160 164
161 // Owned by the view passed to SetContents(). 165 // Owned by the view passed to SetContents().
162 TrayBackground* background_; 166 TrayBackground* background_;
163 167
164 // This variable stores the activation override which will tint the background 168 // Determines if the view is active. This changes how the background is drawn
165 // differently if set to true. 169 // in non-MD version and how the ink drop ripples behave in MD version.
166 bool draw_background_as_active_; 170 bool is_active_;
167 171
168 // Visibility of this tray's separator which is a line of 1x32px and 4px to 172 // Visibility of this tray's separator which is a line of 1x32px and 4px to
169 // right of tray. 173 // right of tray.
170 bool is_separator_visible_; 174 bool is_separator_visible_;
171 175
172 std::unique_ptr<TrayWidgetObserver> widget_observer_; 176 std::unique_ptr<TrayWidgetObserver> widget_observer_;
173 std::unique_ptr<TrayEventFilter> tray_event_filter_; 177 std::unique_ptr<TrayEventFilter> tray_event_filter_;
174 178
175 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 179 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
176 }; 180 };
177 181
178 } // namespace ash 182 } // namespace ash
179 183
180 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 184 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698