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

Unified Diff: ash/wm/overview/window_selector.h

Issue 280423008: Merge WindowOverview into WindowSelector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworded comment Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/overview/window_selector.h
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h
index bb4757c18f5537bca4b0cb371e937e9c290a67be..f135f1ea5ef6bb9521ee27775f2a2867659b3d9a 100644
--- a/ash/wm/overview/window_selector.h
+++ b/ash/wm/overview/window_selector.h
@@ -14,25 +14,43 @@
#include "base/memory/scoped_vector.h"
#include "base/time/time.h"
#include "ui/aura/window_observer.h"
+#include "ui/aura/window_tracker.h"
+#include "ui/events/event_handler.h"
+#include "ui/gfx/display_observer.h"
+#include "ui/gfx/rect.h"
#include "ui/wm/public/activation_change_observer.h"
namespace aura {
class RootWindow;
+class Window;
+namespace client {
+class CursorClient;
+}
+}
flackr 2014/05/14 20:59:32 nit: For nested namespaces it might be easier to r
Nina 2014/05/15 12:32:04 Done.
+
+namespace ui {
+class LocatedEvent;
+}
+
+namespace views {
+class Widget;
}
namespace ash {
-class WindowOverview;
class WindowSelectorDelegate;
class WindowSelectorItem;
class WindowSelectorTest;
-// The WindowSelector allows selecting a window by clicking or tapping on it
-// (entering Overview Mode).
+// The WindowSelector shows a grid of all of your windows, allowing to select
+// one by clicking or tapping on it.
class ASH_EXPORT WindowSelector
- : public aura::WindowObserver,
+ : public ui::EventHandler,
+ public gfx::DisplayObserver,
+ public aura::WindowObserver,
public aura::client::ActivationChangeObserver {
public:
typedef std::vector<aura::Window*> WindowList;
+ typedef ScopedVector<WindowSelectorItem> WindowSelectorItemList;
WindowSelector(const WindowList& windows,
WindowSelectorDelegate* delegate);
@@ -44,6 +62,16 @@ class ASH_EXPORT WindowSelector
// Cancels window selection.
void CancelSelection();
+ // ui::EventHandler:
+ virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
+ virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+
+ // gfx::DisplayObserver:
+ virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
+ virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE;
+ virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE;
flackr 2014/05/14 20:59:32 nit: blank line before // aura::WindowObserver:
Nina 2014/05/15 12:32:04 Done.
// aura::WindowObserver:
virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
virtual void OnWindowBoundsChanged(aura::Window* window,
@@ -64,10 +92,26 @@ class ASH_EXPORT WindowSelector
// Begins positioning windows such that all windows are visible on the screen.
void StartOverview();
+ // Position all of the windows based on the current selection mode.
+ void PositionWindows(bool animate);
+ // Position all of the windows from |root_window| on |root_window|.
+ void PositionWindowsFromRoot(aura::Window* root_window, bool animate);
+
// Resets the stored window from RemoveFocusAndSetRestoreWindow to NULL. If
+ // Hide and track all hidden windows not in overview.
+ void HideAndTrackNonOverviewWindows();
+
// |focus|, restores focus to the stored window.
void ResetFocusRestoreWindow(bool focus);
+ // Returns the target of |event| or NULL if the event is not targeted at
+ // any of the windows in the selector.
+ aura::Window* GetEventTarget(ui::LocatedEvent* event);
+
+ // Returns the top-level window selected by targeting |window| or NULL if
+ // no overview window was found for |window|.
+ aura::Window* GetTargetedWindow(aura::Window* window);
+
// The collection of items in the overview wrapped by a helper class which
// restores their state and helps transform them to other root windows.
ScopedVector<WindowSelectorItem> windows_;
@@ -75,8 +119,6 @@ class ASH_EXPORT WindowSelector
// Tracks observed windows.
std::set<aura::Window*> observed_windows_;
- scoped_ptr<WindowOverview> window_overview_;
-
// Weak pointer to the selector delegate which will be called when a
// selection is made.
WindowSelectorDelegate* delegate_;
@@ -90,6 +132,23 @@ class ASH_EXPORT WindowSelector
// used to prevent handling the resulting expected activation.
bool ignore_activations_;
+ // The cursor client used to lock the current cursor during overview.
+ aura::client::CursorClient* cursor_client_;
+
+ // Widget indicating which window is currently selected.
+ scoped_ptr<views::Widget> selection_widget_;
+
+ // Index of the currently selected window. This is used to determine when the
+ // selection changes rows and use a different animation.
+ size_t selection_index_;
+
+ // The time when overview was started.
+ base::Time overview_start_time_;
+
+ // Tracks windows which were hidden because they were not part of the
+ // overview.
+ aura::WindowTracker hidden_windows_;
+
DISALLOW_COPY_AND_ASSIGN(WindowSelector);
};

Powered by Google App Engine
This is Rietveld 408576698