| 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/test/test_shell_delegate.h" | 5 #include "ash/test/test_shell_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/screenshot_delegate.h" | 9 #include "ash/screenshot_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "grit/ui_resources.h" | 12 #include "grit/ui_resources.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 TestShellDelegate::TestShellDelegate() | 18 TestShellDelegate::TestShellDelegate() { |
| 19 : override_window_mode_(false), | |
| 20 window_mode_(Shell::MODE_MANAGED) { | |
| 21 } | 19 } |
| 22 | 20 |
| 23 TestShellDelegate::~TestShellDelegate() { | 21 TestShellDelegate::~TestShellDelegate() { |
| 24 } | 22 } |
| 25 | 23 |
| 26 void TestShellDelegate::SetOverrideWindowMode(Shell::WindowMode window_mode) { | |
| 27 override_window_mode_ = true; | |
| 28 window_mode_ = window_mode; | |
| 29 } | |
| 30 | |
| 31 views::Widget* TestShellDelegate::CreateStatusArea() { | 24 views::Widget* TestShellDelegate::CreateStatusArea() { |
| 32 return NULL; | 25 return NULL; |
| 33 } | 26 } |
| 34 | 27 |
| 35 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 36 void TestShellDelegate::LockScreen() { | 29 void TestShellDelegate::LockScreen() { |
| 37 } | 30 } |
| 38 #endif | 31 #endif |
| 39 | 32 |
| 40 void TestShellDelegate::Exit() { | 33 void TestShellDelegate::Exit() { |
| 41 } | 34 } |
| 42 | 35 |
| 43 AppListViewDelegate* TestShellDelegate::CreateAppListViewDelegate() { | 36 AppListViewDelegate* TestShellDelegate::CreateAppListViewDelegate() { |
| 44 return NULL; | 37 return NULL; |
| 45 } | 38 } |
| 46 | 39 |
| 47 std::vector<aura::Window*> TestShellDelegate::GetCycleWindowList( | 40 std::vector<aura::Window*> TestShellDelegate::GetCycleWindowList( |
| 48 CycleSource source, | 41 CycleSource source) const { |
| 49 CycleOrder order) const { | |
| 50 // We just use the Shell's default container of windows, so tests can be | 42 // We just use the Shell's default container of windows, so tests can be |
| 51 // written with the usual CreateTestWindowWithId() calls. But window cycling | 43 // written with the usual CreateTestWindowWithId() calls. But window cycling |
| 52 // expects the topmost window at the front of the list, so reverse the order | 44 // expects the topmost window at the front of the list, so reverse the order. |
| 53 // if we are mimicking MRU. | |
| 54 aura::Window* default_container = Shell::GetInstance()->GetContainer( | 45 aura::Window* default_container = Shell::GetInstance()->GetContainer( |
| 55 internal::kShellWindowId_DefaultContainer); | 46 internal::kShellWindowId_DefaultContainer); |
| 56 std::vector<aura::Window*> windows = default_container->children(); | 47 std::vector<aura::Window*> windows = default_container->children(); |
| 57 if (order != ShellDelegate::ORDER_LINEAR) | 48 std::reverse(windows.begin(), windows.end()); |
| 58 std::reverse(windows.begin(), windows.end()); | |
| 59 return windows; | 49 return windows; |
| 60 } | 50 } |
| 61 | 51 |
| 62 void TestShellDelegate::StartPartialScreenshot( | 52 void TestShellDelegate::StartPartialScreenshot( |
| 63 ScreenshotDelegate* screenshot_delegate) { | 53 ScreenshotDelegate* screenshot_delegate) { |
| 64 if (screenshot_delegate) | 54 if (screenshot_delegate) |
| 65 screenshot_delegate->HandleTakePartialScreenshot(NULL, gfx::Rect()); | 55 screenshot_delegate->HandleTakePartialScreenshot(NULL, gfx::Rect()); |
| 66 } | 56 } |
| 67 | 57 |
| 68 LauncherDelegate* TestShellDelegate::CreateLauncherDelegate( | 58 LauncherDelegate* TestShellDelegate::CreateLauncherDelegate( |
| 69 ash::LauncherModel* model) { | 59 ash::LauncherModel* model) { |
| 70 return NULL; | 60 return NULL; |
| 71 } | 61 } |
| 72 | 62 |
| 73 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate( | 63 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate( |
| 74 SystemTray* tray) { | 64 SystemTray* tray) { |
| 75 return NULL; | 65 return NULL; |
| 76 } | 66 } |
| 77 | 67 |
| 78 bool TestShellDelegate::GetOverrideWindowMode(Shell::WindowMode* window_mode) { | |
| 79 if (override_window_mode_) { | |
| 80 *window_mode = window_mode_; | |
| 81 return true; | |
| 82 } | |
| 83 return false; | |
| 84 } | |
| 85 | |
| 86 } // namespace test | 68 } // namespace test |
| 87 } // namespace ash | 69 } // namespace ash |
| OLD | NEW |