Index: athena/wm/window_list_provider_impl.cc |
diff --git a/athena/wm/window_list_provider_impl.cc b/athena/wm/window_list_provider_impl.cc |
index 8b4cba5abdc2831bd80c81ccc263c33300e366b0..8c495adc64470802fcafee97ecd73a371eac4506 100644 |
--- a/athena/wm/window_list_provider_impl.cc |
+++ b/athena/wm/window_list_provider_impl.cc |
@@ -4,6 +4,7 @@ |
#include "athena/wm/window_list_provider_impl.h" |
+#include "athena/resource_manager/public/resource_manager.h" |
#include "ui/aura/window.h" |
namespace athena { |
@@ -16,16 +17,62 @@ WindowListProviderImpl::WindowListProviderImpl(aura::Window* container) |
WindowListProviderImpl::~WindowListProviderImpl() { |
} |
-aura::Window::Windows WindowListProviderImpl::GetWindowList() const { |
+aura::Window::Windows WindowListProviderImpl::GetCurrentWindowList() const { |
aura::Window::Windows list; |
const aura::Window::Windows& container_children = container_->children(); |
for (aura::Window::Windows::const_iterator iter = container_children.begin(); |
iter != container_children.end(); |
++iter) { |
- if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL) |
+ if (IsValidWindow(*iter)) |
list.push_back(*iter); |
} |
return list; |
} |
+bool WindowListProviderImpl::IsWindowInList(aura::Window* window) const { |
+ return window->parent() == container_ && IsValidWindow(window); |
+} |
+ |
+bool WindowListProviderImpl::IsValidWindow(aura::Window* window) const { |
+ return window->type() == ui::wm::WINDOW_TYPE_NORMAL; |
+} |
+ |
+void WindowListProviderImpl::AddWindow(aura::Window* window) { |
+ DCHECK(IsValidWindow(window)); |
+ if (!IsWindowInList(window)) |
+ container_->AddChild(window); |
+ MoveToFront(window); |
+} |
+ |
+void WindowListProviderImpl::MoveToFront(aura::Window* window) { |
+ DCHECK(IsWindowInList(window)); |
+ container_->StackChildAtTop(window); |
+} |
+ |
+void WindowListProviderImpl::MoveWindowInFrontOfReferenceWindow( |
+ aura::Window* window, |
+ aura::Window* reference_window) { |
+ DCHECK(IsWindowInList(window)); |
+ DCHECK(IsWindowInList(reference_window)); |
+ // To avoid that the resource manager does this twice we pause it shortly. |
+ ScopedPauseResourceManager pause_resource_manager; |
+ // Need to re-order twice to make sure that the window gets re-ordered since |
+ // aura::Window does not re-order if one window is anywhere above another. |
+ container_->StackChildBelow(window, reference_window); |
+ container_->StackChildAbove(window, reference_window); |
oshima
2014/09/05 23:13:06
I think you can just get the window below referenc
Mr4D (OOO till 08-26)
2014/09/08 17:35:07
Apparently something has changed in the behavior o
oshima
2014/09/09 18:28:37
Hmm Ok. There is another way to control stacking,
Mr4D (OOO till 08-26)
2014/09/10 00:01:58
Acknowledged.
|
+} |
+ |
+void WindowListProviderImpl::MoveWindowBehindOfReferenceWindow( |
+ aura::Window* window, |
+ aura::Window* reference_window) { |
+ DCHECK(IsWindowInList(window)); |
+ DCHECK(IsWindowInList(reference_window)); |
+ // To avoid that the resource manager does this twice we pause it shortly. |
+ ScopedPauseResourceManager pause_resource_manager; |
+ // Need to re-order twice to make sure that the window gets re-ordered since |
+ // aura::Window does not re-order if one window is anywhere below another. |
+ container_->StackChildAbove(window, reference_window); |
+ container_->StackChildBelow(window, reference_window); |
+} |
+ |
} // namespace athena |