| 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 19 matching lines...) Expand all Loading... |
| 30 #include "ash/system/tray/system_tray.h" | 30 #include "ash/system/tray/system_tray.h" |
| 31 #include "ash/system/tray/tray_empty.h" | 31 #include "ash/system/tray/tray_empty.h" |
| 32 #include "ash/system/tray_accessibility.h" | 32 #include "ash/system/tray_accessibility.h" |
| 33 #include "ash/system/tray_caps_lock.h" | 33 #include "ash/system/tray_caps_lock.h" |
| 34 #include "ash/system/user/tray_user.h" | 34 #include "ash/system/user/tray_user.h" |
| 35 #include "ash/tooltips/tooltip_controller.h" | 35 #include "ash/tooltips/tooltip_controller.h" |
| 36 #include "ash/wm/activation_controller.h" | 36 #include "ash/wm/activation_controller.h" |
| 37 #include "ash/wm/base_layout_manager.h" | 37 #include "ash/wm/base_layout_manager.h" |
| 38 #include "ash/wm/custom_frame_view_ash.h" | 38 #include "ash/wm/custom_frame_view_ash.h" |
| 39 #include "ash/wm/dialog_frame_view.h" | 39 #include "ash/wm/dialog_frame_view.h" |
| 40 #include "ash/wm/event_client_impl.h" |
| 40 #include "ash/wm/panel_window_event_filter.h" | 41 #include "ash/wm/panel_window_event_filter.h" |
| 41 #include "ash/wm/panel_layout_manager.h" | 42 #include "ash/wm/panel_layout_manager.h" |
| 42 #include "ash/wm/partial_screenshot_event_filter.h" | 43 #include "ash/wm/partial_screenshot_event_filter.h" |
| 43 #include "ash/wm/power_button_controller.h" | 44 #include "ash/wm/power_button_controller.h" |
| 44 #include "ash/wm/resize_shadow_controller.h" | 45 #include "ash/wm/resize_shadow_controller.h" |
| 45 #include "ash/wm/root_window_event_filter.h" | 46 #include "ash/wm/root_window_event_filter.h" |
| 46 #include "ash/wm/root_window_layout_manager.h" | 47 #include "ash/wm/root_window_layout_manager.h" |
| 47 #include "ash/wm/shadow_controller.h" | 48 #include "ash/wm/shadow_controller.h" |
| 48 #include "ash/wm/shelf_layout_manager.h" | 49 #include "ash/wm/shelf_layout_manager.h" |
| 49 #include "ash/wm/stacking_controller.h" | 50 #include "ash/wm/stacking_controller.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 SetChildWindowVisibilityChangesAnimated(modal_container); | 179 SetChildWindowVisibilityChangesAnimated(modal_container); |
| 179 | 180 |
| 180 // TODO(beng): Figure out if we can make this use | 181 // TODO(beng): Figure out if we can make this use |
| 181 // SystemModalContainerEventFilter instead of stops_event_propagation. | 182 // SystemModalContainerEventFilter instead of stops_event_propagation. |
| 182 aura::Window* lock_container = CreateContainer( | 183 aura::Window* lock_container = CreateContainer( |
| 183 internal::kShellWindowId_LockScreenContainer, | 184 internal::kShellWindowId_LockScreenContainer, |
| 184 "LockScreenContainer", | 185 "LockScreenContainer", |
| 185 lock_screen_containers); | 186 lock_screen_containers); |
| 186 lock_container->SetLayoutManager( | 187 lock_container->SetLayoutManager( |
| 187 new internal::BaseLayoutManager(root_window)); | 188 new internal::BaseLayoutManager(root_window)); |
| 188 lock_container->set_stops_event_propagation(true); | 189 // TODO(beng): stopsevents |
| 189 | 190 |
| 190 aura::Window* lock_modal_container = CreateContainer( | 191 aura::Window* lock_modal_container = CreateContainer( |
| 191 internal::kShellWindowId_LockSystemModalContainer, | 192 internal::kShellWindowId_LockSystemModalContainer, |
| 192 "LockSystemModalContainer", | 193 "LockSystemModalContainer", |
| 193 lock_screen_containers); | 194 lock_screen_containers); |
| 194 lock_modal_container->SetEventFilter( | 195 lock_modal_container->SetEventFilter( |
| 195 new ToplevelWindowEventFilter(lock_modal_container)); | 196 new ToplevelWindowEventFilter(lock_modal_container)); |
| 196 lock_modal_container->SetLayoutManager( | 197 lock_modal_container->SetLayoutManager( |
| 197 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 198 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
| 198 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 199 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 451 } |
| 451 | 452 |
| 452 // These need a valid Shell instance to clean up properly, so explicitly | 453 // These need a valid Shell instance to clean up properly, so explicitly |
| 453 // delete them before invalidating the instance. | 454 // delete them before invalidating the instance. |
| 454 // Alphabetical. | 455 // Alphabetical. |
| 455 activation_controller_.reset(); | 456 activation_controller_.reset(); |
| 456 drag_drop_controller_.reset(); | 457 drag_drop_controller_.reset(); |
| 457 resize_shadow_controller_.reset(); | 458 resize_shadow_controller_.reset(); |
| 458 shadow_controller_.reset(); | 459 shadow_controller_.reset(); |
| 459 window_cycle_controller_.reset(); | 460 window_cycle_controller_.reset(); |
| 461 event_client_.reset(); |
| 460 | 462 |
| 461 // Launcher widget has a InputMethodBridge that references to | 463 // Launcher widget has a InputMethodBridge that references to |
| 462 // input_method_filter_'s input_method_. So explicitly release launcher_ | 464 // input_method_filter_'s input_method_. So explicitly release launcher_ |
| 463 // before input_method_filter_. And this needs to be after we delete all | 465 // before input_method_filter_. And this needs to be after we delete all |
| 464 // containers in case there are still live browser windows which access | 466 // containers in case there are still live browser windows which access |
| 465 // LauncherModel during close. | 467 // LauncherModel during close. |
| 466 launcher_.reset(); | 468 launcher_.reset(); |
| 467 | 469 |
| 468 DCHECK(instance_ == this); | 470 DCHECK(instance_ == this); |
| 469 instance_ = NULL; | 471 instance_ = NULL; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 535 |
| 534 activation_controller_.reset(new internal::ActivationController); | 536 activation_controller_.reset(new internal::ActivationController); |
| 535 | 537 |
| 536 CreateSpecialContainers(root_window); | 538 CreateSpecialContainers(root_window); |
| 537 | 539 |
| 538 stacking_controller_.reset(new internal::StackingController); | 540 stacking_controller_.reset(new internal::StackingController); |
| 539 | 541 |
| 540 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 542 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 541 root_window->SetLayoutManager(root_window_layout_); | 543 root_window->SetLayoutManager(root_window_layout_); |
| 542 | 544 |
| 545 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 546 |
| 543 if (delegate_.get()) | 547 if (delegate_.get()) |
| 544 status_widget_ = delegate_->CreateStatusArea(); | 548 status_widget_ = delegate_->CreateStatusArea(); |
| 545 | 549 |
| 546 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 550 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 547 if (!command_line->HasSwitch(switches::kDisableAshUberTray)) { | 551 if (!command_line->HasSwitch(switches::kDisableAshUberTray)) { |
| 548 // TODO(sad): This is rather ugly at the moment. This is because we are | 552 // TODO(sad): This is rather ugly at the moment. This is because we are |
| 549 // supporting both the old and the new status bar at the same time. This | 553 // supporting both the old and the new status bar at the same time. This |
| 550 // will soon get better once the new one is ready and the old one goes out | 554 // will soon get better once the new one is ready and the old one goes out |
| 551 // the door. | 555 // the door. |
| 552 tray_.reset(new SystemTray()); | 556 tray_.reset(new SystemTray()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 workspace_controller_->ShowMenu(widget, location); | 662 workspace_controller_->ShowMenu(widget, location); |
| 659 } | 663 } |
| 660 | 664 |
| 661 void Shell::ToggleAppList() { | 665 void Shell::ToggleAppList() { |
| 662 if (!app_list_.get()) | 666 if (!app_list_.get()) |
| 663 app_list_.reset(new internal::AppList); | 667 app_list_.reset(new internal::AppList); |
| 664 app_list_->SetVisible(!app_list_->IsVisible()); | 668 app_list_->SetVisible(!app_list_->IsVisible()); |
| 665 } | 669 } |
| 666 | 670 |
| 667 bool Shell::IsScreenLocked() const { | 671 bool Shell::IsScreenLocked() const { |
| 668 const aura::Window* lock_screen_container = GetContainer( | 672 return !delegate_.get() || delegate_->IsScreenLocked(); |
| 669 internal::kShellWindowId_LockScreenContainer); | |
| 670 return lock_screen_container->StopsEventPropagation(); | |
| 671 } | 673 } |
| 672 | 674 |
| 673 bool Shell::IsModalWindowOpen() const { | 675 bool Shell::IsModalWindowOpen() const { |
| 674 const aura::Window* modal_container = GetContainer( | 676 const aura::Window* modal_container = GetContainer( |
| 675 internal::kShellWindowId_SystemModalContainer); | 677 internal::kShellWindowId_SystemModalContainer); |
| 676 return !modal_container->children().empty(); | 678 return !modal_container->children().empty(); |
| 677 } | 679 } |
| 678 | 680 |
| 679 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( | 681 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( |
| 680 views::Widget* widget) { | 682 views::Widget* widget) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Create the desktop background image. | 758 // Create the desktop background image. |
| 757 desktop_background_controller_->SetDefaultDesktopBackgroundImage(); | 759 desktop_background_controller_->SetDefaultDesktopBackgroundImage(); |
| 758 } | 760 } |
| 759 | 761 |
| 760 void Shell::DisableWorkspaceGridLayout() { | 762 void Shell::DisableWorkspaceGridLayout() { |
| 761 if (workspace_controller_.get()) | 763 if (workspace_controller_.get()) |
| 762 workspace_controller_->workspace_manager()->set_grid_size(0); | 764 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 763 } | 765 } |
| 764 | 766 |
| 765 } // namespace ash | 767 } // namespace ash |
| OLD | NEW |