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

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

Issue 690103008: Implemented swipe to close in overview mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "ash/wm/overview/scoped_transform_overview_window.h" 8 #include "ash/wm/overview/scoped_transform_overview_window.h"
9 #include "ash/wm/overview/transparent_activate_window_button.h" 9 #include "ash/wm/overview/transparent_activate_window_button.h"
10 #include "ash/wm/overview/transparent_activate_window_button_delegate.h" 10 #include "ash/wm/overview/transparent_activate_window_button_delegate.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const gfx::Rect& target_bounds() const { return target_bounds_; } 92 const gfx::Rect& target_bounds() const { return target_bounds_; }
93 93
94 // views::ButtonListener: 94 // views::ButtonListener:
95 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 95 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
96 96
97 // aura::WindowObserver: 97 // aura::WindowObserver:
98 virtual void OnWindowTitleChanged(aura::Window* window) override; 98 virtual void OnWindowTitleChanged(aura::Window* window) override;
99 virtual void OnWindowTransformed(aura::Window* window) override; 99 virtual void OnWindowTransformed(aura::Window* window) override;
100 100
101 // ash::TransparentActivateWindowButtonDelegate: 101 // ash::TransparentActivateWindowButtonDelegate:
102 virtual void Scroll(int delta_x) override;
103 virtual void CancelScroll() override;
102 virtual void Select() override; 104 virtual void Select() override;
105 virtual void Close() override;
jonross 2014/11/12 23:57:03 nit: remove virtual from all of the overrides.
bruthig 2015/01/02 16:49:17 Done.
103 106
104 protected: 107 protected:
105 // Sets the bounds of this selector's items to |target_bounds| in 108 // Sets the bounds of this selector's items to |target_bounds| in
106 // |root_window|. If |animate| the windows are animated from their current 109 // |root_window|. If |animate| the windows are animated from their current
107 // location. 110 // location.
108 virtual void SetItemBounds(aura::Window* root_window, 111 virtual void SetItemBounds(aura::Window* root_window,
109 const gfx::Rect& target_bounds, 112 const gfx::Rect& target_bounds,
110 bool animate); 113 bool animate);
111 114
112 // Sets the bounds used by the selector item's windows. 115 // Sets the bounds used by the selector item's windows.
(...skipping 18 matching lines...) Expand all
131 virtual ~WindowListItem(); 134 virtual ~WindowListItem();
132 135
133 TransparentActivateWindowButton* activate_button() { 136 TransparentActivateWindowButton* activate_button() {
134 return activate_button_.get(); 137 return activate_button_.get();
135 } 138 }
136 139
137 ScopedTransformOverviewWindow* transform_window() { 140 ScopedTransformOverviewWindow* transform_window() {
138 return transform_window_.get(); 141 return transform_window_.get();
139 } 142 }
140 143
141 // Closes the window managed by |this|.
142 void Close();
143
144 // ash::TransparentActivateWindowButtonDelegate: 144 // ash::TransparentActivateWindowButtonDelegate:
145 virtual void Scroll(int delta_x) override;
146 virtual void CancelScroll() override;
145 virtual void Select() override; 147 virtual void Select() override;
148 virtual void Close() override;
146 149
147 private: 150 private:
148 // The transparent overlay that captures events. 151 // The transparent overlay that captures events.
149 scoped_ptr<TransparentActivateWindowButton> activate_button_; 152 scoped_ptr<TransparentActivateWindowButton> activate_button_;
150 153
151 // A window wrapper that assists with window manipulations, (ie 154 // A window wrapper that assists with window manipulations, (ie
152 // transformations). 155 // transformations).
153 scoped_ptr<ScopedTransformOverviewWindow> transform_window_; 156 scoped_ptr<ScopedTransformOverviewWindow> transform_window_;
154 }; 157 };
155 158
156 typedef ScopedVector<WindowListItem> WindowList; 159 typedef ScopedVector<WindowListItem> WindowList;
157 160
158 // Creates a label to display under the window selector item. 161 // Creates a label to display under the window selector item.
159 void UpdateWindowLabels(const gfx::Rect& target_bounds, 162 void UpdateWindowLabels(const gfx::Rect& target_bounds,
160 aura::Window* root_window, 163 aura::Window* root_window,
161 bool animate); 164 bool animate);
162 165
163 // Initializes window_label_. 166 // Initializes window_label_.
164 void CreateWindowLabel(const base::string16& title); 167 void CreateWindowLabel(const base::string16& title);
165 168
169 // Set the minimum distance, in pixels, for which a scroll gesture will cause
170 // a window to be closed when the scroll distance exceeds |distance|.
171 void SetCloseWindowDistanceMinimum(int distance);
172
166 // Updates the selector button overlay's bounds and accessibility names. 173 // Updates the selector button overlay's bounds and accessibility names.
167 void UpdateSelectorButtons(); 174 void UpdateSelectorButtons();
168 175
169 // Updates the close button's bounds. If |animate| is true then the close 176 // Updates the close button's bounds. If |animate| is true then the close
170 // button is animated from its current location. 177 // button is animated from its current location.
171 void UpdateCloseButtonLayout(bool animate); 178 void UpdateCloseButtonLayout(bool animate);
172 179
173 // Updates the close button's bounds. 180 // Updates the close button's bounds.
174 void UpdateCloseButtonBounds(); 181 void UpdateCloseButtonBounds();
175 182
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 218
212 // List of all Windows added to this and their associated helper classes. 219 // List of all Windows added to this and their associated helper classes.
213 WindowList window_list_; 220 WindowList window_list_;
214 221
215 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); 222 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
216 }; 223 };
217 224
218 } // namespace ash 225 } // namespace ash
219 226
220 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 227 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698