| 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/common/wm/mru_window_tracker.h" | 5 #include "ash/common/wm/mru_window_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/wm/focus_rules.h" | 9 #include "ash/common/wm/focus_rules.h" |
| 10 #include "ash/common/wm/switchable_windows.h" | 10 #include "ash/common/wm/switchable_windows.h" |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
| 14 #include "ash/public/cpp/shell_window_ids.h" | 14 #include "ash/public/cpp/shell_window_ids.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/wm/window_util.h" |
| 16 #include "base/bind.h" | 17 #include "base/bind.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/wm/public/activation_client.h" | 19 #include "ui/wm/public/activation_client.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 using CanActivateWindowPredicate = base::Callback<bool(WmWindow*)>; | 25 using CanActivateWindowPredicate = base::Callback<bool(WmWindow*)>; |
| 25 | 26 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return BuildWindowListInternal(nullptr, | 120 return BuildWindowListInternal(nullptr, |
| 120 base::Bind(&IsWindowConsideredActivatable)); | 121 base::Bind(&IsWindowConsideredActivatable)); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void MruWindowTracker::SetIgnoreActivations(bool ignore) { | 124 void MruWindowTracker::SetIgnoreActivations(bool ignore) { |
| 124 ignore_window_activations_ = ignore; | 125 ignore_window_activations_ = ignore; |
| 125 | 126 |
| 126 // If no longer ignoring window activations, move currently active window | 127 // If no longer ignoring window activations, move currently active window |
| 127 // to front. | 128 // to front. |
| 128 if (!ignore) | 129 if (!ignore) |
| 129 SetActiveWindow(WmShell::Get()->GetActiveWindow()); | 130 SetActiveWindow(WmWindow::Get(wm::GetActiveWindow())); |
| 130 } | 131 } |
| 131 | 132 |
| 132 ////////////////////////////////////////////////////////////////////////////// | 133 ////////////////////////////////////////////////////////////////////////////// |
| 133 // MruWindowTracker, private: | 134 // MruWindowTracker, private: |
| 134 | 135 |
| 135 void MruWindowTracker::SetActiveWindow(WmWindow* active_window) { | 136 void MruWindowTracker::SetActiveWindow(WmWindow* active_window) { |
| 136 if (!active_window) | 137 if (!active_window) |
| 137 return; | 138 return; |
| 138 | 139 |
| 139 std::list<WmWindow*>::iterator iter = | 140 std::list<WmWindow*>::iterator iter = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 | 156 |
| 156 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { | 157 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { |
| 157 // It's possible for OnWindowActivated() to be called after | 158 // It's possible for OnWindowActivated() to be called after |
| 158 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 159 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
| 159 // else we may end up with a deleted window in |mru_windows_|. | 160 // else we may end up with a deleted window in |mru_windows_|. |
| 160 mru_windows_.remove(WmWindow::Get(window)); | 161 mru_windows_.remove(WmWindow::Get(window)); |
| 161 window->RemoveObserver(this); | 162 window->RemoveObserver(this); |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |