| 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/common/wm/window_cycle_list.h" | 5 #include "ash/common/wm/window_cycle_list.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // window is minimized, we should also show it. | 511 // window is minimized, we should also show it. |
| 512 if (windows_.size() == 1) { | 512 if (windows_.size() == 1) { |
| 513 windows_[0]->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 513 windows_[0]->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 514 windows_[0]->Show(); | 514 windows_[0]->Show(); |
| 515 windows_[0]->GetWindowState()->Activate(); | 515 windows_[0]->GetWindowState()->Activate(); |
| 516 return; | 516 return; |
| 517 } | 517 } |
| 518 | 518 |
| 519 DCHECK(static_cast<size_t>(current_index_) < windows_.size()); | 519 DCHECK(static_cast<size_t>(current_index_) < windows_.size()); |
| 520 | 520 |
| 521 if (!cycle_view_ && current_index_ == 0) | 521 if (!cycle_view_ && current_index_ == 0) { |
| 522 initial_direction_ = direction; | 522 initial_direction_ = direction; |
| 523 // Special case the situation where we're cycling forward but the MRU window |
| 524 // is not active. This occurs when all windows are minimized. The starting |
| 525 // window should be the first one rather than the second. |
| 526 if (direction == WindowCycleController::FORWARD && !windows_[0]->IsActive()) |
| 527 current_index_ = -1; |
| 528 } |
| 523 | 529 |
| 524 // We're in a valid cycle, so step forward or backward. | 530 // We're in a valid cycle, so step forward or backward. |
| 525 current_index_ += direction == WindowCycleController::FORWARD ? 1 : -1; | 531 current_index_ += direction == WindowCycleController::FORWARD ? 1 : -1; |
| 526 | 532 |
| 527 // Wrap to window list size. | 533 // Wrap to window list size. |
| 528 current_index_ = (current_index_ + windows_.size()) % windows_.size(); | 534 current_index_ = (current_index_ + windows_.size()) % windows_.size(); |
| 529 DCHECK(windows_[current_index_]); | 535 DCHECK(windows_[current_index_]); |
| 530 | 536 |
| 531 if (ShouldShowUi()) { | 537 if (ShouldShowUi()) { |
| 532 if (current_index_ > 1) | 538 if (current_index_ > 1) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 widget->Init(params); | 626 widget->Init(params); |
| 621 | 627 |
| 622 screen_observer_.Add(display::Screen::GetScreen()); | 628 screen_observer_.Add(display::Screen::GetScreen()); |
| 623 widget->Show(); | 629 widget->Show(); |
| 624 widget->SetCapture(cycle_view_); | 630 widget->SetCapture(cycle_view_); |
| 625 widget->set_auto_release_capture(false); | 631 widget->set_auto_release_capture(false); |
| 626 cycle_ui_widget_ = widget; | 632 cycle_ui_widget_ = widget; |
| 627 } | 633 } |
| 628 | 634 |
| 629 } // namespace ash | 635 } // namespace ash |
| OLD | NEW |