| 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 28 matching lines...) Expand all Loading... |
| 39 aura::Window* container = Shell::GetContainer( | 39 aura::Window* container = Shell::GetContainer( |
| 40 root, internal::kShellWindowId_DockedContainer); | 40 root, internal::kShellWindowId_DockedContainer); |
| 41 const MruWindowTracker::WindowList& children = container->children(); | 41 const MruWindowTracker::WindowList& children = container->children(); |
| 42 for (MruWindowTracker::WindowList::const_iterator iter = children.begin(); | 42 for (MruWindowTracker::WindowList::const_iterator iter = children.begin(); |
| 43 iter != children.end(); ++iter) { | 43 iter != children.end(); ++iter) { |
| 44 if (wm::GetWindowState(*iter)->is_dragged()) | 44 if (wm::GetWindowState(*iter)->is_dragged()) |
| 45 windows->insert(windows->end(), *iter); | 45 windows->insert(windows->end(), *iter); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Returns true if |window| is a container whose windows can be cycled to. | |
| 50 bool IsSwitchableContainer(aura::Window* window) { | |
| 51 if (!window) | |
| 52 return false; | |
| 53 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | |
| 54 if (window->id() == kSwitchableWindowContainerIds[i]) | |
| 55 return true; | |
| 56 } | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 // Returns whether |w1| should be considered less recently used than |w2|. This | 49 // Returns whether |w1| should be considered less recently used than |w2|. This |
| 61 // is used for a stable sort to move minimized windows to the LRU end of the | 50 // is used for a stable sort to move minimized windows to the LRU end of the |
| 62 // list. | 51 // list. |
| 63 bool CompareWindowState(aura::Window* w1, aura::Window* w2) { | 52 bool CompareWindowState(aura::Window* w1, aura::Window* w2) { |
| 64 return ash::wm::IsWindowMinimized(w1) && !ash::wm::IsWindowMinimized(w2); | 53 return ash::wm::IsWindowMinimized(w1) && !ash::wm::IsWindowMinimized(w2); |
| 65 } | 54 } |
| 66 | 55 |
| 67 // Returns a list of windows ordered by their stacking order. | 56 // Returns a list of windows ordered by their stacking order. |
| 68 // If |mru_windows| is passed, these windows are moved to the front of the list. | 57 // If |mru_windows| is passed, these windows are moved to the front of the list. |
| 69 // If |top_most_at_end|, the list is returned in descending (bottom-most / least | 58 // If |top_most_at_end|, the list is returned in descending (bottom-most / least |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 191 |
| 203 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { | 192 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { |
| 204 // It's possible for OnWindowActivated() to be called after | 193 // It's possible for OnWindowActivated() to be called after |
| 205 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 194 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
| 206 // else we may end up with a deleted window in |mru_windows_|. | 195 // else we may end up with a deleted window in |mru_windows_|. |
| 207 mru_windows_.remove(window); | 196 mru_windows_.remove(window); |
| 208 window->RemoveObserver(this); | 197 window->RemoveObserver(this); |
| 209 } | 198 } |
| 210 | 199 |
| 211 } // namespace ash | 200 } // namespace ash |
| OLD | NEW |