| 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/launcher/launcher_window_cycler.h" | 5 #include "ash/launcher/launcher_window_cycler.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_delegate.h" | 7 #include "ash/launcher/launcher_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/wm/window_cycle_controller.h" | 10 #include "ash/wm/window_cycle_controller.h" |
| 11 #include "ash/wm/window_cycle_list.h" | 11 #include "ash/wm/window_cycle_list.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 LauncherWindowCycler::LauncherWindowCycler(LauncherDelegate* delegate) | 15 LauncherWindowCycler::LauncherWindowCycler(LauncherDelegate* delegate) |
| 16 : delegate_(delegate) { | 16 : delegate_(delegate) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 LauncherWindowCycler::~LauncherWindowCycler() { | 19 LauncherWindowCycler::~LauncherWindowCycler() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void LauncherWindowCycler::Cycle() { | 22 void LauncherWindowCycler::Cycle() { |
| 23 if (!WindowCycleController::CanCycle()) | 23 if (!WindowCycleController::CanCycle()) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 if (!windows_.get()) { | 26 if (!windows_.get()) { |
| 27 windows_.reset(new WindowCycleList( | 27 windows_.reset(new WindowCycleList( |
| 28 ash::Shell::GetInstance()->delegate()->GetCycleWindowList( | 28 ash::Shell::GetInstance()->delegate()->GetCycleWindowList( |
| 29 ShellDelegate::SOURCE_LAUNCHER, ShellDelegate::ORDER_MRU))); | 29 ShellDelegate::SOURCE_LAUNCHER))); |
| 30 } | 30 } |
| 31 if (windows_->empty()) | 31 if (windows_->empty()) |
| 32 delegate_->CreateNewWindow(); | 32 delegate_->CreateNewWindow(); |
| 33 else | 33 else |
| 34 windows_->Step(WindowCycleList::FORWARD); | 34 windows_->Step(WindowCycleList::FORWARD); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void LauncherWindowCycler::Reset() { | 37 void LauncherWindowCycler::Reset() { |
| 38 // TODO(sky): If the user cycled more than one time we've now messed up the | 38 // TODO(sky): If the user cycled more than one time we've now messed up the |
| 39 // cycle order. We really need a way to reset it. | 39 // cycle order. We really need a way to reset it. |
| 40 windows_.reset(); | 40 windows_.reset(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace ash | 43 } // namespace ash |
| OLD | NEW |