Chromium Code Reviews| 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_AppListContainer, | 166 CreateContainer(internal::kShellWindowId_AppListContainer, |
| 176 "AppListContainer", | 167 "AppListContainer", |
| 177 non_lock_screen_containers); | 168 non_lock_screen_containers); |
| 178 | 169 |
| 179 CreateContainer(internal::kShellWindowId_LauncherContainer, | 170 CreateContainer(internal::kShellWindowId_LauncherContainer, |
| 180 "LauncherContainer", | 171 "LauncherContainer", |
| 181 non_lock_screen_containers); | 172 non_lock_screen_containers); |
| 182 | 173 |
| 183 aura::Window* modal_container = CreateContainer( | 174 aura::Window* modal_container = CreateContainer( |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 756 | 747 |
| 757 tooltip_controller_.reset(new internal::TooltipController); | 748 tooltip_controller_.reset(new internal::TooltipController); |
| 758 AddRootWindowEventFilter(tooltip_controller_.get()); | 749 AddRootWindowEventFilter(tooltip_controller_.get()); |
| 759 | 750 |
| 760 drag_drop_controller_.reset(new internal::DragDropController); | 751 drag_drop_controller_.reset(new internal::DragDropController); |
| 761 power_button_controller_.reset(new PowerButtonController); | 752 power_button_controller_.reset(new PowerButtonController); |
| 762 video_detector_.reset(new VideoDetector); | 753 video_detector_.reset(new VideoDetector); |
| 763 window_cycle_controller_.reset(new WindowCycleController); | 754 window_cycle_controller_.reset(new WindowCycleController); |
| 764 monitor_controller_.reset(new internal::MonitorController); | 755 monitor_controller_.reset(new internal::MonitorController); |
| 765 } | 756 } |
| 766 | 757 |
|
sky
2012/04/03 20:39:37
Remove this line.
| |
| 758 | |
| 767 aura::Window* Shell::GetContainer(int container_id) { | 759 aura::Window* Shell::GetContainer(int container_id) { |
| 768 return const_cast<aura::Window*>( | 760 return const_cast<aura::Window*>( |
| 769 const_cast<const Shell*>(this)->GetContainer(container_id)); | 761 const_cast<const Shell*>(this)->GetContainer(container_id)); |
| 770 } | 762 } |
| 771 | 763 |
| 772 const aura::Window* Shell::GetContainer(int container_id) const { | 764 const aura::Window* Shell::GetContainer(int container_id) const { |
| 773 return GetRootWindow()->GetChildById(container_id); | 765 return GetRootWindow()->GetChildById(container_id); |
| 774 } | 766 } |
| 775 | 767 |
| 776 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { | 768 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 void Shell::CreateLauncher() { | 838 void Shell::CreateLauncher() { |
| 847 if (launcher_.get()) | 839 if (launcher_.get()) |
| 848 return; | 840 return; |
| 849 | 841 |
| 850 aura::Window* default_container = | 842 aura::Window* default_container = |
| 851 GetContainer(internal::kShellWindowId_DefaultContainer); | 843 GetContainer(internal::kShellWindowId_DefaultContainer); |
| 852 launcher_.reset(new Launcher(default_container)); | 844 launcher_.reset(new Launcher(default_container)); |
| 853 | 845 |
| 854 launcher_->SetFocusCycler(focus_cycler_.get()); | 846 launcher_->SetFocusCycler(focus_cycler_.get()); |
| 855 shelf_->SetLauncher(launcher_.get()); | 847 shelf_->SetLauncher(launcher_.get()); |
| 848 if (panel_layout_manager_ != NULL) | |
| 849 panel_layout_manager_->SetLauncher(launcher_.get()); | |
| 856 | 850 |
| 857 launcher_->widget()->Show(); | 851 launcher_->widget()->Show(); |
| 858 } | 852 } |
| 859 | 853 |
| 860 void Shell::AddShellObserver(ShellObserver* observer) { | 854 void Shell::AddShellObserver(ShellObserver* observer) { |
| 861 observers_.AddObserver(observer); | 855 observers_.AddObserver(observer); |
| 862 } | 856 } |
| 863 | 857 |
| 864 void Shell::RemoveShellObserver(ShellObserver* observer) { | 858 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 865 observers_.RemoveObserver(observer); | 859 observers_.RemoveObserver(observer); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 always_on_top_container->SetLayoutManager( | 907 always_on_top_container->SetLayoutManager( |
| 914 new internal::AlwaysOnTopLayoutManager( | 908 new internal::AlwaysOnTopLayoutManager( |
| 915 always_on_top_container->GetRootWindow())); | 909 always_on_top_container->GetRootWindow())); |
| 916 | 910 |
| 917 // Create desktop background widget. | 911 // Create desktop background widget. |
| 918 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function | 912 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function |
| 919 // here after issue 117244 got fixed. | 913 // here after issue 117244 got fixed. |
| 920 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); | 914 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); |
| 921 desktop_background_controller_->SetDesktopBackgroundImageMode( | 915 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 922 GetWallpaper(index), GetWallpaperInfo(index).layout); | 916 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 917 | |
| 918 // Create Panel layout manager | |
| 919 if (CommandLine::ForCurrentProcess()-> | |
| 920 HasSwitch(switches::kAuraPanelManager)) { | |
| 921 aura::Window* panel_container = GetContainer( | |
| 922 internal::kShellWindowId_PanelContainer); | |
| 923 panel_layout_manager_ = | |
| 924 new internal::PanelLayoutManager(panel_container); | |
| 925 panel_container->SetEventFilter( | |
| 926 new internal::PanelWindowEventFilter( | |
| 927 panel_container, panel_layout_manager_)); | |
| 928 panel_container->SetLayoutManager(panel_layout_manager_); | |
| 929 } | |
| 923 } | 930 } |
| 924 | 931 |
| 925 void Shell::DisableWorkspaceGridLayout() { | 932 void Shell::DisableWorkspaceGridLayout() { |
| 926 if (workspace_controller_.get()) | 933 if (workspace_controller_.get()) |
| 927 workspace_controller_->workspace_manager()->set_grid_size(0); | 934 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 928 } | 935 } |
| 929 | 936 |
| 930 } // namespace ash | 937 } // namespace ash |
| OLD | NEW |