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 | 8 |
9 #include "ash/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SetChildWindowVisibilityChangesAnimated(default_container); | 152 SetChildWindowVisibilityChangesAnimated(default_container); |
153 | 153 |
154 aura::Window* always_on_top_container = CreateContainer( | 154 aura::Window* always_on_top_container = CreateContainer( |
155 internal::kShellWindowId_AlwaysOnTopContainer, | 155 internal::kShellWindowId_AlwaysOnTopContainer, |
156 "AlwaysOnTopContainer", | 156 "AlwaysOnTopContainer", |
157 non_lock_screen_containers); | 157 non_lock_screen_containers); |
158 always_on_top_container->SetEventFilter( | 158 always_on_top_container->SetEventFilter( |
159 new ToplevelWindowEventFilter(always_on_top_container)); | 159 new ToplevelWindowEventFilter(always_on_top_container)); |
160 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 160 SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
161 | 161 |
162 aura::Window* panel_container = CreateContainer( | 162 CreateContainer(internal::kShellWindowId_PanelContainer, |
163 internal::kShellWindowId_PanelContainer, | 163 "PanelContainer", |
164 "PanelContainer", | 164 non_lock_screen_containers); |
165 non_lock_screen_containers); | |
166 if (CommandLine::ForCurrentProcess()-> | |
167 HasSwitch(switches::kAuraPanelManager)) { | |
168 internal::PanelLayoutManager* layout_manager = | |
169 new internal::PanelLayoutManager(panel_container); | |
170 panel_container->SetEventFilter( | |
171 new internal::PanelWindowEventFilter(panel_container, layout_manager)); | |
172 panel_container->SetLayoutManager(layout_manager); | |
173 } | |
174 | 165 |
175 CreateContainer(internal::kShellWindowId_LauncherContainer, | 166 CreateContainer(internal::kShellWindowId_LauncherContainer, |
176 "LauncherContainer", | 167 "LauncherContainer", |
177 non_lock_screen_containers); | 168 non_lock_screen_containers); |
178 | 169 |
179 aura::Window* modal_container = CreateContainer( | 170 aura::Window* modal_container = CreateContainer( |
180 internal::kShellWindowId_SystemModalContainer, | 171 internal::kShellWindowId_SystemModalContainer, |
181 "SystemModalContainer", | 172 "SystemModalContainer", |
182 non_lock_screen_containers); | 173 non_lock_screen_containers); |
183 modal_container->SetEventFilter( | 174 modal_container->SetEventFilter( |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 tooltip_controller_.reset(new internal::TooltipController); | 723 tooltip_controller_.reset(new internal::TooltipController); |
733 AddRootWindowEventFilter(tooltip_controller_.get()); | 724 AddRootWindowEventFilter(tooltip_controller_.get()); |
734 | 725 |
735 drag_drop_controller_.reset(new internal::DragDropController); | 726 drag_drop_controller_.reset(new internal::DragDropController); |
736 power_button_controller_.reset(new PowerButtonController); | 727 power_button_controller_.reset(new PowerButtonController); |
737 video_detector_.reset(new VideoDetector); | 728 video_detector_.reset(new VideoDetector); |
738 window_cycle_controller_.reset(new WindowCycleController); | 729 window_cycle_controller_.reset(new WindowCycleController); |
739 monitor_controller_.reset(new internal::MonitorController); | 730 monitor_controller_.reset(new internal::MonitorController); |
740 } | 731 } |
741 | 732 |
| 733 |
742 aura::Window* Shell::GetContainer(int container_id) { | 734 aura::Window* Shell::GetContainer(int container_id) { |
743 return const_cast<aura::Window*>( | 735 return const_cast<aura::Window*>( |
744 const_cast<const Shell*>(this)->GetContainer(container_id)); | 736 const_cast<const Shell*>(this)->GetContainer(container_id)); |
745 } | 737 } |
746 | 738 |
747 const aura::Window* Shell::GetContainer(int container_id) const { | 739 const aura::Window* Shell::GetContainer(int container_id) const { |
748 return GetRootWindow()->GetChildById(container_id); | 740 return GetRootWindow()->GetChildById(container_id); |
749 } | 741 } |
750 | 742 |
751 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { | 743 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 void Shell::CreateLauncher() { | 811 void Shell::CreateLauncher() { |
820 if (launcher_.get()) | 812 if (launcher_.get()) |
821 return; | 813 return; |
822 | 814 |
823 aura::Window* default_container = | 815 aura::Window* default_container = |
824 GetContainer(internal::kShellWindowId_DefaultContainer); | 816 GetContainer(internal::kShellWindowId_DefaultContainer); |
825 launcher_.reset(new Launcher(default_container)); | 817 launcher_.reset(new Launcher(default_container)); |
826 | 818 |
827 launcher_->SetFocusCycler(focus_cycler_.get()); | 819 launcher_->SetFocusCycler(focus_cycler_.get()); |
828 shelf_->SetLauncher(launcher_.get()); | 820 shelf_->SetLauncher(launcher_.get()); |
| 821 if (panel_layout_manager_ != NULL) |
| 822 panel_layout_manager_->SetLauncher(launcher_.get()); |
829 | 823 |
830 launcher_->widget()->Show(); | 824 launcher_->widget()->Show(); |
831 } | 825 } |
832 | 826 |
833 void Shell::AddShellObserver(ShellObserver* observer) { | 827 void Shell::AddShellObserver(ShellObserver* observer) { |
834 observers_.AddObserver(observer); | 828 observers_.AddObserver(observer); |
835 } | 829 } |
836 | 830 |
837 void Shell::RemoveShellObserver(ShellObserver* observer) { | 831 void Shell::RemoveShellObserver(ShellObserver* observer) { |
838 observers_.RemoveObserver(observer); | 832 observers_.RemoveObserver(observer); |
(...skipping 27 matching lines...) Expand all Loading... |
866 workspace_controller_.reset( | 860 workspace_controller_.reset( |
867 new internal::WorkspaceController(default_container)); | 861 new internal::WorkspaceController(default_container)); |
868 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); | 862 workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); |
869 | 863 |
870 // Create desktop background widget. | 864 // Create desktop background widget. |
871 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function | 865 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function |
872 // here after issue 117244 got fixed. | 866 // here after issue 117244 got fixed. |
873 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); | 867 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); |
874 desktop_background_controller_->SetDesktopBackgroundImageMode( | 868 desktop_background_controller_->SetDesktopBackgroundImageMode( |
875 GetWallpaper(index), GetWallpaperInfo(index).layout); | 869 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 870 |
| 871 // Create Panel layout manager |
| 872 if (CommandLine::ForCurrentProcess()-> |
| 873 HasSwitch(switches::kAuraPanelManager)) { |
| 874 aura::Window* panel_container = GetContainer( |
| 875 internal::kShellWindowId_PanelContainer); |
| 876 panel_layout_manager_ = |
| 877 new internal::PanelLayoutManager(panel_container); |
| 878 panel_container->SetEventFilter( |
| 879 new internal::PanelWindowEventFilter( |
| 880 panel_container, panel_layout_manager_)); |
| 881 panel_container->SetLayoutManager(panel_layout_manager_); |
| 882 } |
876 } | 883 } |
877 | 884 |
878 void Shell::DisableWorkspaceGridLayout() { | 885 void Shell::DisableWorkspaceGridLayout() { |
879 if (workspace_controller_.get()) | 886 if (workspace_controller_.get()) |
880 workspace_controller_->workspace_manager()->set_grid_size(0); | 887 workspace_controller_->workspace_manager()->set_grid_size(0); |
881 } | 888 } |
882 | 889 |
883 } // namespace ash | 890 } // namespace ash |
OLD | NEW |