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" |
11 #include "ash/common/wm/wm_window_observer.h" | 11 #include "ash/common/wm_window_observer.h" |
12 #include "ash/wm/overview/scoped_transform_overview_window.h" | 12 #include "ash/wm/overview/scoped_transform_overview_window.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
16 #include "ui/views/controls/button/label_button.h" | 16 #include "ui/views/controls/button/label_button.h" |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 | 18 |
19 namespace views { | 19 namespace views { |
20 class ImageButton; | 20 class ImageButton; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 | 24 |
25 class WindowSelector; | 25 class WindowSelector; |
26 | |
27 namespace wm { | |
28 class WmWindow; | 26 class WmWindow; |
29 } | |
30 | 27 |
31 // This class represents an item in overview mode. | 28 // This class represents an item in overview mode. |
32 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 29 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
33 public wm::WmWindowObserver { | 30 public WmWindowObserver { |
34 public: | 31 public: |
35 class OverviewLabelButton : public views::LabelButton { | 32 class OverviewLabelButton : public views::LabelButton { |
36 public: | 33 public: |
37 OverviewLabelButton(views::ButtonListener* listener, | 34 OverviewLabelButton(views::ButtonListener* listener, |
38 const base::string16& text); | 35 const base::string16& text); |
39 | 36 |
40 ~OverviewLabelButton() override; | 37 ~OverviewLabelButton() override; |
41 | 38 |
42 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | 39 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
43 | 40 |
44 protected: | 41 protected: |
45 // views::LabelButton: | 42 // views::LabelButton: |
46 gfx::Rect GetChildAreaBounds() override; | 43 gfx::Rect GetChildAreaBounds() override; |
47 | 44 |
48 private: | 45 private: |
49 // Padding on top of the button. | 46 // Padding on top of the button. |
50 int top_padding_; | 47 int top_padding_; |
51 | 48 |
52 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 49 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
53 }; | 50 }; |
54 | 51 |
55 WindowSelectorItem(wm::WmWindow* window, WindowSelector* window_selector); | 52 WindowSelectorItem(WmWindow* window, WindowSelector* window_selector); |
56 ~WindowSelectorItem() override; | 53 ~WindowSelectorItem() override; |
57 | 54 |
58 wm::WmWindow* GetWindow(); | 55 WmWindow* GetWindow(); |
59 | 56 |
60 // Returns the root window on which this item is shown. | 57 // Returns the root window on which this item is shown. |
61 wm::WmWindow* root_window() { return root_window_; } | 58 WmWindow* root_window() { return root_window_; } |
62 | 59 |
63 // Returns true if |target| is contained in this WindowSelectorItem. | 60 // Returns true if |target| is contained in this WindowSelectorItem. |
64 bool Contains(const wm::WmWindow* target) const; | 61 bool Contains(const WmWindow* target) const; |
65 | 62 |
66 // Restores and animates the managed window to it's non overview mode state. | 63 // Restores and animates the managed window to it's non overview mode state. |
67 void RestoreWindow(); | 64 void RestoreWindow(); |
68 | 65 |
69 // Forces the managed window to be shown (ie not hidden or minimized) when | 66 // Forces the managed window to be shown (ie not hidden or minimized) when |
70 // calling RestoreWindow(). | 67 // calling RestoreWindow(). |
71 void ShowWindowOnExit(); | 68 void ShowWindowOnExit(); |
72 | 69 |
73 // Dispatched before beginning window overview. This will do any necessary | 70 // Dispatched before beginning window overview. This will do any necessary |
74 // one time actions such as restoring minimized windows. | 71 // one time actions such as restoring minimized windows. |
(...skipping 17 matching lines...) Expand all Loading... |
92 // Sets if the item is dimmed in the overview. Changing the value will also | 89 // Sets if the item is dimmed in the overview. Changing the value will also |
93 // change the visibility of the transform windows. | 90 // change the visibility of the transform windows. |
94 void SetDimmed(bool dimmed); | 91 void SetDimmed(bool dimmed); |
95 bool dimmed() const { return dimmed_; } | 92 bool dimmed() const { return dimmed_; } |
96 | 93 |
97 const gfx::Rect& target_bounds() const { return target_bounds_; } | 94 const gfx::Rect& target_bounds() const { return target_bounds_; } |
98 | 95 |
99 // views::ButtonListener: | 96 // views::ButtonListener: |
100 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 97 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
101 | 98 |
102 // wm::WmWindowObserver: | 99 // WmWindowObserver: |
103 void OnWindowDestroying(wm::WmWindow* window) override; | 100 void OnWindowDestroying(WmWindow* window) override; |
104 void OnWindowTitleChanged(wm::WmWindow* window) override; | 101 void OnWindowTitleChanged(WmWindow* window) override; |
105 | 102 |
106 private: | 103 private: |
107 friend class WindowSelectorTest; | 104 friend class WindowSelectorTest; |
108 | 105 |
109 // Sets the bounds of this selector's items to |target_bounds| in | 106 // Sets the bounds of this selector's items to |target_bounds| in |
110 // |root_window_|. The bounds change will be animated as specified | 107 // |root_window_|. The bounds change will be animated as specified |
111 // by |animation_type|. | 108 // by |animation_type|. |
112 void SetItemBounds(const gfx::Rect& target_bounds, | 109 void SetItemBounds(const gfx::Rect& target_bounds, |
113 OverviewAnimationType animation_type); | 110 OverviewAnimationType animation_type); |
114 | 111 |
(...skipping 13 matching lines...) Expand all Loading... |
128 void UpdateHeaderLayout(OverviewAnimationType animation_type); | 125 void UpdateHeaderLayout(OverviewAnimationType animation_type); |
129 | 126 |
130 // Updates the close buttons accessibility name. | 127 // Updates the close buttons accessibility name. |
131 void UpdateCloseButtonAccessibilityName(); | 128 void UpdateCloseButtonAccessibilityName(); |
132 | 129 |
133 // True if the item is being shown in the overview, false if it's being | 130 // True if the item is being shown in the overview, false if it's being |
134 // filtered. | 131 // filtered. |
135 bool dimmed_; | 132 bool dimmed_; |
136 | 133 |
137 // The root window this item is being displayed on. | 134 // The root window this item is being displayed on. |
138 wm::WmWindow* root_window_; | 135 WmWindow* root_window_; |
139 | 136 |
140 // The contained Window's wrapper. | 137 // The contained Window's wrapper. |
141 ScopedTransformOverviewWindow transform_window_; | 138 ScopedTransformOverviewWindow transform_window_; |
142 | 139 |
143 // The target bounds this selector item is fit within. | 140 // The target bounds this selector item is fit within. |
144 gfx::Rect target_bounds_; | 141 gfx::Rect target_bounds_; |
145 | 142 |
146 // True if running SetItemBounds. This prevents recursive calls resulting from | 143 // True if running SetItemBounds. This prevents recursive calls resulting from |
147 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 144 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
148 // a window layer for display on another monitor. | 145 // a window layer for display on another monitor. |
(...skipping 17 matching lines...) Expand all Loading... |
166 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. | 163 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. |
167 // Guaranteed to be non-null for the lifetime of |this|. | 164 // Guaranteed to be non-null for the lifetime of |this|. |
168 WindowSelector* window_selector_; | 165 WindowSelector* window_selector_; |
169 | 166 |
170 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 167 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
171 }; | 168 }; |
172 | 169 |
173 } // namespace ash | 170 } // namespace ash |
174 | 171 |
175 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 172 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |