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_shell.h" |
9 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/wm/window_animations.h" | 12 #include "ash/wm/window_animations.h" |
12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
13 | 14 |
14 namespace ash { | 15 namespace ash { |
15 | 16 |
16 // Returns the window immediately below |window| in the current container. | 17 // Returns the window immediately below |window| in the current container. |
17 WmWindow* GetWindowBelow(WmWindow* window) { | 18 WmWindow* GetWindowBelow(WmWindow* window) { |
18 WmWindow* parent = window->GetParent(); | 19 WmWindow* parent = window->GetParent(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 CancelRestore(); | 101 CancelRestore(); |
101 } else if (params.target == stack_window_above_) { | 102 } else if (params.target == stack_window_above_) { |
102 // If the window this window was above is removed, use the next window down | 103 // If the window this window was above is removed, use the next window down |
103 // as the restore marker. | 104 // as the restore marker. |
104 stack_window_above_ = GetWindowBelow(stack_window_above_); | 105 stack_window_above_ = GetWindowBelow(stack_window_above_); |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 WindowCycleList::WindowCycleList(const WindowList& windows) | 109 WindowCycleList::WindowCycleList(const WindowList& windows) |
109 : windows_(windows), current_index_(0) { | 110 : windows_(windows), current_index_(0) { |
110 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(true); | 111 WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true); |
111 | 112 |
112 for (WmWindow* window : windows_) | 113 for (WmWindow* window : windows_) |
113 window->AddObserver(this); | 114 window->AddObserver(this); |
114 } | 115 } |
115 | 116 |
116 WindowCycleList::~WindowCycleList() { | 117 WindowCycleList::~WindowCycleList() { |
117 ash::Shell::GetInstance()->mru_window_tracker()->SetIgnoreActivations(false); | 118 WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false); |
118 for (WmWindow* window : windows_) { | 119 for (WmWindow* window : windows_) { |
119 // TODO(oshima): Remove this once crbug.com/483491 is fixed. | 120 // TODO(oshima): Remove this once crbug.com/483491 is fixed. |
120 CHECK(window); | 121 CHECK(window); |
121 window->RemoveObserver(this); | 122 window->RemoveObserver(this); |
122 } | 123 } |
123 if (showing_window_) | 124 if (showing_window_) |
124 showing_window_->CancelRestore(); | 125 showing_window_->CancelRestore(); |
125 } | 126 } |
126 | 127 |
127 void WindowCycleList::Step(WindowCycleController::Direction direction) { | 128 void WindowCycleList::Step(WindowCycleController::Direction direction) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 CHECK(i != windows_.end()); | 160 CHECK(i != windows_.end()); |
160 int removed_index = static_cast<int>(i - windows_.begin()); | 161 int removed_index = static_cast<int>(i - windows_.begin()); |
161 windows_.erase(i); | 162 windows_.erase(i); |
162 if (current_index_ > removed_index || | 163 if (current_index_ > removed_index || |
163 current_index_ == static_cast<int>(windows_.size())) { | 164 current_index_ == static_cast<int>(windows_.size())) { |
164 current_index_--; | 165 current_index_--; |
165 } | 166 } |
166 } | 167 } |
167 | 168 |
168 } // namespace ash | 169 } // namespace ash |
OLD | NEW |