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