| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 SetChildWindowVisibilityChangesAnimated(default_container); | 153 SetChildWindowVisibilityChangesAnimated(default_container); |
| 154 | 154 |
| 155 aura::Window* always_on_top_container = CreateContainer( | 155 aura::Window* always_on_top_container = CreateContainer( |
| 156 internal::kShellWindowId_AlwaysOnTopContainer, | 156 internal::kShellWindowId_AlwaysOnTopContainer, |
| 157 "AlwaysOnTopContainer", | 157 "AlwaysOnTopContainer", |
| 158 non_lock_screen_containers); | 158 non_lock_screen_containers); |
| 159 always_on_top_container->SetEventFilter( | 159 always_on_top_container->SetEventFilter( |
| 160 new ToplevelWindowEventFilter(always_on_top_container)); | 160 new ToplevelWindowEventFilter(always_on_top_container)); |
| 161 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 161 SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
| 162 | 162 |
| 163 aura::Window* panel_container = CreateContainer( | 163 CreateContainer(internal::kShellWindowId_PanelContainer, |
| 164 internal::kShellWindowId_PanelContainer, | 164 "PanelContainer", |
| 165 "PanelContainer", | 165 non_lock_screen_containers); |
| 166 non_lock_screen_containers); | |
| 167 if (CommandLine::ForCurrentProcess()-> | |
| 168 HasSwitch(switches::kAuraPanelManager)) { | |
| 169 internal::PanelLayoutManager* layout_manager = | |
| 170 new internal::PanelLayoutManager(panel_container); | |
| 171 panel_container->SetEventFilter( | |
| 172 new internal::PanelWindowEventFilter(panel_container, layout_manager)); | |
| 173 panel_container->SetLayoutManager(layout_manager); | |
| 174 } | |
| 175 | 166 |
| 176 CreateContainer(internal::kShellWindowId_AppListContainer, | 167 CreateContainer(internal::kShellWindowId_AppListContainer, |
| 177 "AppListContainer", | 168 "AppListContainer", |
| 178 non_lock_screen_containers); | 169 non_lock_screen_containers); |
| 179 | 170 |
| 180 CreateContainer(internal::kShellWindowId_LauncherContainer, | 171 CreateContainer(internal::kShellWindowId_LauncherContainer, |
| 181 "LauncherContainer", | 172 "LauncherContainer", |
| 182 non_lock_screen_containers); | 173 non_lock_screen_containers); |
| 183 | 174 |
| 184 aura::Window* modal_container = CreateContainer( | 175 aura::Window* modal_container = CreateContainer( |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 514 |
| 524 //////////////////////////////////////////////////////////////////////////////// | 515 //////////////////////////////////////////////////////////////////////////////// |
| 525 // Shell, public: | 516 // Shell, public: |
| 526 | 517 |
| 527 Shell::Shell(ShellDelegate* delegate) | 518 Shell::Shell(ShellDelegate* delegate) |
| 528 : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), | 519 : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), |
| 529 screen_(new ScreenAsh(root_window_.get())), | 520 screen_(new ScreenAsh(root_window_.get())), |
| 530 root_filter_(NULL), | 521 root_filter_(NULL), |
| 531 delegate_(delegate), | 522 delegate_(delegate), |
| 532 shelf_(NULL), | 523 shelf_(NULL), |
| 524 panel_layout_manager_(NULL), |
| 533 root_window_layout_(NULL), | 525 root_window_layout_(NULL), |
| 534 status_widget_(NULL) { | 526 status_widget_(NULL) { |
| 535 gfx::Screen::SetInstance(screen_); | 527 gfx::Screen::SetInstance(screen_); |
| 536 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); | 528 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); |
| 537 } | 529 } |
| 538 | 530 |
| 539 Shell::~Shell() { | 531 Shell::~Shell() { |
| 540 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); | 532 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
| 541 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 533 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 542 RemoveRootWindowEventFilter(input_method_filter_.get()); | 534 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 void Shell::CreateLauncher() { | 856 void Shell::CreateLauncher() { |
| 865 if (launcher_.get()) | 857 if (launcher_.get()) |
| 866 return; | 858 return; |
| 867 | 859 |
| 868 aura::Window* default_container = | 860 aura::Window* default_container = |
| 869 GetContainer(internal::kShellWindowId_DefaultContainer); | 861 GetContainer(internal::kShellWindowId_DefaultContainer); |
| 870 launcher_.reset(new Launcher(default_container)); | 862 launcher_.reset(new Launcher(default_container)); |
| 871 | 863 |
| 872 launcher_->SetFocusCycler(focus_cycler_.get()); | 864 launcher_->SetFocusCycler(focus_cycler_.get()); |
| 873 shelf_->SetLauncher(launcher_.get()); | 865 shelf_->SetLauncher(launcher_.get()); |
| 866 if (panel_layout_manager_ != NULL) |
| 867 panel_layout_manager_->SetLauncher(launcher_.get()); |
| 874 | 868 |
| 875 launcher_->widget()->Show(); | 869 launcher_->widget()->Show(); |
| 876 } | 870 } |
| 877 | 871 |
| 878 void Shell::AddShellObserver(ShellObserver* observer) { | 872 void Shell::AddShellObserver(ShellObserver* observer) { |
| 879 observers_.AddObserver(observer); | 873 observers_.AddObserver(observer); |
| 880 } | 874 } |
| 881 | 875 |
| 882 void Shell::RemoveShellObserver(ShellObserver* observer) { | 876 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 883 observers_.RemoveObserver(observer); | 877 observers_.RemoveObserver(observer); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 always_on_top_container->SetLayoutManager( | 925 always_on_top_container->SetLayoutManager( |
| 932 new internal::AlwaysOnTopLayoutManager( | 926 new internal::AlwaysOnTopLayoutManager( |
| 933 always_on_top_container->GetRootWindow())); | 927 always_on_top_container->GetRootWindow())); |
| 934 | 928 |
| 935 // Create desktop background widget. | 929 // Create desktop background widget. |
| 936 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function | 930 // TODO(bshe): We should be able to use OnDesktopBackgroundChanged function |
| 937 // here after issue 117244 got fixed. | 931 // here after issue 117244 got fixed. |
| 938 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); | 932 int index = user_wallpaper_delegate_->GetUserWallpaperIndex(); |
| 939 desktop_background_controller_->SetDesktopBackgroundImageMode( | 933 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 940 GetWallpaper(index), GetWallpaperInfo(index).layout); | 934 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 935 |
| 936 // Create Panel layout manager |
| 937 if (CommandLine::ForCurrentProcess()-> |
| 938 HasSwitch(switches::kAuraPanelManager)) { |
| 939 aura::Window* panel_container = GetContainer( |
| 940 internal::kShellWindowId_PanelContainer); |
| 941 panel_layout_manager_ = |
| 942 new internal::PanelLayoutManager(panel_container); |
| 943 panel_container->SetEventFilter( |
| 944 new internal::PanelWindowEventFilter( |
| 945 panel_container, panel_layout_manager_)); |
| 946 panel_container->SetLayoutManager(panel_layout_manager_); |
| 947 } |
| 941 } | 948 } |
| 942 | 949 |
| 943 void Shell::DisableWorkspaceGridLayout() { | 950 void Shell::DisableWorkspaceGridLayout() { |
| 944 if (workspace_controller_.get()) | 951 if (workspace_controller_.get()) |
| 945 workspace_controller_->workspace_manager()->set_grid_size(0); | 952 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 946 } | 953 } |
| 947 | 954 |
| 948 } // namespace ash | 955 } // namespace ash |
| OLD | NEW |