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