| 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 24 matching lines...) Expand all Loading... |
| 35 #include "ash/system/tray/system_tray.h" | 35 #include "ash/system/tray/system_tray.h" |
| 36 #include "ash/system/tray/tray_empty.h" | 36 #include "ash/system/tray/tray_empty.h" |
| 37 #include "ash/system/tray_accessibility.h" | 37 #include "ash/system/tray_accessibility.h" |
| 38 #include "ash/system/tray_caps_lock.h" | 38 #include "ash/system/tray_caps_lock.h" |
| 39 #include "ash/system/user/tray_user.h" | 39 #include "ash/system/user/tray_user.h" |
| 40 #include "ash/tooltips/tooltip_controller.h" | 40 #include "ash/tooltips/tooltip_controller.h" |
| 41 #include "ash/wm/activation_controller.h" | 41 #include "ash/wm/activation_controller.h" |
| 42 #include "ash/wm/base_layout_manager.h" | 42 #include "ash/wm/base_layout_manager.h" |
| 43 #include "ash/wm/custom_frame_view_ash.h" | 43 #include "ash/wm/custom_frame_view_ash.h" |
| 44 #include "ash/wm/dialog_frame_view.h" | 44 #include "ash/wm/dialog_frame_view.h" |
| 45 #include "ash/wm/event_client_impl.h" |
| 45 #include "ash/wm/panel_window_event_filter.h" | 46 #include "ash/wm/panel_window_event_filter.h" |
| 46 #include "ash/wm/panel_layout_manager.h" | 47 #include "ash/wm/panel_layout_manager.h" |
| 47 #include "ash/wm/partial_screenshot_event_filter.h" | 48 #include "ash/wm/partial_screenshot_event_filter.h" |
| 48 #include "ash/wm/power_button_controller.h" | 49 #include "ash/wm/power_button_controller.h" |
| 49 #include "ash/wm/resize_shadow_controller.h" | 50 #include "ash/wm/resize_shadow_controller.h" |
| 50 #include "ash/wm/root_window_event_filter.h" | 51 #include "ash/wm/root_window_event_filter.h" |
| 51 #include "ash/wm/root_window_layout_manager.h" | 52 #include "ash/wm/root_window_layout_manager.h" |
| 52 #include "ash/wm/shadow_controller.h" | 53 #include "ash/wm/shadow_controller.h" |
| 53 #include "ash/wm/shelf_layout_manager.h" | 54 #include "ash/wm/shelf_layout_manager.h" |
| 54 #include "ash/wm/stacking_controller.h" | 55 #include "ash/wm/stacking_controller.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 SetChildWindowVisibilityChangesAnimated(modal_container); | 184 SetChildWindowVisibilityChangesAnimated(modal_container); |
| 184 | 185 |
| 185 // TODO(beng): Figure out if we can make this use | 186 // TODO(beng): Figure out if we can make this use |
| 186 // SystemModalContainerEventFilter instead of stops_event_propagation. | 187 // SystemModalContainerEventFilter instead of stops_event_propagation. |
| 187 aura::Window* lock_container = CreateContainer( | 188 aura::Window* lock_container = CreateContainer( |
| 188 internal::kShellWindowId_LockScreenContainer, | 189 internal::kShellWindowId_LockScreenContainer, |
| 189 "LockScreenContainer", | 190 "LockScreenContainer", |
| 190 lock_screen_containers); | 191 lock_screen_containers); |
| 191 lock_container->SetLayoutManager( | 192 lock_container->SetLayoutManager( |
| 192 new internal::BaseLayoutManager(root_window)); | 193 new internal::BaseLayoutManager(root_window)); |
| 193 lock_container->set_stops_event_propagation(true); | 194 // TODO(beng): stopsevents |
| 194 | 195 |
| 195 aura::Window* lock_modal_container = CreateContainer( | 196 aura::Window* lock_modal_container = CreateContainer( |
| 196 internal::kShellWindowId_LockSystemModalContainer, | 197 internal::kShellWindowId_LockSystemModalContainer, |
| 197 "LockSystemModalContainer", | 198 "LockSystemModalContainer", |
| 198 lock_screen_containers); | 199 lock_screen_containers); |
| 199 lock_modal_container->SetEventFilter( | 200 lock_modal_container->SetEventFilter( |
| 200 new ToplevelWindowEventFilter(lock_modal_container)); | 201 new ToplevelWindowEventFilter(lock_modal_container)); |
| 201 lock_modal_container->SetLayoutManager( | 202 lock_modal_container->SetLayoutManager( |
| 202 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 203 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
| 203 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 204 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 538 } |
| 538 | 539 |
| 539 // These need a valid Shell instance to clean up properly, so explicitly | 540 // These need a valid Shell instance to clean up properly, so explicitly |
| 540 // delete them before invalidating the instance. | 541 // delete them before invalidating the instance. |
| 541 // Alphabetical. | 542 // Alphabetical. |
| 542 activation_controller_.reset(); | 543 activation_controller_.reset(); |
| 543 drag_drop_controller_.reset(); | 544 drag_drop_controller_.reset(); |
| 544 resize_shadow_controller_.reset(); | 545 resize_shadow_controller_.reset(); |
| 545 shadow_controller_.reset(); | 546 shadow_controller_.reset(); |
| 546 window_cycle_controller_.reset(); | 547 window_cycle_controller_.reset(); |
| 548 event_client_.reset(); |
| 549 monitor_controller_.reset(); |
| 547 | 550 |
| 548 // Launcher widget has a InputMethodBridge that references to | 551 // Launcher widget has a InputMethodBridge that references to |
| 549 // input_method_filter_'s input_method_. So explicitly release launcher_ | 552 // input_method_filter_'s input_method_. So explicitly release launcher_ |
| 550 // before input_method_filter_. And this needs to be after we delete all | 553 // before input_method_filter_. And this needs to be after we delete all |
| 551 // containers in case there are still live browser windows which access | 554 // containers in case there are still live browser windows which access |
| 552 // LauncherModel during close. | 555 // LauncherModel during close. |
| 553 launcher_.reset(); | 556 launcher_.reset(); |
| 554 | 557 |
| 555 DCHECK(instance_ == this); | 558 DCHECK(instance_ == this); |
| 556 instance_ = NULL; | 559 instance_ = NULL; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 625 |
| 623 activation_controller_.reset(new internal::ActivationController); | 626 activation_controller_.reset(new internal::ActivationController); |
| 624 | 627 |
| 625 CreateSpecialContainers(root_window); | 628 CreateSpecialContainers(root_window); |
| 626 | 629 |
| 627 stacking_controller_.reset(new internal::StackingController); | 630 stacking_controller_.reset(new internal::StackingController); |
| 628 | 631 |
| 629 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 632 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
| 630 root_window->SetLayoutManager(root_window_layout_); | 633 root_window->SetLayoutManager(root_window_layout_); |
| 631 | 634 |
| 635 event_client_.reset(new internal::EventClientImpl(root_window)); |
| 636 |
| 632 if (delegate_.get()) | 637 if (delegate_.get()) |
| 633 status_widget_ = delegate_->CreateStatusArea(); | 638 status_widget_ = delegate_->CreateStatusArea(); |
| 634 | 639 |
| 635 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 640 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 636 if (!command_line->HasSwitch(switches::kDisableAshUberTray)) { | 641 if (!command_line->HasSwitch(switches::kDisableAshUberTray)) { |
| 637 // TODO(sad): This is rather ugly at the moment. This is because we are | 642 // TODO(sad): This is rather ugly at the moment. This is because we are |
| 638 // supporting both the old and the new status bar at the same time. This | 643 // supporting both the old and the new status bar at the same time. This |
| 639 // will soon get better once the new one is ready and the old one goes out | 644 // will soon get better once the new one is ready and the old one goes out |
| 640 // the door. | 645 // the door. |
| 641 tray_.reset(new SystemTray()); | 646 tray_.reset(new SystemTray()); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 workspace_controller_->ShowMenu(widget, location); | 764 workspace_controller_->ShowMenu(widget, location); |
| 760 } | 765 } |
| 761 | 766 |
| 762 void Shell::ToggleAppList() { | 767 void Shell::ToggleAppList() { |
| 763 if (!app_list_.get()) | 768 if (!app_list_.get()) |
| 764 app_list_.reset(new internal::AppList); | 769 app_list_.reset(new internal::AppList); |
| 765 app_list_->SetVisible(!app_list_->IsVisible()); | 770 app_list_->SetVisible(!app_list_->IsVisible()); |
| 766 } | 771 } |
| 767 | 772 |
| 768 bool Shell::IsScreenLocked() const { | 773 bool Shell::IsScreenLocked() const { |
| 769 const aura::Window* lock_screen_container = GetContainer( | 774 return !delegate_.get() || delegate_->IsScreenLocked(); |
| 770 internal::kShellWindowId_LockScreenContainer); | |
| 771 return lock_screen_container->StopsEventPropagation(); | |
| 772 } | 775 } |
| 773 | 776 |
| 774 bool Shell::IsModalWindowOpen() const { | 777 bool Shell::IsModalWindowOpen() const { |
| 775 const aura::Window* modal_container = GetContainer( | 778 const aura::Window* modal_container = GetContainer( |
| 776 internal::kShellWindowId_SystemModalContainer); | 779 internal::kShellWindowId_SystemModalContainer); |
| 777 return !modal_container->children().empty(); | 780 return !modal_container->children().empty(); |
| 778 } | 781 } |
| 779 | 782 |
| 780 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( | 783 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( |
| 781 views::Widget* widget) { | 784 views::Widget* widget) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 desktop_background_controller_->SetDesktopBackgroundImageMode( | 867 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 865 GetWallpaper(index), GetWallpaperInfo(index).layout); | 868 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 866 } | 869 } |
| 867 | 870 |
| 868 void Shell::DisableWorkspaceGridLayout() { | 871 void Shell::DisableWorkspaceGridLayout() { |
| 869 if (workspace_controller_.get()) | 872 if (workspace_controller_.get()) |
| 870 workspace_controller_->workspace_manager()->set_grid_size(0); | 873 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 871 } | 874 } |
| 872 | 875 |
| 873 } // namespace ash | 876 } // namespace ash |
| OLD | NEW |