OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "athena/wm/window_list_provider_impl.h" | 5 #include "athena/wm/window_list_provider_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "athena/wm/public/window_list_provider_observer.h" | 9 #include "athena/wm/public/window_list_provider_observer.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 bool WindowListProviderImpl::IsWindowInList(aura::Window* window) const { | 59 bool WindowListProviderImpl::IsWindowInList(aura::Window* window) const { |
60 return window->parent() == container_ && IsValidWindow(window); | 60 return window->parent() == container_ && IsValidWindow(window); |
61 } | 61 } |
62 | 62 |
63 bool WindowListProviderImpl::IsValidWindow(aura::Window* window) const { | 63 bool WindowListProviderImpl::IsValidWindow(aura::Window* window) const { |
64 // TODO(oshima): crbug.com/413912 | 64 // TODO(oshima): crbug.com/413912 |
65 return window->type() == ui::wm::WINDOW_TYPE_NORMAL || | 65 return window->type() == ui::wm::WINDOW_TYPE_NORMAL || |
66 window->type() == ui::wm::WINDOW_TYPE_PANEL; | 66 window->type() == ui::wm::WINDOW_TYPE_PANEL; |
67 } | 67 } |
68 | 68 |
69 void WindowListProviderImpl::MoveToFront(aura::Window* window) { | |
70 DCHECK(IsWindowInList(window)); | |
71 container_->StackChildAtTop(window); | |
72 } | |
73 | |
74 void WindowListProviderImpl::StackWindowFrontOf( | 69 void WindowListProviderImpl::StackWindowFrontOf( |
75 aura::Window* window, | 70 aura::Window* window, |
76 aura::Window* reference_window) { | 71 aura::Window* reference_window) { |
77 DCHECK_NE(window, reference_window); | 72 DCHECK_NE(window, reference_window); |
78 DCHECK(IsWindowInList(window)); | 73 DCHECK(IsWindowInList(window)); |
79 DCHECK(IsWindowInList(reference_window)); | 74 DCHECK(IsWindowInList(reference_window)); |
80 container_->StackChildAbove(window, reference_window); | 75 container_->StackChildAbove(window, reference_window); |
81 } | 76 } |
82 | 77 |
83 void WindowListProviderImpl::StackWindowBehindTo( | 78 void WindowListProviderImpl::StackWindowBehindTo( |
84 aura::Window* window, | 79 aura::Window* window, |
85 aura::Window* reference_window) { | 80 aura::Window* reference_window) { |
pkotwicz
2014/09/19 21:58:00
I did not add a DCHECK here because it would break
mfomitchev
2014/09/22 18:04:24
Perhaps we should create a bug for this?
Also, ca
pkotwicz
2014/09/22 18:30:24
I have filed a bug at crbug.com/416549
| |
86 DCHECK_NE(window, reference_window); | 81 DCHECK_NE(window, reference_window); |
87 DCHECK(IsWindowInList(window)); | 82 DCHECK(IsWindowInList(window)); |
88 DCHECK(IsWindowInList(reference_window)); | 83 DCHECK(IsWindowInList(reference_window)); |
89 container_->StackChildBelow(window, reference_window); | 84 container_->StackChildBelow(window, reference_window); |
90 } | 85 } |
91 | 86 |
92 void WindowListProviderImpl::OnWindowAdded(aura::Window* window) { | 87 void WindowListProviderImpl::OnWindowAdded(aura::Window* window) { |
93 if (!IsValidWindow(window) || window->parent() != container_) | 88 if (!IsValidWindow(window) || window->parent() != container_) |
94 return; | 89 return; |
95 RecreateWindowList(); | 90 RecreateWindowList(); |
(...skipping 21 matching lines...) Expand all Loading... | |
117 return; | 112 return; |
118 DCHECK(IsWindowInList(window)); | 113 DCHECK(IsWindowInList(window)); |
119 RecreateWindowList(); | 114 RecreateWindowList(); |
120 // Inform our listeners that the stacking has been changed. | 115 // Inform our listeners that the stacking has been changed. |
121 FOR_EACH_OBSERVER(WindowListProviderObserver, | 116 FOR_EACH_OBSERVER(WindowListProviderObserver, |
122 observers_, | 117 observers_, |
123 OnWindowStackingChanged()); | 118 OnWindowStackingChanged()); |
124 } | 119 } |
125 | 120 |
126 } // namespace athena | 121 } // namespace athena |
OLD | NEW |