| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/window_cycle_list.h" | 5 #include "ash/wm/window_cycle_list.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" |
| 8 #include "ash/wm/mru_window_tracker.h" |
| 7 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 8 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 9 #include "ui/views/corewm/window_animations.h" | 11 #include "ui/views/corewm/window_animations.h" |
| 10 | 12 |
| 11 namespace ash { | 13 namespace ash { |
| 12 | 14 |
| 13 WindowCycleList::WindowCycleList(const WindowList& windows) | 15 WindowCycleList::WindowCycleList(const WindowList& windows) |
| 14 : windows_(windows), | 16 : windows_(windows), |
| 15 current_index_(-1) { | 17 current_index_(-1) { |
| 18 ash::Shell::GetInstance()->mru_window_tracker()->IgnoreActivations(true); |
| 16 // Locate the currently active window in the list to use as our start point. | 19 // Locate the currently active window in the list to use as our start point. |
| 17 aura::Window* active_window = wm::GetActiveWindow(); | 20 aura::Window* active_window = wm::GetActiveWindow(); |
| 18 | 21 |
| 19 // The active window may not be in the cycle list, which is expected if there | 22 // The active window may not be in the cycle list, which is expected if there |
| 20 // are additional modal windows on the screen. | 23 // are additional modal windows on the screen. |
| 21 current_index_ = GetWindowIndex(active_window); | 24 current_index_ = GetWindowIndex(active_window); |
| 22 | 25 |
| 23 for (WindowList::const_iterator i = windows_.begin(); i != windows_.end(); | 26 for (WindowList::const_iterator i = windows_.begin(); i != windows_.end(); |
| 24 ++i) { | 27 ++i) { |
| 25 (*i)->AddObserver(this); | 28 (*i)->AddObserver(this); |
| 26 } | 29 } |
| 27 } | 30 } |
| 28 | 31 |
| 29 WindowCycleList::~WindowCycleList() { | 32 WindowCycleList::~WindowCycleList() { |
| 33 ash::Shell::GetInstance()->mru_window_tracker()->IgnoreActivations(false); |
| 30 for (WindowList::const_iterator i = windows_.begin(); i != windows_.end(); | 34 for (WindowList::const_iterator i = windows_.begin(); i != windows_.end(); |
| 31 ++i) { | 35 ++i) { |
| 32 (*i)->RemoveObserver(this); | 36 (*i)->RemoveObserver(this); |
| 33 } | 37 } |
| 34 } | 38 } |
| 35 | 39 |
| 36 void WindowCycleList::Step(Direction direction) { | 40 void WindowCycleList::Step(Direction direction) { |
| 37 if (windows_.empty()) | 41 if (windows_.empty()) |
| 38 return; | 42 return; |
| 39 | 43 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK(i != windows_.end()); | 78 DCHECK(i != windows_.end()); |
| 75 int removed_index = static_cast<int>(i - windows_.begin()); | 79 int removed_index = static_cast<int>(i - windows_.begin()); |
| 76 windows_.erase(i); | 80 windows_.erase(i); |
| 77 if (current_index_ > removed_index) | 81 if (current_index_ > removed_index) |
| 78 current_index_--; | 82 current_index_--; |
| 79 else if (current_index_ == static_cast<int>(windows_.size())) | 83 else if (current_index_ == static_cast<int>(windows_.size())) |
| 80 current_index_--; | 84 current_index_--; |
| 81 } | 85 } |
| 82 | 86 |
| 83 } // namespace ash | 87 } // namespace ash |
| OLD | NEW |