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

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

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Address oshima@'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_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"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "ui/aura/window_observer.h" 19 #include "ui/aura/window_observer.h"
19 #include "ui/display/display_observer.h" 20 #include "ui/display/display_observer.h"
21 #include "ui/gfx/geometry/point.h"
20 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
21 #include "ui/views/controls/textfield/textfield_controller.h" 23 #include "ui/views/controls/textfield/textfield_controller.h"
22 #include "ui/wm/public/activation_change_observer.h" 24 #include "ui/wm/public/activation_change_observer.h"
23 25
24 namespace views { 26 namespace views {
25 class Textfield; 27 class Textfield;
26 class Widget; 28 class Widget;
27 } 29 }
28 30
29 namespace ash { 31 namespace ash {
30 class WindowSelectorDelegate; 32 class WindowSelectorDelegate;
31 class WindowSelectorItem; 33 class WindowSelectorItem;
32 class WindowSelectorTest; 34 class WindowSelectorTest;
33 class WindowGrid; 35 class WindowGrid;
36 class OverviewWindowDragController;
34 37
35 // The WindowSelector shows a grid of all of your windows, allowing to select 38 // The WindowSelector shows a grid of all of your windows, allowing to select
36 // one by clicking or tapping on it. 39 // one by clicking or tapping on it.
37 class ASH_EXPORT WindowSelector : public display::DisplayObserver, 40 class ASH_EXPORT WindowSelector : public display::DisplayObserver,
38 public aura::WindowObserver, 41 public aura::WindowObserver,
39 public ::wm::ActivationChangeObserver, 42 public ::wm::ActivationChangeObserver,
40 public views::TextfieldController { 43 public views::TextfieldController,
44 public SplitViewController::Observer {
41 public: 45 public:
42 // Returns true if the window can be selected in overview mode. 46 // Returns true if the window can be selected in overview mode.
43 static bool IsSelectable(aura::Window* window); 47 static bool IsSelectable(aura::Window* window);
44 48
45 enum Direction { LEFT, UP, RIGHT, DOWN }; 49 enum Direction { LEFT, UP, RIGHT, DOWN };
46 50
47 using WindowList = std::vector<aura::Window*>; 51 using WindowList = std::vector<aura::Window*>;
48 52
49 explicit WindowSelector(WindowSelectorDelegate* delegate); 53 explicit WindowSelector(WindowSelectorDelegate* delegate);
50 ~WindowSelector() override; 54 ~WindowSelector() override;
(...skipping 17 matching lines...) Expand all
68 // Accepts current selection if any. Returns true if a selection was made, 72 // Accepts current selection if any. Returns true if a selection was made,
69 // false otherwise. 73 // false otherwise.
70 bool AcceptSelection(); 74 bool AcceptSelection();
71 75
72 // Activates |item's| window. 76 // Activates |item's| window.
73 void SelectWindow(WindowSelectorItem* item); 77 void SelectWindow(WindowSelectorItem* item);
74 78
75 // Called when |window| is about to get closed. 79 // Called when |window| is about to get closed.
76 void WindowClosing(WindowSelectorItem* window); 80 void WindowClosing(WindowSelectorItem* window);
77 81
82 // Called to set bounds for window grids. Used for split view.
83 void SetBoundsForWindowGridsInScreen(const gfx::Rect bounds);
84
85 // Removes the window selector item from the overview window grid.
86 void RemoveWindowSelectorItem(WindowSelectorItem* item);
87
88 void InitiateDrag(WindowSelectorItem* item,
89 const gfx::Point& location_in_screen);
90 void Drag(WindowSelectorItem* item, const gfx::Point& location_in_screen);
91 void CompleteDrag(WindowSelectorItem* item);
92
78 WindowSelectorDelegate* delegate() { return delegate_; } 93 WindowSelectorDelegate* delegate() { return delegate_; }
79 94
80 bool restoring_minimized_windows() const { 95 bool restoring_minimized_windows() const {
81 return restoring_minimized_windows_; 96 return restoring_minimized_windows_;
82 } 97 }
83 98
84 int text_filter_bottom() const { return text_filter_bottom_; } 99 int text_filter_bottom() const { return text_filter_bottom_; }
85 100
86 bool is_shut_down() const { return is_shut_down_; } 101 bool is_shut_down() const { return is_shut_down_; }
87 102
(...skipping 13 matching lines...) Expand all
101 aura::Window* lost_active) override; 116 aura::Window* lost_active) override;
102 void OnAttemptToReactivateWindow(aura::Window* request_active, 117 void OnAttemptToReactivateWindow(aura::Window* request_active,
103 aura::Window* actual_active) override; 118 aura::Window* actual_active) override;
104 119
105 // views::TextfieldController: 120 // views::TextfieldController:
106 void ContentsChanged(views::Textfield* sender, 121 void ContentsChanged(views::Textfield* sender,
107 const base::string16& new_contents) override; 122 const base::string16& new_contents) override;
108 bool HandleKeyEvent(views::Textfield* sender, 123 bool HandleKeyEvent(views::Textfield* sender,
109 const ui::KeyEvent& key_event) override; 124 const ui::KeyEvent& key_event) override;
110 125
126 // SplitViewController::Observer:
127 void OnSplitViewStateChanged(SplitViewController::State previous_state,
128 SplitViewController::State state) override;
129
130 // Position all of the windows in the overview.
varkha 2017/06/21 01:51:53 nit: Position -> Positions
xdai1 2017/06/22 21:46:34 Done.
131 void PositionWindows(bool animate);
132
111 private: 133 private:
112 friend class WindowSelectorTest; 134 friend class WindowSelectorTest;
113 135
114 // Returns the aura::Window for |text_filter_widget_|. 136 // Returns the aura::Window for |text_filter_widget_|.
115 aura::Window* GetTextFilterWidgetWindow(); 137 aura::Window* GetTextFilterWidgetWindow();
116 138
117 // Position all of the windows in the overview.
118 void PositionWindows(bool animate);
119
120 // Repositions and resizes |text_filter_widget_| on 139 // Repositions and resizes |text_filter_widget_| on
121 // DisplayMetricsChanged event. 140 // DisplayMetricsChanged event.
122 void RepositionTextFilterOnDisplayMetricsChange(); 141 void RepositionTextFilterOnDisplayMetricsChange();
123 142
124 // |focus|, restores focus to the stored window. 143 // |focus|, restores focus to the stored window.
125 void ResetFocusRestoreWindow(bool focus); 144 void ResetFocusRestoreWindow(bool focus);
126 145
127 // Helper function that moves the selection widget to |direction| on the 146 // Helper function that moves the selection widget to |direction| on the
128 // corresponding window grid. 147 // corresponding window grid.
129 void Move(Direction direction, bool animate); 148 void Move(Direction direction, bool animate);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Tracks whether minimized windows are currently being restored for overview 205 // Tracks whether minimized windows are currently being restored for overview
187 // mode. 206 // mode.
188 bool restoring_minimized_windows_; 207 bool restoring_minimized_windows_;
189 208
190 // The distance between the top edge of the screen and the bottom edge of 209 // The distance between the top edge of the screen and the bottom edge of
191 // the text filtering textfield. 210 // the text filtering textfield.
192 int text_filter_bottom_; 211 int text_filter_bottom_;
193 212
194 bool is_shut_down_ = false; 213 bool is_shut_down_ = false;
195 214
215 // The drag controller for a window in the overview mode.
216 std::unique_ptr<OverviewWindowDragController> window_drag_controller_;
217
196 DISALLOW_COPY_AND_ASSIGN(WindowSelector); 218 DISALLOW_COPY_AND_ASSIGN(WindowSelector);
197 }; 219 };
198 220
199 } // namespace ash 221 } // namespace ash
200 222
201 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_ 223 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698