OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/mru_window_tracker.h" | 5 #include "ash/wm/mru_window_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/session_state_delegate.h" | 9 #include "ash/session_state_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 int container_id, | 28 int container_id, |
29 MruWindowTracker::WindowList* windows) { | 29 MruWindowTracker::WindowList* windows) { |
30 aura::Window* container = Shell::GetContainer(root, container_id); | 30 aura::Window* container = Shell::GetContainer(root, container_id); |
31 const MruWindowTracker::WindowList& children(container->children()); | 31 const MruWindowTracker::WindowList& children(container->children()); |
32 windows->insert(windows->end(), children.begin(), children.end()); | 32 windows->insert(windows->end(), children.begin(), children.end()); |
33 } | 33 } |
34 | 34 |
35 // Adds windows being dragged in the docked container to |windows| list. | 35 // Adds windows being dragged in the docked container to |windows| list. |
36 void AddDraggedWindows(aura::Window* root, | 36 void AddDraggedWindows(aura::Window* root, |
37 MruWindowTracker::WindowList* windows) { | 37 MruWindowTracker::WindowList* windows) { |
38 aura::Window* container = Shell::GetContainer( | 38 aura::Window* container = |
39 root, internal::kShellWindowId_DockedContainer); | 39 Shell::GetContainer(root, kShellWindowId_DockedContainer); |
40 const MruWindowTracker::WindowList& children = container->children(); | 40 const MruWindowTracker::WindowList& children = container->children(); |
41 for (MruWindowTracker::WindowList::const_iterator iter = children.begin(); | 41 for (MruWindowTracker::WindowList::const_iterator iter = children.begin(); |
42 iter != children.end(); ++iter) { | 42 iter != children.end(); ++iter) { |
43 if (wm::GetWindowState(*iter)->is_dragged()) | 43 if (wm::GetWindowState(*iter)->is_dragged()) |
44 windows->insert(windows->end(), *iter); | 44 windows->insert(windows->end(), *iter); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 // Returns whether |w1| should be considered less recently used than |w2|. This | 48 // Returns whether |w1| should be considered less recently used than |w2|. This |
49 // is used for a stable sort to move minimized windows to the LRU end of the | 49 // is used for a stable sort to move minimized windows to the LRU end of the |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { | 191 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { |
192 // It's possible for OnWindowActivated() to be called after | 192 // It's possible for OnWindowActivated() to be called after |
193 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 193 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
194 // else we may end up with a deleted window in |mru_windows_|. | 194 // else we may end up with a deleted window in |mru_windows_|. |
195 mru_windows_.remove(window); | 195 mru_windows_.remove(window); |
196 window->RemoveObserver(this); | 196 window->RemoveObserver(this); |
197 } | 197 } |
198 | 198 |
199 } // namespace ash | 199 } // namespace ash |
OLD | NEW |