| 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/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 active_window->AddObserver(this); | 167 active_window->AddObserver(this); |
| 168 else | 168 else |
| 169 mru_windows_.erase(iter); | 169 mru_windows_.erase(iter); |
| 170 // TODO(flackr): Remove this check if this doesn't fire for a while. This | 170 // TODO(flackr): Remove this check if this doesn't fire for a while. This |
| 171 // should verify that all tracked windows start with a layer, see | 171 // should verify that all tracked windows start with a layer, see |
| 172 // http://crbug.com/291354. | 172 // http://crbug.com/291354. |
| 173 CHECK(active_window->layer()); | 173 CHECK(active_window->layer()); |
| 174 mru_windows_.push_front(active_window); | 174 mru_windows_.push_front(active_window); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void MruWindowTracker::OnWindowActivated(aura::Window* gained_active, | 177 void MruWindowTracker::OnWindowActivated( |
| 178 aura::Window* lost_active) { | 178 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 179 aura::Window* gained_active, |
| 180 aura::Window* lost_active) { |
| 179 if (!ignore_window_activations_) | 181 if (!ignore_window_activations_) |
| 180 SetActiveWindow(gained_active); | 182 SetActiveWindow(gained_active); |
| 181 } | 183 } |
| 182 | 184 |
| 183 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { | 185 void MruWindowTracker::OnWindowDestroyed(aura::Window* window) { |
| 184 // It's possible for OnWindowActivated() to be called after | 186 // It's possible for OnWindowActivated() to be called after |
| 185 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() | 187 // OnWindowDestroying(). This means we need to override OnWindowDestroyed() |
| 186 // else we may end up with a deleted window in |mru_windows_|. | 188 // else we may end up with a deleted window in |mru_windows_|. |
| 187 mru_windows_.remove(window); | 189 mru_windows_.remove(window); |
| 188 window->RemoveObserver(this); | 190 window->RemoveObserver(this); |
| 189 } | 191 } |
| 190 | 192 |
| 191 bool MruWindowTracker::IsWindowConsideredActivateable( | 193 bool MruWindowTracker::IsWindowConsideredActivateable( |
| 192 aura::Window* window) const { | 194 aura::Window* window) const { |
| 193 return focus_rules_->IsWindowConsideredActivatable(window); | 195 return focus_rules_->IsWindowConsideredActivatable(window); |
| 194 } | 196 } |
| 195 | 197 |
| 196 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |