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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/overview/scoped_transform_overview_window.h" | 9 #include "ash/wm/overview/scoped_transform_overview_window.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/scoped_window_targeter.h" | 12 #include "ui/aura/scoped_window_targeter.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.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/image_button.h" | 16 #include "ui/views/controls/button/image_button.h" |
17 #include "ui/views/controls/button/label_button.h" | |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 class Window; | 20 class Window; |
20 } | 21 } |
21 | 22 |
22 namespace views { | 23 namespace views { |
23 class LabelButton; | 24 class LabelButton; |
24 class Widget; | 25 class Widget; |
25 } | 26 } |
26 | 27 |
27 namespace ash { | 28 namespace ash { |
28 | 29 |
29 class OverviewWindowButton; | |
30 | |
31 // This class represents an item in overview mode. | 30 // This class represents an item in overview mode. |
32 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
33 public aura::WindowObserver { | 32 public aura::WindowObserver { |
34 public: | 33 public: |
34 class OverviewLabelButton : public views::LabelButton { | |
35 public: | |
36 OverviewLabelButton(views::ButtonListener* listener, | |
37 const base::string16& text); | |
38 | |
39 ~OverviewLabelButton() override {} | |
msw
2015/02/09 23:45:27
nit: don't define this virtual dtor inline in the
| |
40 | |
41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | |
42 | |
43 protected: | |
44 gfx::Rect GetChildAreaBounds() override; | |
msw
2015/02/09 23:45:27
nit: add the overrides section comment: "// views:
| |
45 | |
46 private: | |
47 // Padding on top of the button. | |
48 int top_padding_; | |
49 }; | |
msw
2015/02/09 23:45:27
nit: DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton)
| |
50 | |
35 explicit WindowSelectorItem(aura::Window* window); | 51 explicit WindowSelectorItem(aura::Window* window); |
36 ~WindowSelectorItem() override; | 52 ~WindowSelectorItem() override; |
37 | 53 |
38 aura::Window* GetWindow(); | 54 aura::Window* GetWindow(); |
39 | 55 |
40 // Returns the root window on which this item is shown. | 56 // Returns the root window on which this item is shown. |
41 aura::Window* root_window() { return root_window_; } | 57 aura::Window* root_window() { return root_window_; } |
42 | 58 |
43 // Returns true if |target| is contained in this WindowSelectorItem. | 59 // Returns true if |target| is contained in this WindowSelectorItem. |
44 bool Contains(const aura::Window* target) const; | 60 bool Contains(const aura::Window* target) const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 103 |
88 // Sets the bounds of this selector's items to |target_bounds| in | 104 // Sets the bounds of this selector's items to |target_bounds| in |
89 // |root_window_|. The bounds change will be animated as specified | 105 // |root_window_|. The bounds change will be animated as specified |
90 // by |animation_type|. | 106 // by |animation_type|. |
91 void SetItemBounds(const gfx::Rect& target_bounds, | 107 void SetItemBounds(const gfx::Rect& target_bounds, |
92 OverviewAnimationType animation_type); | 108 OverviewAnimationType animation_type); |
93 | 109 |
94 // Changes the opacity of all the windows the item owns. | 110 // Changes the opacity of all the windows the item owns. |
95 void SetOpacity(float opacity); | 111 void SetOpacity(float opacity); |
96 | 112 |
113 // Updates the window label bounds. | |
114 void UpdateWindowLabel(const gfx::Rect& window_bounds, | |
115 OverviewAnimationType animation_type); | |
116 | |
117 // Creates the window label. | |
118 void CreateWindowLabel(const base::string16& title); | |
119 | |
97 // Updates the close button's bounds. Any change in bounds will be animated | 120 // Updates the close button's bounds. Any change in bounds will be animated |
98 // from the current bounds to the new bounds as per the |animation_type|. | 121 // from the current bounds to the new bounds as per the |animation_type|. |
99 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 122 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
100 | 123 |
101 // Updates the close buttons accessibility name. | 124 // Updates the close buttons accessibility name. |
102 void UpdateCloseButtonAccessibilityName(); | 125 void UpdateCloseButtonAccessibilityName(); |
103 | 126 |
104 // True if the item is being shown in the overview, false if it's being | 127 // True if the item is being shown in the overview, false if it's being |
105 // filtered. | 128 // filtered. |
106 bool dimmed_; | 129 bool dimmed_; |
107 | 130 |
108 // The root window this item is being displayed on. | 131 // The root window this item is being displayed on. |
109 aura::Window* root_window_; | 132 aura::Window* root_window_; |
110 | 133 |
111 // The contained Window's wrapper. | 134 // The contained Window's wrapper. |
112 ScopedTransformOverviewWindow transform_window_; | 135 ScopedTransformOverviewWindow transform_window_; |
113 | 136 |
114 // The target bounds this selector item is fit within. | 137 // The target bounds this selector item is fit within. |
115 gfx::Rect target_bounds_; | 138 gfx::Rect target_bounds_; |
116 | 139 |
117 // True if running SetItemBounds. This prevents recursive calls resulting from | 140 // True if running SetItemBounds. This prevents recursive calls resulting from |
118 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 141 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
119 // a window layer for display on another monitor. | 142 // a window layer for display on another monitor. |
120 bool in_bounds_update_; | 143 bool in_bounds_update_; |
121 | 144 |
145 // Label under the window displaying its active tab name. | |
146 scoped_ptr<views::Widget> window_label_; | |
147 | |
148 // View for the label under the window. | |
149 OverviewLabelButton* window_label_button_view_; | |
150 | |
122 // The close buttons widget container. | 151 // The close buttons widget container. |
123 views::Widget close_button_widget_; | 152 views::Widget close_button_widget_; |
124 | 153 |
125 // An easy to access close button for the window in this item. Owned by the | 154 // An easy to access close button for the window in this item. Owned by the |
126 // close_button_widget_. | 155 // close_button_widget_. |
127 views::ImageButton* close_button_; | 156 views::ImageButton* close_button_; |
128 | 157 |
129 // Button that handles window activation. | |
130 scoped_ptr<OverviewWindowButton> overview_window_button_; | |
131 | |
132 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 158 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
133 }; | 159 }; |
134 | 160 |
135 } // namespace ash | 161 } // namespace ash |
136 | 162 |
137 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 163 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |