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..95fa51889a33331e5cd2c4bdb667bc44e70b36cb 100644 |
--- a/athena/wm/window_overview_mode.cc |
+++ b/athena/wm/window_overview_mode.cc |
@@ -10,7 +10,6 @@ |
#include "base/macros.h" |
#include "ui/aura/scoped_window_targeter.h" |
-#include "ui/aura/window.h" |
#include "ui/aura/window_delegate.h" |
#include "ui/aura/window_property.h" |
#include "ui/aura/window_targeter.h" |
@@ -92,6 +91,7 @@ class WindowOverviewModeImpl : public WindowOverviewMode, |
public ui::EventHandler { |
public: |
WindowOverviewModeImpl(aura::Window* container, |
+ const aura::Window::Windows& windows, |
WindowOverviewModeDelegate* delegate) |
: container_(container), |
delegate_(delegate), |
@@ -99,6 +99,12 @@ class WindowOverviewModeImpl : public WindowOverviewMode, |
container, |
scoped_ptr<ui::EventTargeter>( |
new StaticWindowTargeter(container)))) { |
+ for (aura::Window::Windows::const_iterator iter = windows.begin(); |
+ iter != windows.end(); iter++) { |
+ if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL) |
+ windows_.push_back(*iter); |
+ } |
oshima
2014/08/01 16:09:38
you shouldn't need window_. what you're passing is
sadrul
2014/08/01 16:15:46
The filtering here is done to avoid showing popup
oshima
2014/08/01 20:04:10
you can filter the child of container. No need to
sadrul
2014/08/01 20:05:41
This is in preparation for Mikhail's patch, where
mohsen
2014/08/01 20:22:35
I changed it such that the window list is not pass
|
+ |
container_->set_target_handler(this); |
// Prepare the desired transforms for all the windows, and set the initial |
@@ -110,10 +116,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 +126,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 +135,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 +163,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]; |
@@ -222,13 +225,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 +245,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 +296,7 @@ class WindowOverviewModeImpl : public WindowOverviewMode, |
} |
aura::Window* container_; |
+ aura::Window::Windows windows_; |
WindowOverviewModeDelegate* delegate_; |
scoped_ptr<aura::ScopedWindowTargeter> scoped_targeter_; |
@@ -305,9 +308,10 @@ class WindowOverviewModeImpl : public WindowOverviewMode, |
// static |
scoped_ptr<WindowOverviewMode> WindowOverviewMode::Create( |
aura::Window* container, |
+ const aura::Window::Windows& windows, |
WindowOverviewModeDelegate* delegate) { |
return scoped_ptr<WindowOverviewMode>( |
- new WindowOverviewModeImpl(container, delegate)); |
+ new WindowOverviewModeImpl(container, windows, delegate)); |
} |
} // namespace athena |