| Index: athena/wm/window_overview_mode.cc
|
| diff --git a/athena/wm/window_overview_mode.cc b/athena/wm/window_overview_mode.cc
|
| index b37339e3cf7cca7b76aad83cc3e4ae66a5508c24..076a335b00e8bade06a0eaf879fded93dcdfe5c5 100644
|
| --- a/athena/wm/window_overview_mode.cc
|
| +++ b/athena/wm/window_overview_mode.cc
|
| @@ -92,8 +92,10 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| public ui::EventHandler {
|
| public:
|
| WindowOverviewModeImpl(aura::Window* container,
|
| + aura::Window::Windows windows,
|
| WindowOverviewModeDelegate* delegate)
|
| : container_(container),
|
| + windows_(windows),
|
| delegate_(delegate),
|
| scoped_targeter_(new aura::ScopedWindowTargeter(
|
| container,
|
| @@ -110,10 +112,9 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| virtual ~WindowOverviewModeImpl() {
|
| container_->set_target_handler(container_->delegate());
|
|
|
| - aura::Window::Windows windows = container_->children();
|
| - if (windows.empty())
|
| + if (windows_.empty())
|
| return;
|
| - std::for_each(windows.begin(), windows.end(), &RestoreWindowState);
|
| + std::for_each(windows_.begin(), windows_.end(), &RestoreWindowState);
|
| }
|
|
|
| private:
|
| @@ -121,8 +122,7 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| // positions. The transforms are set in the |kWindowOverviewState| property of
|
| // the windows.
|
| void ComputeTerminalStatesForAllWindows() {
|
| - aura::Window::Windows windows = container_->children();
|
| - size_t window_count = windows.size();
|
| + size_t window_count = windows_.size();
|
| size_t index = 0;
|
| const gfx::Size container_size = container_->bounds().size();
|
|
|
| @@ -131,8 +131,8 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| const float kMinScale = 0.6f;
|
| const float kMaxScale = 0.95f;
|
|
|
| - for (aura::Window::Windows::reverse_iterator iter = windows.rbegin();
|
| - iter != windows.rend();
|
| + for (aura::Window::Windows::reverse_iterator iter = windows_.rbegin();
|
| + iter != windows_.rend();
|
| ++iter, ++index) {
|
| aura::Window* window = (*iter);
|
|
|
| @@ -159,13 +159,12 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
|
|
| // Sets the initial position for the windows for the overview mode.
|
| void SetInitialWindowStates() {
|
| - aura::Window::Windows windows = container_->children();
|
| - size_t window_count = windows.size();
|
| + size_t window_count = windows_.size();
|
| // The initial overview state of the topmost three windows.
|
| const float kInitialProgress[] = { 0.5f, 0.05f, 0.01f };
|
| for (size_t i = 0; i < window_count; ++i) {
|
| float progress = 0.f;
|
| - aura::Window* window = windows[window_count - 1 - i];
|
| + aura::Window* window = windows_[window_count - 1 - i];
|
| if (i < arraysize(kInitialProgress))
|
| progress = kInitialProgress[i];
|
|
|
| @@ -194,7 +193,7 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| scoped_ptr<wm::Shadow> CreateShadowForWindow(aura::Window* window) {
|
| scoped_ptr<wm::Shadow> shadow(new wm::Shadow());
|
| shadow->Init(wm::Shadow::STYLE_ACTIVE);
|
| - shadow->SetContentBounds(gfx::Rect(window->bounds().size()));
|
| + shadow->SetContentBounds(gfx::Rect(container_->bounds().size()));
|
| shadow->layer()->SetVisible(true);
|
| window->layer()->Add(shadow->layer());
|
| return shadow.Pass();
|
| @@ -222,13 +221,12 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| // scrolling up; and positive when scrolling down.
|
| void DoScroll(float delta_y) {
|
| const float kEpsilon = 1e-3f;
|
| - aura::Window::Windows windows = container_->children();
|
| float delta_y_p = std::abs(delta_y) / GetScrollableHeight();
|
| if (delta_y < 0) {
|
| // Scroll up. Start with the top-most (i.e. behind-most in terms of
|
| // z-index) window, and try to scroll them up.
|
| - for (aura::Window::Windows::iterator iter = windows.begin();
|
| - delta_y_p > kEpsilon && iter != windows.end();
|
| + for (aura::Window::Windows::iterator iter = windows_.begin();
|
| + delta_y_p > kEpsilon && iter != windows_.end();
|
| ++iter) {
|
| aura::Window* window = (*iter);
|
| WindowOverviewState* state = window->GetProperty(kWindowOverviewState);
|
| @@ -243,8 +241,8 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| } else {
|
| // Scroll down. Start with the bottom-most (i.e. front-most in terms of
|
| // z-index) window, and try to scroll them down.
|
| - for (aura::Window::Windows::reverse_iterator iter = windows.rbegin();
|
| - delta_y_p > kEpsilon && iter != windows.rend();
|
| + for (aura::Window::Windows::reverse_iterator iter = windows_.rbegin();
|
| + delta_y_p > kEpsilon && iter != windows_.rend();
|
| ++iter) {
|
| aura::Window* window = (*iter);
|
| WindowOverviewState* state = window->GetProperty(kWindowOverviewState);
|
| @@ -294,6 +292,9 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| }
|
|
|
| aura::Window* container_;
|
| + // The stack of windows to show in the overview mode
|
| + // TODO (mfomitchev): Should this be const?
|
| + /*const*/ aura::Window::Windows windows_;
|
| WindowOverviewModeDelegate* delegate_;
|
| scoped_ptr<aura::ScopedWindowTargeter> scoped_targeter_;
|
|
|
| @@ -305,9 +306,10 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
|
| // static
|
| scoped_ptr<WindowOverviewMode> WindowOverviewMode::Create(
|
| aura::Window* container,
|
| + aura::Window::Windows windows,
|
| WindowOverviewModeDelegate* delegate) {
|
| return scoped_ptr<WindowOverviewMode>(
|
| - new WindowOverviewModeImpl(container, delegate));
|
| + new WindowOverviewModeImpl(container, windows, delegate));
|
| }
|
|
|
| } // namespace athena
|
|
|