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