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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "ash/wm/toplevel_window_event_filter.h" | 58 #include "ash/wm/toplevel_window_event_filter.h" |
59 #include "ash/wm/user_activity_detector.h" | 59 #include "ash/wm/user_activity_detector.h" |
60 #include "ash/wm/video_detector.h" | 60 #include "ash/wm/video_detector.h" |
61 #include "ash/wm/visibility_controller.h" | 61 #include "ash/wm/visibility_controller.h" |
62 #include "ash/wm/window_cycle_controller.h" | 62 #include "ash/wm/window_cycle_controller.h" |
63 #include "ash/wm/window_modality_controller.h" | 63 #include "ash/wm/window_modality_controller.h" |
64 #include "ash/wm/window_util.h" | 64 #include "ash/wm/window_util.h" |
65 #include "ash/wm/window_properties.h" | 65 #include "ash/wm/window_properties.h" |
66 #include "ash/wm/workspace/workspace_event_filter.h" | 66 #include "ash/wm/workspace/workspace_event_filter.h" |
67 #include "ash/wm/workspace/workspace_layout_manager.h" | 67 #include "ash/wm/workspace/workspace_layout_manager.h" |
68 #include "ash/wm/workspace/workspace_manager.h" | |
69 #include "ash/wm/workspace_controller.h" | 68 #include "ash/wm/workspace_controller.h" |
70 #include "base/bind.h" | 69 #include "base/bind.h" |
71 #include "base/command_line.h" | 70 #include "base/command_line.h" |
72 #include "grit/ui_resources.h" | 71 #include "grit/ui_resources.h" |
73 #include "ui/aura/client/aura_constants.h" | 72 #include "ui/aura/client/aura_constants.h" |
74 #include "ui/aura/client/user_action_client.h" | 73 #include "ui/aura/client/user_action_client.h" |
75 #include "ui/aura/env.h" | 74 #include "ui/aura/env.h" |
76 #include "ui/aura/focus_manager.h" | 75 #include "ui/aura/focus_manager.h" |
77 #include "ui/aura/layout_manager.h" | 76 #include "ui/aura/layout_manager.h" |
78 #include "ui/aura/display_manager.h" | 77 #include "ui/aura/display_manager.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 | 653 |
655 SystemTrayDelegate* Shell::tray_delegate() { | 654 SystemTrayDelegate* Shell::tray_delegate() { |
656 return status_area_widget_->system_tray_delegate(); | 655 return status_area_widget_->system_tray_delegate(); |
657 } | 656 } |
658 | 657 |
659 SystemTray* Shell::system_tray() { | 658 SystemTray* Shell::system_tray() { |
660 return status_area_widget_->system_tray(); | 659 return status_area_widget_->system_tray(); |
661 } | 660 } |
662 | 661 |
663 int Shell::GetGridSize() const { | 662 int Shell::GetGridSize() const { |
664 return GetPrimaryRootWindowController()->workspace_controller()-> | 663 return |
665 workspace_manager()->grid_size(); | 664 GetPrimaryRootWindowController()->workspace_controller()->GetGridSize(); |
666 } | 665 } |
667 | 666 |
668 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { | 667 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
669 root->set_focus_manager(focus_manager_.get()); | 668 root->set_focus_manager(focus_manager_.get()); |
670 if (internal::DisplayController::IsExtendedDesktopEnabled()) { | 669 if (internal::DisplayController::IsExtendedDesktopEnabled()) { |
671 internal::RootWindowController* controller = | 670 internal::RootWindowController* controller = |
672 new internal::RootWindowController(root); | 671 new internal::RootWindowController(root); |
673 controller->CreateContainers(); | 672 controller->CreateContainers(); |
674 InitRootWindowController(controller); | 673 InitRootWindowController(controller); |
675 controller->root_window_layout()->OnWindowResized(); | 674 controller->root_window_layout()->OnWindowResized(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 new internal::ShelfLayoutManager(status_area_widget_); | 745 new internal::ShelfLayoutManager(status_area_widget_); |
747 controller->GetContainer(internal::kShellWindowId_LauncherContainer)-> | 746 controller->GetContainer(internal::kShellWindowId_LauncherContainer)-> |
748 SetLayoutManager(shelf_layout_manager); | 747 SetLayoutManager(shelf_layout_manager); |
749 shelf_ = shelf_layout_manager; | 748 shelf_ = shelf_layout_manager; |
750 | 749 |
751 internal::StatusAreaLayoutManager* status_area_layout_manager = | 750 internal::StatusAreaLayoutManager* status_area_layout_manager = |
752 new internal::StatusAreaLayoutManager(shelf_layout_manager); | 751 new internal::StatusAreaLayoutManager(shelf_layout_manager); |
753 controller->GetContainer(internal::kShellWindowId_StatusContainer)-> | 752 controller->GetContainer(internal::kShellWindowId_StatusContainer)-> |
754 SetLayoutManager(status_area_layout_manager); | 753 SetLayoutManager(status_area_layout_manager); |
755 | 754 |
756 shelf_layout_manager->set_workspace_manager( | 755 shelf_layout_manager->set_workspace_controller( |
757 controller->workspace_controller()->workspace_manager()); | 756 controller->workspace_controller()); |
758 | 757 |
759 // TODO(oshima): Support multiple displays. | 758 // TODO(oshima): Support multiple displays. |
760 controller->workspace_controller()->workspace_manager()-> | 759 controller->workspace_controller()->SetShelf(shelf()); |
761 set_shelf(shelf()); | |
762 | 760 |
763 // Create Panel layout manager | 761 // Create Panel layout manager |
764 aura::Window* panel_container = GetContainer( | 762 aura::Window* panel_container = GetContainer( |
765 GetPrimaryRootWindow(), | 763 GetPrimaryRootWindow(), |
766 internal::kShellWindowId_PanelContainer); | 764 internal::kShellWindowId_PanelContainer); |
767 panel_layout_manager_ = | 765 panel_layout_manager_ = |
768 new internal::PanelLayoutManager(panel_container); | 766 new internal::PanelLayoutManager(panel_container); |
769 panel_container->SetEventFilter( | 767 panel_container->SetEventFilter( |
770 new internal::PanelWindowEventFilter( | 768 new internal::PanelWindowEventFilter( |
771 panel_container, panel_layout_manager_)); | 769 panel_container, panel_layout_manager_)); |
772 panel_container->SetLayoutManager(panel_layout_manager_); | 770 panel_container->SetLayoutManager(panel_layout_manager_); |
773 } | 771 } |
774 | 772 |
| 773 // TODO: this is only used in tests, move with test. |
775 void Shell::DisableWorkspaceGridLayout() { | 774 void Shell::DisableWorkspaceGridLayout() { |
776 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 775 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
777 for (RootWindowControllerList::iterator iter = controllers.begin(); | 776 for (RootWindowControllerList::iterator iter = controllers.begin(); |
778 iter != controllers.end(); ++iter) | 777 iter != controllers.end(); ++iter) |
779 (*iter)->workspace_controller()->workspace_manager()->set_grid_size(0); | 778 (*iter)->workspace_controller()->SetGridSize(0); |
780 } | 779 } |
781 | 780 |
782 void Shell::SetCursor(gfx::NativeCursor cursor) { | 781 void Shell::SetCursor(gfx::NativeCursor cursor) { |
783 RootWindowList root_windows = GetAllRootWindows(); | 782 RootWindowList root_windows = GetAllRootWindows(); |
784 for (RootWindowList::iterator iter = root_windows.begin(); | 783 for (RootWindowList::iterator iter = root_windows.begin(); |
785 iter != root_windows.end(); ++iter) | 784 iter != root_windows.end(); ++iter) |
786 (*iter)->SetCursor(cursor); | 785 (*iter)->SetCursor(cursor); |
787 } | 786 } |
788 | 787 |
789 void Shell::ShowCursor(bool visible) { | 788 void Shell::ShowCursor(bool visible) { |
790 RootWindowList root_windows = GetAllRootWindows(); | 789 RootWindowList root_windows = GetAllRootWindows(); |
791 for (RootWindowList::iterator iter = root_windows.begin(); | 790 for (RootWindowList::iterator iter = root_windows.begin(); |
792 iter != root_windows.end(); ++iter) | 791 iter != root_windows.end(); ++iter) |
793 (*iter)->ShowCursor(visible); | 792 (*iter)->ShowCursor(visible); |
794 } | 793 } |
795 | 794 |
796 } // namespace ash | 795 } // namespace ash |
OLD | NEW |