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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 delete instance_; | 645 delete instance_; |
646 instance_ = NULL; | 646 instance_ = NULL; |
647 } | 647 } |
648 | 648 |
649 // static | 649 // static |
650 aura::RootWindow* Shell::GetRootWindow() { | 650 aura::RootWindow* Shell::GetRootWindow() { |
651 return GetInstance()->root_window_.get(); | 651 return GetInstance()->root_window_.get(); |
652 } | 652 } |
653 | 653 |
654 void Shell::Init() { | 654 void Shell::Init() { |
| 655 // Install the custom factory first so that views::FocusManagers for Tray, |
| 656 // Launcher, and WallPaper could be created by the factory. |
| 657 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| 658 |
655 aura::RootWindow* root_window = GetRootWindow(); | 659 aura::RootWindow* root_window = GetRootWindow(); |
656 root_filter_ = new aura::shared::RootWindowEventFilter(root_window); | 660 root_filter_ = new aura::shared::RootWindowEventFilter(root_window); |
657 #if !defined(OS_MACOSX) | 661 #if !defined(OS_MACOSX) |
658 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 662 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
659 accelerator_controller_.reset(new AcceleratorController); | 663 accelerator_controller_.reset(new AcceleratorController); |
660 #endif | 664 #endif |
661 shell_context_menu_.reset(new internal::ShellContextMenu); | 665 shell_context_menu_.reset(new internal::ShellContextMenu); |
662 // Pass ownership of the filter to the root window. | 666 // Pass ownership of the filter to the root window. |
663 GetRootWindow()->SetEventFilter(root_filter_); | 667 GetRootWindow()->SetEventFilter(root_filter_); |
664 | 668 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 759 |
756 drag_drop_controller_.reset(new internal::DragDropController); | 760 drag_drop_controller_.reset(new internal::DragDropController); |
757 magnification_controller_.reset(new internal::MagnificationController); | 761 magnification_controller_.reset(new internal::MagnificationController); |
758 high_contrast_controller_.reset(new HighContrastController); | 762 high_contrast_controller_.reset(new HighContrastController); |
759 power_button_controller_.reset(new PowerButtonController); | 763 power_button_controller_.reset(new PowerButtonController); |
760 AddShellObserver(power_button_controller_.get()); | 764 AddShellObserver(power_button_controller_.get()); |
761 video_detector_.reset(new VideoDetector); | 765 video_detector_.reset(new VideoDetector); |
762 window_cycle_controller_.reset(new WindowCycleController); | 766 window_cycle_controller_.reset(new WindowCycleController); |
763 monitor_controller_.reset(new internal::MonitorController); | 767 monitor_controller_.reset(new internal::MonitorController); |
764 screen_dimmer_.reset(new internal::ScreenDimmer); | 768 screen_dimmer_.reset(new internal::ScreenDimmer); |
765 | |
766 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | |
767 } | 769 } |
768 | 770 |
769 aura::Window* Shell::GetContainer(int container_id) { | 771 aura::Window* Shell::GetContainer(int container_id) { |
770 return const_cast<aura::Window*>( | 772 return const_cast<aura::Window*>( |
771 const_cast<const Shell*>(this)->GetContainer(container_id)); | 773 const_cast<const Shell*>(this)->GetContainer(container_id)); |
772 } | 774 } |
773 | 775 |
774 const aura::Window* Shell::GetContainer(int container_id) const { | 776 const aura::Window* Shell::GetContainer(int container_id) const { |
775 return GetRootWindow()->GetChildById(container_id); | 777 return GetRootWindow()->GetChildById(container_id); |
776 } | 778 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 panel_container->SetLayoutManager(panel_layout_manager_); | 962 panel_container->SetLayoutManager(panel_layout_manager_); |
961 } | 963 } |
962 } | 964 } |
963 | 965 |
964 void Shell::DisableWorkspaceGridLayout() { | 966 void Shell::DisableWorkspaceGridLayout() { |
965 if (workspace_controller_.get()) | 967 if (workspace_controller_.get()) |
966 workspace_controller_->workspace_manager()->set_grid_size(0); | 968 workspace_controller_->workspace_manager()->set_grid_size(0); |
967 } | 969 } |
968 | 970 |
969 } // namespace ash | 971 } // namespace ash |
OLD | NEW |