Chromium Code Reviews| Index: ash/wm/window_cycle_list.h |
| diff --git a/ash/wm/window_cycle_list.h b/ash/wm/window_cycle_list.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d8b12776979e575135a6309975cf03a1b634a9aa |
| --- /dev/null |
| +++ b/ash/wm/window_cycle_list.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_WM_WINDOW_CYCLE_LIST_H_ |
| +#define ASH_WM_WINDOW_CYCLE_LIST_H_ |
| + |
| +#include <vector> |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/aura/window_observer.h" |
| + |
| +namespace ash { |
| +class ScopedShowWindow; |
| + |
| +// Tracks a set of Windows that can be stepped through. This class is used by |
| +// the WindowCycleController. |
| +class ASH_EXPORT WindowCycleList : public aura::WindowObserver { |
| + public: |
| + typedef std::vector<aura::Window*> WindowList; |
| + |
| + enum Direction { |
| + FORWARD, |
| + BACKWARD |
| + }; |
| + |
| + explicit WindowCycleList(const WindowList& windows); |
| + virtual ~WindowCycleList(); |
| + |
| + bool empty() const { return windows_.empty(); } |
| + |
| + // Cycles to the next or previous window based on |direction|. |
| + void Step(Direction direction); |
| + |
| + const WindowList& windows() const { return windows_; } |
| + |
| + private: |
| + // Returns the index of |window| in |windows_| or -1 if it isn't there. |
| + int GetWindowIndex(aura::Window* window); |
| + |
| + // aura::WindowObserver overrides: |
| + virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
|
tdanderson
2014/05/01 18:51:39
IIUC, a WindowCycleList only exists while Alt+Tab
Nina
2014/05/01 20:41:16
Some factors like JS close method can trigger a wi
tdanderson
2014/05/01 21:58:33
OK, sounds good. Does a similar possibility exist
Nina
2014/05/02 13:27:33
Done. I don't know if it's possible to observe the
|
| + |
| + // List of weak pointers to windows to use while cycling with the keyboard. |
| + // List is built when the user initiates the gesture (e.g. hits alt-tab the |
| + // first time) and is emptied when the gesture is complete (e.g. releases the |
| + // alt key). |
| + WindowList windows_; |
| + |
| + // Current position in the |windows_| list or -1 if we're not cycling. |
|
tdanderson
2014/05/01 18:51:39
Similar comment to the one above: if this object e
Nina
2014/05/02 13:27:33
Done.
|
| + int current_index_; |
| + |
| + // Wrapper for the window brought to the front. |
| + scoped_ptr<ScopedShowWindow> showing_window_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WindowCycleList); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_WM_WINDOW_CYCLE_LIST_H_ |