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..7ae2660e629b6c6599a9ec983426b240c6a11c8a 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::const_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())); |
Jun Mukai
2014/08/05 21:13:39
Why this needs to be changed to container_? Is th
mfomitchev
2014/08/06 18:11:32
conainer_ is window's parent. The reason this was
Jun Mukai
2014/08/06 19:56:10
I got confused. Here's my understanding:
- contain
mfomitchev
2014/08/06 20:09:59
It's the split view transform, not the overview mo
Jun Mukai
2014/08/06 20:49:01
Okay
|
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::const_iterator iter = windows_.begin(); |
+ delta_y_p > kEpsilon && iter != windows_.end(); |
++iter) { |
aura::Window* window = (*iter); |
WindowOverviewState* state = window->GetProperty(kWindowOverviewState); |
@@ -243,8 +241,9 @@ 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(); |
+ aura::Window::Windows::const_reverse_iterator iter; |
+ for (iter = windows_.rbegin(); |
+ delta_y_p > kEpsilon && iter != windows_.rend(); |
++iter) { |
aura::Window* window = (*iter); |
WindowOverviewState* state = window->GetProperty(kWindowOverviewState); |
@@ -294,6 +293,8 @@ class WindowOverviewModeImpl : public WindowOverviewMode, |
} |
aura::Window* container_; |
+ // The stack of windows to show in the overview mode |
+ aura::Window::Windows windows_; |
Jun Mukai
2014/08/05 21:13:38
Can we set this as const? I think the order of |w
mfomitchev
2014/08/06 18:11:32
Done.
|
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 |