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/focus_cycler.h" | 5 #include "ash/focus_cycler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
10 #include "ash/common/wm/wm_globals.h" | 10 #include "ash/common/wm_shell.h" |
11 #include "ash/common/wm/wm_window.h" | 11 #include "ash/common/wm_window.h" |
12 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
13 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/shell_factory.h" | 15 #include "ash/shell_factory.h" |
16 #include "ash/system/status_area_widget.h" | 16 #include "ash/system/status_area_widget.h" |
17 #include "ash/system/status_area_widget_delegate.h" | 17 #include "ash/system/status_area_widget_delegate.h" |
18 #include "ash/system/tray/system_tray.h" | 18 #include "ash/system/tray/system_tray.h" |
19 #include "ash/test/ash_test_base.h" | 19 #include "ash/test/ash_test_base.h" |
20 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
21 #include "ui/aura/test/test_windows.h" | 21 #include "ui/aura/test/test_windows.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 focus_cycler_.reset(); | 85 focus_cycler_.reset(); |
86 | 86 |
87 AshTestBase::TearDown(); | 87 AshTestBase::TearDown(); |
88 } | 88 } |
89 | 89 |
90 protected: | 90 protected: |
91 // Creates the system tray, returning true on success. | 91 // Creates the system tray, returning true on success. |
92 bool CreateTray() { | 92 bool CreateTray() { |
93 if (tray_) | 93 if (tray_) |
94 return false; | 94 return false; |
95 wm::WmWindow* parent = | 95 WmWindow* parent = |
96 wm::WmGlobals::Get() | 96 WmShell::Get()->GetRootWindowForNewWindows()->GetChildByShellWindowId( |
97 ->GetRootWindowForNewWindows() | 97 kShellWindowId_StatusContainer); |
98 ->GetChildByShellWindowId(kShellWindowId_StatusContainer); | |
99 | 98 |
100 StatusAreaWidget* widget = new StatusAreaWidget(parent, shelf_widget()); | 99 StatusAreaWidget* widget = new StatusAreaWidget(parent, shelf_widget()); |
101 widget->CreateTrayViews(); | 100 widget->CreateTrayViews(); |
102 widget->Show(); | 101 widget->Show(); |
103 tray_.reset(widget->system_tray()); | 102 tray_.reset(widget->system_tray()); |
104 if (!tray_->GetWidget()) | 103 if (!tray_->GetWidget()) |
105 return false; | 104 return false; |
106 focus_cycler_->AddWidget(tray()->GetWidget()); | 105 focus_cycler_->AddWidget(tray()->GetWidget()); |
107 GetStatusAreaWidgetDelegate(tray_->GetWidget())->SetFocusCyclerForTesting( | 106 GetStatusAreaWidgetDelegate(tray_->GetWidget())->SetFocusCyclerForTesting( |
108 focus_cycler()); | 107 focus_cycler()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Cycle focus to the shelf. | 424 // Cycle focus to the shelf. |
426 Shell::GetInstance()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); | 425 Shell::GetInstance()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); |
427 | 426 |
428 // Cycle focus should go back to the browser. | 427 // Cycle focus should go back to the browser. |
429 Shell::GetInstance()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); | 428 Shell::GetInstance()->focus_cycler()->RotateFocus(FocusCycler::FORWARD); |
430 EXPECT_TRUE(wm::IsActiveWindow(window.get())); | 429 EXPECT_TRUE(wm::IsActiveWindow(window.get())); |
431 } | 430 } |
432 | 431 |
433 } // namespace test | 432 } // namespace test |
434 } // namespace ash | 433 } // namespace ash |
OLD | NEW |