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

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: Removed ET_SCROLL_FLING_CANCEL handling from TransparentButton and removed WindowSelector.MultiWind… Created 5 years, 11 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 "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" 10 #include "ash/wm/overview/transparent_activate_window_button.h"
11 #include "ash/wm/overview/transparent_activate_window_button_delegate.h" 11 #include "ash/wm/overview/transparent_activate_window_button_delegate.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
15 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/button/image_button.h" 17 #include "ui/views/controls/button/image_button.h"
18 18
19 namespace aura { 19 namespace aura {
20 class Window; 20 class Window;
21 } 21 } // namespace aura
22 22
23 namespace views { 23 namespace views {
24 class Label; 24 class Label;
25 class Widget; 25 class Widget;
26 } 26 } // namespace views
27 27
28 namespace ash { 28 namespace ash {
29 29
30 // This class represents an item in overview mode. An item can have one or more 30 // This class represents an item in overview mode. An item can have one or more
31 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but 31 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but
32 // any can be selected with a pointer (touch or mouse). 32 // any can be selected with a pointer (touch or mouse).
33 class ASH_EXPORT WindowSelectorItem 33 class ASH_EXPORT WindowSelectorItem
34 : public views::ButtonListener, 34 : public views::ButtonListener,
35 public aura::WindowObserver, 35 public aura::WindowObserver,
36 public TransparentActivateWindowButtonDelegate { 36 public TransparentActivateWindowButtonDelegate {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 const gfx::Rect& target_bounds() const { return target_bounds_; } 96 const gfx::Rect& target_bounds() const { return target_bounds_; }
97 97
98 // views::ButtonListener: 98 // views::ButtonListener:
99 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 99 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
100 100
101 // aura::WindowObserver: 101 // aura::WindowObserver:
102 void OnWindowTitleChanged(aura::Window* window) override; 102 void OnWindowTitleChanged(aura::Window* window) override;
103 103
104 // ash::TransparentActivateWindowButtonDelegate: 104 // ash::TransparentActivateWindowButtonDelegate:
105 void Scroll(int delta_x) override;
106 void CancelScroll() override;
105 void Select() override; 107 void Select() override;
108 void Close() override;
106 109
107 private: 110 private:
108 friend class WindowSelectorTest; 111 friend class WindowSelectorTest;
109 112
110 typedef ScopedVector<ScopedTransformOverviewWindow> TransformWindows; 113 typedef ScopedVector<ScopedTransformOverviewWindow> TransformWindows;
111 114
112 // Sets the bounds of this selector's items to |target_bounds| in 115 // Sets the bounds of this selector's items to |target_bounds| in
113 // |root_window|. The bounds change will be animated as specified 116 // |root_window|. The bounds change will be animated as specified
114 // by |animation_type|. 117 // by |animation_type|.
115 void SetItemBounds(aura::Window* root_window, 118 void SetItemBounds(aura::Window* root_window,
116 const gfx::Rect& target_bounds, 119 const gfx::Rect& target_bounds,
117 OverviewAnimationType animation_type); 120 OverviewAnimationType animation_type);
118 121
119 // Changes the opacity of all the windows the item owns. 122 // Changes the opacity of all the windows the item owns.
120 void SetOpacity(float opacity); 123 void SetOpacity(float opacity);
121 124
122 // Updates the window label's bounds to |target_bounds|. Will create a new 125 // Updates the window label's bounds to |target_bounds|. Will create a new
123 // window label and fade it in if it doesn't exist. The bounds change is 126 // window label and fade it in if it doesn't exist. The bounds change is
124 // animated as specified by the |animation_type|. 127 // animated as specified by the |animation_type|.
125 void UpdateWindowLabels(const gfx::Rect& target_bounds, 128 void UpdateWindowLabels(const gfx::Rect& target_bounds,
126 OverviewAnimationType animation_type); 129 OverviewAnimationType animation_type);
127 130
128 // Initializes window_label_. 131 // Initializes window_label_.
129 void CreateWindowLabel(const base::string16& title); 132 void CreateWindowLabel(const base::string16& title);
130 133
134 // Set the minimum distance, in pixels, for which a scroll gesture will cause
135 // a window to be closed when the scroll distance exceeds |distance|.
136 void SetCloseWindowDistanceMinimum(int distance);
137
131 // Updates the bounds and accessibility names for all the transparent 138 // Updates the bounds and accessibility names for all the transparent
132 // overlays. 139 // overlays.
133 void UpdateSelectorButtons(); 140 void UpdateSelectorButtons();
134 141
135 // Updates the close button's bounds. Any change in bounds will be animated 142 // Updates the close button's bounds. Any change in bounds will be animated
136 // from the current bounds to the new bounds as per the |animation_type|. 143 // from the current bounds to the new bounds as per the |animation_type|.
137 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); 144 void UpdateCloseButtonLayout(OverviewAnimationType animation_type);
138 145
139 // Updates the close buttons accessibility name. 146 // Updates the close buttons accessibility name.
140 void UpdateCloseButtonAccessibilityName(); 147 void UpdateCloseButtonAccessibilityName();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 185
179 // List of all Windows added to this and their associated helper classes. 186 // List of all Windows added to this and their associated helper classes.
180 TransformWindows transform_windows_; 187 TransformWindows transform_windows_;
181 188
182 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); 189 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
183 }; 190 };
184 191
185 } // namespace ash 192 } // namespace ash
186 193
187 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 194 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698