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 "ash/wm/overview/transparent_activate_window_button.h" | |
11 #include "ash/wm/overview/transparent_activate_window_button_delegate.h" | |
12 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/scoped_window_targeter.h" | |
14 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
15 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/controls/button/image_button.h" | 16 #include "ui/views/controls/button/image_button.h" |
18 | 17 |
19 namespace aura { | 18 namespace aura { |
20 class Window; | 19 class Window; |
21 } | 20 } |
22 | 21 |
23 namespace views { | 22 namespace views { |
24 class Label; | 23 class LabelButton; |
25 class Widget; | 24 class Widget; |
26 } | 25 } |
27 | 26 |
28 namespace ash { | 27 namespace ash { |
29 | 28 |
29 class OverviewWindowTargeter; | |
30 | |
30 // This class represents an item in overview mode. | 31 // This class represents an item in overview mode. |
31 class ASH_EXPORT WindowSelectorItem | 32 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
32 : public views::ButtonListener, | 33 public aura::WindowObserver { |
33 public aura::WindowObserver, | |
34 public TransparentActivateWindowButtonDelegate { | |
35 public: | 34 public: |
36 explicit WindowSelectorItem(aura::Window* window); | 35 explicit WindowSelectorItem(aura::Window* window); |
37 ~WindowSelectorItem() override; | 36 ~WindowSelectorItem() override; |
38 | 37 |
39 aura::Window* GetWindow(); | 38 aura::Window* GetWindow(); |
40 | 39 |
41 // Returns the root window on which this item is shown. | 40 // Returns the root window on which this item is shown. |
42 aura::Window* root_window() { return root_window_; } | 41 aura::Window* root_window() { return root_window_; } |
43 | 42 |
44 // Returns true if |target| is contained in this WindowSelectorItem. | 43 // Returns true if |target| is contained in this WindowSelectorItem. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 75 |
77 const gfx::Rect& target_bounds() const { return target_bounds_; } | 76 const gfx::Rect& target_bounds() const { return target_bounds_; } |
78 | 77 |
79 // views::ButtonListener: | 78 // views::ButtonListener: |
80 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 79 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
81 | 80 |
82 // aura::WindowObserver: | 81 // aura::WindowObserver: |
83 void OnWindowDestroying(aura::Window* window) override; | 82 void OnWindowDestroying(aura::Window* window) override; |
84 void OnWindowTitleChanged(aura::Window* window) override; | 83 void OnWindowTitleChanged(aura::Window* window) override; |
85 | 84 |
86 // ash::TransparentActivateWindowButtonDelegate: | |
87 void Select() override; | |
88 | |
89 private: | 85 private: |
90 friend class WindowSelectorTest; | 86 friend class WindowSelectorTest; |
91 | 87 |
92 // Sets the bounds of this selector's items to |target_bounds| in | 88 // Sets the bounds of this selector's items to |target_bounds| in |
93 // |root_window_|. The bounds change will be animated as specified | 89 // |root_window_|. The bounds change will be animated as specified |
94 // by |animation_type|. | 90 // by |animation_type|. |
95 void SetItemBounds(const gfx::Rect& target_bounds, | 91 void SetItemBounds(const gfx::Rect& target_bounds, |
96 OverviewAnimationType animation_type); | 92 OverviewAnimationType animation_type); |
97 | 93 |
98 // Changes the opacity of all the windows the item owns. | 94 // Changes the opacity of all the windows the item owns. |
99 void SetOpacity(float opacity); | 95 void SetOpacity(float opacity); |
100 | 96 |
101 // Updates the window label's bounds to |target_bounds|. Will create a new | 97 // Updates the window label's bounds to |target_bounds|. The bounds change is |
102 // window label and fade it in if it doesn't exist. The bounds change is | |
103 // animated as specified by the |animation_type|. | 98 // animated as specified by the |animation_type|. |
104 void UpdateWindowLabels(const gfx::Rect& target_bounds, | 99 void UpdateWindowLabels(const gfx::Rect& target_bounds, |
105 OverviewAnimationType animation_type); | 100 OverviewAnimationType animation_type); |
106 | 101 |
107 // Initializes window_label_. | 102 // Initializes window_label_. |
108 void CreateWindowLabel(const base::string16& title); | 103 void CreateWindowLabel(); |
109 | |
110 // Updates the bounds and accessibility names for all the transparent | |
111 // overlays. | |
112 void UpdateSelectorButtons(); | |
113 | 104 |
114 // Updates the close button's bounds. Any change in bounds will be animated | 105 // Updates the close button's bounds. Any change in bounds will be animated |
115 // from the current bounds to the new bounds as per the |animation_type|. | 106 // from the current bounds to the new bounds as per the |animation_type|. |
116 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 107 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
117 | 108 |
118 // Updates the close buttons accessibility name. | 109 // Updates the close buttons accessibility name. |
119 void UpdateCloseButtonAccessibilityName(); | 110 void UpdateCloseButtonAccessibilityName(); |
120 | 111 |
121 // True if the item is being shown in the overview, false if it's being | 112 // True if the item is being shown in the overview, false if it's being |
122 // filtered. | 113 // filtered. |
123 bool dimmed_; | 114 bool dimmed_; |
124 | 115 |
125 // The root window this item is being displayed on. | 116 // The root window this item is being displayed on. |
126 aura::Window* root_window_; | 117 aura::Window* root_window_; |
127 | 118 |
128 // The contained Window's wrapper. | 119 // The contained Window's wrapper. |
129 ScopedTransformOverviewWindow transform_window_; | 120 ScopedTransformOverviewWindow transform_window_; |
130 | 121 |
131 // The target bounds this selector item is fit within. | 122 // The target bounds this selector item is fit within. |
132 gfx::Rect target_bounds_; | 123 gfx::Rect target_bounds_; |
133 | 124 |
134 // True if running SetItemBounds. This prevents recursive calls resulting from | 125 // True if running SetItemBounds. This prevents recursive calls resulting from |
135 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 126 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
136 // a window layer for display on another monitor. | 127 // a window layer for display on another monitor. |
137 bool in_bounds_update_; | 128 bool in_bounds_update_; |
138 | 129 |
139 // Label under the window displaying its active tab name. | 130 // Label under the window displaying its active tab name. |
140 scoped_ptr<views::Widget> window_label_; | 131 scoped_ptr<views::Widget> window_label_; |
141 | 132 |
142 // View for the label under the window. | 133 // View for the label button under the window. |
tdanderson
2015/01/21 17:24:24
Mention in your CL description why you're now usin
Nina
2015/01/22 19:44:32
Done.
| |
143 views::Label* window_label_view_; | 134 views::LabelButton* window_label_button_view_; |
144 | 135 |
145 // The close buttons widget container. | 136 // The close buttons widget container. |
146 views::Widget close_button_widget_; | 137 views::Widget close_button_widget_; |
147 | 138 |
148 // An easy to access close button for the window in this item. Owned by the | 139 // An easy to access close button for the window in this item. Owned by the |
149 // close_button_widget_. | 140 // close_button_widget_. |
150 views::ImageButton* close_button_; | 141 views::ImageButton* close_button_; |
151 | 142 |
152 // Transparent overlay that covers the entire bounds of the | 143 // Reference to the targeter implemented by the scoped window targeter. |
153 // WindowSelectorItem and is stacked in front of all windows but behind each | 144 OverviewWindowTargeter* overview_window_targeter_; |
154 // Windows' own TransparentActivateWindowButton. | 145 |
155 scoped_ptr<TransparentActivateWindowButton> | 146 // Stores and restores on exit the actual window targeter. |
156 selector_item_activate_window_button_; | 147 scoped_ptr<aura::ScopedWindowTargeter> scoped_window_targeter_; |
157 | 148 |
158 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 149 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
159 }; | 150 }; |
160 | 151 |
161 } // namespace ash | 152 } // namespace ash |
162 | 153 |
163 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 154 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |