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

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

Issue 2978273002: Revert of Cros Tablet Window management - Split Screen part II (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « ash/wm/overview/window_grid.cc ('k') | ash/wm/overview/window_selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "ash/ash_export.h" 15 #include "ash/ash_export.h"
16 #include "ash/wm/splitview/split_view_controller.h"
17 #include "base/macros.h" 16 #include "base/macros.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
20 #include "ui/display/display_observer.h" 19 #include "ui/display/display_observer.h"
21 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
22 #include "ui/views/controls/textfield/textfield_controller.h" 21 #include "ui/views/controls/textfield/textfield_controller.h"
23 #include "ui/wm/public/activation_change_observer.h" 22 #include "ui/wm/public/activation_change_observer.h"
24 23
25 namespace gfx {
26 class Point;
27 class Rect;
28 } // namespace gfx
29
30 namespace views { 24 namespace views {
31 class Textfield; 25 class Textfield;
32 class Widget; 26 class Widget;
33 } 27 }
34 28
35 namespace ash { 29 namespace ash {
36 class WindowSelectorDelegate; 30 class WindowSelectorDelegate;
37 class WindowSelectorItem; 31 class WindowSelectorItem;
38 class WindowSelectorTest; 32 class WindowSelectorTest;
39 class WindowGrid; 33 class WindowGrid;
40 class OverviewWindowDragController;
41 34
42 // The WindowSelector shows a grid of all of your windows, allowing to select 35 // The WindowSelector shows a grid of all of your windows, allowing to select
43 // one by clicking or tapping on it. 36 // one by clicking or tapping on it.
44 class ASH_EXPORT WindowSelector : public display::DisplayObserver, 37 class ASH_EXPORT WindowSelector : public display::DisplayObserver,
45 public aura::WindowObserver, 38 public aura::WindowObserver,
46 public ::wm::ActivationChangeObserver, 39 public ::wm::ActivationChangeObserver,
47 public views::TextfieldController, 40 public views::TextfieldController {
48 public SplitViewController::Observer {
49 public: 41 public:
50 // Returns true if the window can be selected in overview mode. 42 // Returns true if the window can be selected in overview mode.
51 static bool IsSelectable(aura::Window* window); 43 static bool IsSelectable(aura::Window* window);
52 44
53 enum Direction { LEFT, UP, RIGHT, DOWN }; 45 enum Direction { LEFT, UP, RIGHT, DOWN };
54 46
55 using WindowList = std::vector<aura::Window*>; 47 using WindowList = std::vector<aura::Window*>;
56 48
57 explicit WindowSelector(WindowSelectorDelegate* delegate); 49 explicit WindowSelector(WindowSelectorDelegate* delegate);
58 ~WindowSelector() override; 50 ~WindowSelector() override;
(...skipping 17 matching lines...) Expand all
76 // Accepts current selection if any. Returns true if a selection was made, 68 // Accepts current selection if any. Returns true if a selection was made,
77 // false otherwise. 69 // false otherwise.
78 bool AcceptSelection(); 70 bool AcceptSelection();
79 71
80 // Activates |item's| window. 72 // Activates |item's| window.
81 void SelectWindow(WindowSelectorItem* item); 73 void SelectWindow(WindowSelectorItem* item);
82 74
83 // Called when |window| is about to get closed. 75 // Called when |window| is about to get closed.
84 void WindowClosing(WindowSelectorItem* window); 76 void WindowClosing(WindowSelectorItem* window);
85 77
86 // Called to set bounds for window grids. Used for split view.
87 void SetBoundsForWindowGridsInScreen(const gfx::Rect& bounds);
88
89 // Removes the window selector item from the overview window grid.
90 void RemoveWindowSelectorItem(WindowSelectorItem* item);
91
92 void InitiateDrag(WindowSelectorItem* item,
93 const gfx::Point& location_in_screen);
94 void Drag(WindowSelectorItem* item, const gfx::Point& location_in_screen);
95 void CompleteDrag(WindowSelectorItem* item);
96
97 // Positions all of the windows in the overview.
98 void PositionWindows(bool animate);
99
100 WindowSelectorDelegate* delegate() { return delegate_; } 78 WindowSelectorDelegate* delegate() { return delegate_; }
101 79
102 bool restoring_minimized_windows() const { 80 bool restoring_minimized_windows() const {
103 return restoring_minimized_windows_; 81 return restoring_minimized_windows_;
104 } 82 }
105 83
106 int text_filter_bottom() const { return text_filter_bottom_; } 84 int text_filter_bottom() const { return text_filter_bottom_; }
107 85
108 bool is_shut_down() const { return is_shut_down_; } 86 bool is_shut_down() const { return is_shut_down_; }
109 87
110 const std::vector<std::unique_ptr<WindowGrid>>& grid_list_for_testing()
111 const {
112 return grid_list_;
113 }
114
115 // display::DisplayObserver: 88 // display::DisplayObserver:
116 void OnDisplayAdded(const display::Display& display) override; 89 void OnDisplayAdded(const display::Display& display) override;
117 void OnDisplayRemoved(const display::Display& display) override; 90 void OnDisplayRemoved(const display::Display& display) override;
118 void OnDisplayMetricsChanged(const display::Display& display, 91 void OnDisplayMetricsChanged(const display::Display& display,
119 uint32_t metrics) override; 92 uint32_t metrics) override;
120 93
121 // aura::WindowObserver: 94 // aura::WindowObserver:
122 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; 95 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override;
123 void OnWindowDestroying(aura::Window* window) override; 96 void OnWindowDestroying(aura::Window* window) override;
124 97
125 // wm::ActivationChangeObserver: 98 // wm::ActivationChangeObserver:
126 void OnWindowActivated(ActivationReason reason, 99 void OnWindowActivated(ActivationReason reason,
127 aura::Window* gained_active, 100 aura::Window* gained_active,
128 aura::Window* lost_active) override; 101 aura::Window* lost_active) override;
129 void OnAttemptToReactivateWindow(aura::Window* request_active, 102 void OnAttemptToReactivateWindow(aura::Window* request_active,
130 aura::Window* actual_active) override; 103 aura::Window* actual_active) override;
131 104
132 // views::TextfieldController: 105 // views::TextfieldController:
133 void ContentsChanged(views::Textfield* sender, 106 void ContentsChanged(views::Textfield* sender,
134 const base::string16& new_contents) override; 107 const base::string16& new_contents) override;
135 bool HandleKeyEvent(views::Textfield* sender, 108 bool HandleKeyEvent(views::Textfield* sender,
136 const ui::KeyEvent& key_event) override; 109 const ui::KeyEvent& key_event) override;
137 110
138 // SplitViewController::Observer:
139 void OnSplitViewStateChanged(SplitViewController::State previous_state,
140 SplitViewController::State state) override;
141
142 private: 111 private:
143 friend class WindowSelectorTest; 112 friend class WindowSelectorTest;
144 113
145 // Returns the aura::Window for |text_filter_widget_|. 114 // Returns the aura::Window for |text_filter_widget_|.
146 aura::Window* GetTextFilterWidgetWindow(); 115 aura::Window* GetTextFilterWidgetWindow();
147 116
117 // Position all of the windows in the overview.
118 void PositionWindows(bool animate);
119
148 // Repositions and resizes |text_filter_widget_| on 120 // Repositions and resizes |text_filter_widget_| on
149 // DisplayMetricsChanged event. 121 // DisplayMetricsChanged event.
150 void RepositionTextFilterOnDisplayMetricsChange(); 122 void RepositionTextFilterOnDisplayMetricsChange();
151 123
152 // |focus|, restores focus to the stored window. 124 // |focus|, restores focus to the stored window.
153 void ResetFocusRestoreWindow(bool focus); 125 void ResetFocusRestoreWindow(bool focus);
154 126
155 // Helper function that moves the selection widget to |direction| on the 127 // Helper function that moves the selection widget to |direction| on the
156 // corresponding window grid. 128 // corresponding window grid.
157 void Move(Direction direction, bool animate); 129 void Move(Direction direction, bool animate);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Tracks whether minimized windows are currently being restored for overview 186 // Tracks whether minimized windows are currently being restored for overview
215 // mode. 187 // mode.
216 bool restoring_minimized_windows_; 188 bool restoring_minimized_windows_;
217 189
218 // The distance between the top edge of the screen and the bottom edge of 190 // The distance between the top edge of the screen and the bottom edge of
219 // the text filtering textfield. 191 // the text filtering textfield.
220 int text_filter_bottom_; 192 int text_filter_bottom_;
221 193
222 bool is_shut_down_ = false; 194 bool is_shut_down_ = false;
223 195
224 // The drag controller for a window in the overview mode.
225 std::unique_ptr<OverviewWindowDragController> window_drag_controller_;
226
227 DISALLOW_COPY_AND_ASSIGN(WindowSelector); 196 DISALLOW_COPY_AND_ASSIGN(WindowSelector);
228 }; 197 };
229 198
230 } // namespace ash 199 } // namespace ash
231 200
232 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ 201 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
OLDNEW
« no previous file with comments | « ash/wm/overview/window_grid.cc ('k') | ash/wm/overview/window_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698