| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/wm/mru_window_tracker.h" | 7 #include "ash/common/wm/mru_window_tracker.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (params.target == window_) { | 99 if (params.target == window_) { |
| 100 CancelRestore(); | 100 CancelRestore(); |
| 101 } else if (params.target == stack_window_above_) { | 101 } else if (params.target == stack_window_above_) { |
| 102 // If the window this window was above is removed, use the next window down | 102 // If the window this window was above is removed, use the next window down |
| 103 // as the restore marker. | 103 // as the restore marker. |
| 104 stack_window_above_ = GetWindowBelow(stack_window_above_); | 104 stack_window_above_ = GetWindowBelow(stack_window_above_); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 WindowCycleList::WindowCycleList(const WindowList& windows) | 108 WindowCycleList::WindowCycleList(const WindowList& windows) |
| 109 : windows_(windows), | 109 : windows_(windows), current_index_(0) { |
| 110 current_index_(0) { | |
| 111 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(true); | 110 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(true); |
| 112 | 111 |
| 113 for (WmWindow* window : windows_) | 112 for (WmWindow* window : windows_) |
| 114 window->AddObserver(this); | 113 window->AddObserver(this); |
| 115 } | 114 } |
| 116 | 115 |
| 117 WindowCycleList::~WindowCycleList() { | 116 WindowCycleList::~WindowCycleList() { |
| 118 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(false); | 117 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(false); |
| 119 for (WmWindow* window : windows_) { | 118 for (WmWindow* window : windows_) { |
| 120 // TODO(oshima): Remove this once crbug.com/483491 is fixed. | 119 // TODO(oshima): Remove this once crbug.com/483491 is fixed. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 CHECK(i != windows_.end()); | 159 CHECK(i != windows_.end()); |
| 161 int removed_index = static_cast<int>(i - windows_.begin()); | 160 int removed_index = static_cast<int>(i - windows_.begin()); |
| 162 windows_.erase(i); | 161 windows_.erase(i); |
| 163 if (current_index_ > removed_index || | 162 if (current_index_ > removed_index || |
| 164 current_index_ == static_cast<int>(windows_.size())) { | 163 current_index_ == static_cast<int>(windows_.size())) { |
| 165 current_index_--; | 164 current_index_--; |
| 166 } | 165 } |
| 167 } | 166 } |
| 168 | 167 |
| 169 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |