OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class SlideAnimation; | 22 class SlideAnimation; |
23 } | 23 } |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class ImageButton; | 26 class ImageButton; |
27 } | 27 } |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
30 | 30 |
31 class WindowSelector; | 31 class WindowSelector; |
32 class WindowGrid; | |
33 | 32 |
34 // This class represents an item in overview mode. | 33 // This class represents an item in overview mode. |
35 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 34 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
36 public aura::WindowObserver { | 35 public aura::WindowObserver { |
37 public: | 36 public: |
38 // An image button with a close window icon. | 37 // An image button with a close window icon. |
39 class OverviewCloseButton : public views::ImageButton { | 38 class OverviewCloseButton : public views::ImageButton { |
40 public: | 39 public: |
41 explicit OverviewCloseButton(views::ButtonListener* listener); | 40 explicit OverviewCloseButton(views::ButtonListener* listener); |
42 ~OverviewCloseButton() override; | 41 ~OverviewCloseButton() override; |
43 | 42 |
44 // Resets the listener so that the listener can go out of scope. | 43 // Resets the listener so that the listener can go out of scope. |
45 void ResetListener() { listener_ = nullptr; } | 44 void ResetListener() { listener_ = nullptr; } |
46 | 45 |
47 private: | 46 private: |
48 DISALLOW_COPY_AND_ASSIGN(OverviewCloseButton); | 47 DISALLOW_COPY_AND_ASSIGN(OverviewCloseButton); |
49 }; | 48 }; |
50 | 49 |
51 WindowSelectorItem(aura::Window* window, | 50 WindowSelectorItem(aura::Window* window, WindowSelector* window_selector); |
52 WindowSelector* window_selector, | |
53 WindowGrid* window_grid); | |
54 ~WindowSelectorItem() override; | 51 ~WindowSelectorItem() override; |
55 | 52 |
56 aura::Window* GetWindow(); | 53 aura::Window* GetWindow(); |
57 | 54 |
58 // Returns the root window on which this item is shown. | 55 // Returns the root window on which this item is shown. |
59 aura::Window* root_window() { return root_window_; } | 56 aura::Window* root_window() { return root_window_; } |
60 | 57 |
61 // Returns true if |target| is contained in this WindowSelectorItem. | 58 // Returns true if |target| is contained in this WindowSelectorItem. |
62 bool Contains(const aura::Window* target) const; | 59 bool Contains(const aura::Window* target) const; |
63 | 60 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 113 |
117 const gfx::Rect& target_bounds() const { return target_bounds_; } | 114 const gfx::Rect& target_bounds() const { return target_bounds_; } |
118 | 115 |
119 // views::ButtonListener: | 116 // views::ButtonListener: |
120 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 117 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
121 | 118 |
122 // aura::WindowObserver: | 119 // aura::WindowObserver: |
123 void OnWindowDestroying(aura::Window* window) override; | 120 void OnWindowDestroying(aura::Window* window) override; |
124 void OnWindowTitleChanged(aura::Window* window) override; | 121 void OnWindowTitleChanged(aura::Window* window) override; |
125 | 122 |
126 // Handle the mouse/gesture event and facilitate dragging the item. | |
127 void HandlePressEvent(const gfx::Point& location_in_screen); | |
128 void HandleReleaseEvent(const gfx::Point& location_in_screen); | |
129 void HandleDragEvent(const gfx::Point& location_in_screen); | |
130 | |
131 private: | 123 private: |
132 class CaptionContainerView; | 124 class CaptionContainerView; |
133 class RoundedContainerView; | 125 class RoundedContainerView; |
134 friend class WindowSelectorTest; | 126 friend class WindowSelectorTest; |
135 | 127 |
136 enum class HeaderFadeInMode { | 128 enum class HeaderFadeInMode { |
137 ENTER, | 129 ENTER, |
138 UPDATE, | 130 UPDATE, |
139 EXIT, | 131 EXIT, |
140 }; | 132 }; |
(...skipping 26 matching lines...) Expand all Loading... |
167 void UpdateAccessibilityName(); | 159 void UpdateAccessibilityName(); |
168 | 160 |
169 // Fades out a window caption when exiting overview mode. | 161 // Fades out a window caption when exiting overview mode. |
170 void FadeOut(std::unique_ptr<views::Widget> widget); | 162 void FadeOut(std::unique_ptr<views::Widget> widget); |
171 | 163 |
172 // Allows a test to directly set animation state. | 164 // Allows a test to directly set animation state. |
173 gfx::SlideAnimation* GetBackgroundViewAnimation(); | 165 gfx::SlideAnimation* GetBackgroundViewAnimation(); |
174 | 166 |
175 aura::Window* GetOverviewWindowForMinimizedStateForTest(); | 167 aura::Window* GetOverviewWindowForMinimizedStateForTest(); |
176 | 168 |
177 // Called before dragging. Scales up the window a little bit to indicate its | |
178 // selection and stacks the window at the top of the Z order in order to keep | |
179 // it visible while dragging around. | |
180 void StartDrag(); | |
181 | |
182 // Called after dragging. Inserts the window back to its original stacking | |
183 // order so that the order of windows is the same as when entering overview. | |
184 void EndDrag(); | |
185 | |
186 // True if the item is being shown in the overview, false if it's being | 169 // True if the item is being shown in the overview, false if it's being |
187 // filtered. | 170 // filtered. |
188 bool dimmed_; | 171 bool dimmed_; |
189 | 172 |
190 // The root window this item is being displayed on. | 173 // The root window this item is being displayed on. |
191 aura::Window* root_window_; | 174 aura::Window* root_window_; |
192 | 175 |
193 // The contained Window's wrapper. | 176 // The contained Window's wrapper. |
194 ScopedTransformOverviewWindow transform_window_; | 177 ScopedTransformOverviewWindow transform_window_; |
195 | 178 |
(...skipping 29 matching lines...) Expand all Loading... |
225 | 208 |
226 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. | 209 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. |
227 // Guaranteed to be non-null for the lifetime of |this|. | 210 // Guaranteed to be non-null for the lifetime of |this|. |
228 WindowSelector* window_selector_; | 211 WindowSelector* window_selector_; |
229 | 212 |
230 // Pointer to a view that covers the original header and has rounded top | 213 // Pointer to a view that covers the original header and has rounded top |
231 // corners. This view can have its color and opacity animated. It has a layer | 214 // corners. This view can have its color and opacity animated. It has a layer |
232 // which is the only textured layer used by the |item_widget_|. | 215 // which is the only textured layer used by the |item_widget_|. |
233 RoundedContainerView* background_view_; | 216 RoundedContainerView* background_view_; |
234 | 217 |
235 // Pointer to the WindowGrid that contains |this|. Guaranteed to be non-null | |
236 // for the lifetime of |this|. | |
237 WindowGrid* window_grid_; | |
238 | |
239 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 218 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
240 }; | 219 }; |
241 | 220 |
242 } // namespace ash | 221 } // namespace ash |
243 | 222 |
244 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 223 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |