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