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/athena_export.h" | 9 #include "athena/athena_export.h" |
10 #include "athena/wm/public/window_list_provider_observer.h" | 10 #include "athena/wm/public/window_list_provider_observer.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void WindowListProviderImpl::RecreateWindowList() { | 91 void WindowListProviderImpl::RecreateWindowList() { |
92 window_list_.clear(); | 92 window_list_.clear(); |
93 for (auto* window : container_->children()) { | 93 for (auto* window : container_->children()) { |
94 if (window->GetProperty(kManagedKey)) | 94 if (window->GetProperty(kManagedKey)) |
95 window_list_.push_back(window); | 95 window_list_.push_back(window); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 void WindowListProviderImpl::OnWindowAdded(aura::Window* window) { | 99 void WindowListProviderImpl::OnWindowAdded(aura::Window* window) { |
100 DCHECK_EQ(window->parent(), container_); | 100 if (!IsValidWindow(window) || window->parent() != container_) |
101 if (!IsValidWindow(window)) | |
102 return; | 101 return; |
103 | 102 |
104 window->SetProperty(kManagedKey, true); | 103 window->SetProperty(kManagedKey, true); |
105 RecreateWindowList(); | 104 RecreateWindowList(); |
106 DCHECK(IsWindowInList(window)); | 105 DCHECK(IsWindowInList(window)); |
107 window->AddObserver(this); | 106 window->AddObserver(this); |
108 FOR_EACH_OBSERVER( | 107 FOR_EACH_OBSERVER( |
109 WindowListProviderObserver, observers_, OnWindowAddedToList(window)); | 108 WindowListProviderObserver, observers_, OnWindowAddedToList(window)); |
110 } | 109 } |
111 | 110 |
(...skipping 17 matching lines...) Expand all Loading... |
129 if (window == container_) | 128 if (window == container_) |
130 return; | 129 return; |
131 DCHECK(IsWindowInList(window)); | 130 DCHECK(IsWindowInList(window)); |
132 RecreateWindowList(); | 131 RecreateWindowList(); |
133 // Inform our listeners that the stacking has been changed. | 132 // Inform our listeners that the stacking has been changed. |
134 FOR_EACH_OBSERVER( | 133 FOR_EACH_OBSERVER( |
135 WindowListProviderObserver, observers_, OnWindowStackingChangedInList()); | 134 WindowListProviderObserver, observers_, OnWindowStackingChangedInList()); |
136 } | 135 } |
137 | 136 |
138 } // namespace athena | 137 } // namespace athena |
OLD | NEW |