Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: ash/wm/overview/window_selector_item.h

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Address varkha@'s comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 stack order
183 // so that the windows orders are the same as when they entering overview.
varkha 2017/06/26 16:40:08 nit (I think): the windows are ordered in the same
xdai1 2017/06/26 21:44:00 Done.
184 void EndDrag();
185
169 // True if the item is being shown in the overview, false if it's being 186 // True if the item is being shown in the overview, false if it's being
170 // filtered. 187 // filtered.
171 bool dimmed_; 188 bool dimmed_;
172 189
173 // The root window this item is being displayed on. 190 // The root window this item is being displayed on.
174 aura::Window* root_window_; 191 aura::Window* root_window_;
175 192
176 // The contained Window's wrapper. 193 // The contained Window's wrapper.
177 ScopedTransformOverviewWindow transform_window_; 194 ScopedTransformOverviewWindow transform_window_;
178 195
(...skipping 29 matching lines...) Expand all
208 225
209 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. 226 // Pointer to the WindowSelector that owns the WindowGrid containing |this|.
210 // Guaranteed to be non-null for the lifetime of |this|. 227 // Guaranteed to be non-null for the lifetime of |this|.
211 WindowSelector* window_selector_; 228 WindowSelector* window_selector_;
212 229
213 // Pointer to a view that covers the original header and has rounded top 230 // 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 231 // 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_|. 232 // which is the only textured layer used by the |item_widget_|.
216 RoundedContainerView* background_view_; 233 RoundedContainerView* background_view_;
217 234
235 // Pointer to the WindowGrid that contains |this|. Guaranteed to be non-null
236 // for the lifetime of |this|.
237 WindowGrid* window_grid_;
238
218 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); 239 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
219 }; 240 };
220 241
221 } // namespace ash 242 } // namespace ash
222 243
223 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 244 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698