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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.cc ('k') | ash/wm/overview/window_overview.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_OVERVIEW_H_ 5 #ifndef ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_
6 #define ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_ 6 #define ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/aura/window_tracker.h" 12 #include "ui/aura/window_tracker.h"
13 #include "ui/events/event_handler.h" 13 #include "ui/events/event_handler.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 15
16 namespace aura { 16 namespace aura {
17
18 class Window; 17 class Window;
19 class RootWindow;
20
21 namespace client { 18 namespace client {
22 class CursorClient; 19 class CursorClient;
23 } 20 }
24
25 } // namespace aura 21 } // namespace aura
26 22
27 namespace ui { 23 namespace ui {
28 class LocatedEvent; 24 class LocatedEvent;
29 } 25 }
30 26
31 namespace views { 27 namespace views {
32 class Widget; 28 class Widget;
33 } 29 }
34 30
35 namespace ash { 31 namespace ash {
36 32
37 class WindowSelector; 33 class WindowSelector;
38 class WindowSelectorItem; 34 class WindowSelectorItem;
39 35
40 // The WindowOverview shows a grid of all of your windows and allows selecting 36 // The WindowOverview shows a grid of all of your windows and allows selecting
41 // a window by clicking or tapping on it. It also displays a selection widget 37 // a window by clicking or tapping on it. It also displays a selection widget
42 // used to indicate the current selection when alt-tabbing between windows. 38 // used to indicate the current selection when alt-tabbing between windows.
43 class WindowOverview : public ui::EventHandler { 39 class WindowOverview : public ui::EventHandler {
44 public: 40 public:
45 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList; 41 typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList;
46 42
47 // Enters an overview mode displaying |windows| and dispatches methods 43 // Enters an overview mode displaying |windows| and dispatches methods
48 // on |window_selector| when a window is selected or selection is canceled. 44 // on |window_selector| when a window is selected or selection is canceled.
49 // If |single_root_window| is not NULL, all windows will be positioned on the 45 // If |single_root_window| is not NULL, all windows will be positioned on the
50 // given root window. 46 // given root window.
51 WindowOverview(WindowSelector* window_selector, 47 WindowOverview(WindowSelector* window_selector,
52 WindowSelectorItemList* windows, 48 WindowSelectorItemList* windows,
53 aura::RootWindow* single_root_window); 49 aura::Window* single_root_window);
54 virtual ~WindowOverview(); 50 virtual ~WindowOverview();
55 51
56 // Sets the selected window to be the window in position |index|. 52 // Sets the selected window to be the window in position |index|.
57 void SetSelection(size_t index); 53 void SetSelection(size_t index);
58 54
59 // Dispatched when the list of windows has changed. 55 // Dispatched when the list of windows has changed.
60 void OnWindowsChanged(); 56 void OnWindowsChanged();
61 57
62 // Moves the overview to only |root_window|. 58 // Moves the overview to only |root_window|.
63 void MoveToSingleRootWindow(aura::RootWindow* root_window); 59 void MoveToSingleRootWindow(aura::Window* root_window);
64 60
65 // ui::EventHandler: 61 // ui::EventHandler:
66 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; 62 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
67 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 63 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
68 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 64 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
69 65
70 private: 66 private:
71 // Returns the target of |event| or NULL if the event is not targeted at 67 // Returns the target of |event| or NULL if the event is not targeted at
72 // any of the windows in the selector. 68 // any of the windows in the selector.
73 aura::Window* GetEventTarget(ui::LocatedEvent* event); 69 aura::Window* GetEventTarget(ui::LocatedEvent* event);
74 70
75 // Returns the top-level window selected by targeting |window| or NULL if 71 // Returns the top-level window selected by targeting |window| or NULL if
76 // no overview window was found for |window|. 72 // no overview window was found for |window|.
77 aura::Window* GetTargetedWindow(aura::Window* window); 73 aura::Window* GetTargetedWindow(aura::Window* window);
78 74
79 // Hide and track all hidden windows not in overview. 75 // Hide and track all hidden windows not in overview.
80 void HideAndTrackNonOverviewWindows(); 76 void HideAndTrackNonOverviewWindows();
81 77
82 // Position all of the windows based on the current selection mode. 78 // Position all of the windows based on the current selection mode.
83 void PositionWindows(); 79 void PositionWindows();
84 // Position all of the windows from |root_window| on |root_window|. 80 // Position all of the windows from |root_window| on |root_window|.
85 void PositionWindowsFromRoot(aura::RootWindow* root_window); 81 void PositionWindowsFromRoot(aura::Window* root_window);
86 // Position all of the |windows| to fit on the |root_window|. 82 // Position all of the |windows| to fit on the |root_window|.
87 void PositionWindowsOnRoot(aura::RootWindow* root_window, 83 void PositionWindowsOnRoot(aura::Window* root_window,
88 const std::vector<WindowSelectorItem*>& windows); 84 const std::vector<WindowSelectorItem*>& windows);
89 85
90 // Creates the selection widget. 86 // Creates the selection widget.
91 void InitializeSelectionWidget(); 87 void InitializeSelectionWidget();
92 88
93 // Returns the bounds for the selection widget for the windows_ at |index|. 89 // Returns the bounds for the selection widget for the windows_ at |index|.
94 gfx::Rect GetSelectionBounds(size_t index); 90 gfx::Rect GetSelectionBounds(size_t index);
95 91
96 // Weak pointer to the window selector which owns this class. 92 // Weak pointer to the window selector which owns this class.
97 WindowSelector* window_selector_; 93 WindowSelector* window_selector_;
98 94
99 // A weak pointer to the collection of windows in the overview wrapped by a 95 // A weak pointer to the collection of windows in the overview wrapped by a
100 // helper class which restores their state and helps transform them to other 96 // helper class which restores their state and helps transform them to other
101 // root windows. 97 // root windows.
102 WindowSelectorItemList* windows_; 98 WindowSelectorItemList* windows_;
103 99
104 // Widget indicating which window is currently selected. 100 // Widget indicating which window is currently selected.
105 scoped_ptr<views::Widget> selection_widget_; 101 scoped_ptr<views::Widget> selection_widget_;
106 102
107 // Index of the currently selected window. This is used to determine when the 103 // Index of the currently selected window. This is used to determine when the
108 // selection changes rows and use a different animation. 104 // selection changes rows and use a different animation.
109 size_t selection_index_; 105 size_t selection_index_;
110 106
111 // If NULL, each root window displays an overview of the windows in that 107 // If NULL, each root window displays an overview of the windows in that
112 // display. Otherwise, all windows are in a single overview on 108 // display. Otherwise, all windows are in a single overview on
113 // |single_root_window_|. 109 // |single_root_window_|.
114 aura::RootWindow* single_root_window_; 110 aura::Window* single_root_window_;
115 111
116 // The time when overview was started. 112 // The time when overview was started.
117 base::Time overview_start_time_; 113 base::Time overview_start_time_;
118 114
119 // The cursor client used to lock the current cursor during overview. 115 // The cursor client used to lock the current cursor during overview.
120 aura::client::CursorClient* cursor_client_; 116 aura::client::CursorClient* cursor_client_;
121 117
122 // Tracks windows which were hidden because they were not part of the 118 // Tracks windows which were hidden because they were not part of the
123 // overview. 119 // overview.
124 aura::WindowTracker hidden_windows_; 120 aura::WindowTracker hidden_windows_;
125 121
126 DISALLOW_COPY_AND_ASSIGN(WindowOverview); 122 DISALLOW_COPY_AND_ASSIGN(WindowOverview);
127 }; 123 };
128 124
129 } // namespace ash 125 } // namespace ash
130 126
131 #endif // ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_ 127 #endif // ASH_WM_OVERVIEW_WINDOW_OVERVIEW_H_
OLDNEW
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.cc ('k') | ash/wm/overview/window_overview.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698