| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #include "ui/ui_controls/ui_controls.h" | 83 #include "ui/ui_controls/ui_controls.h" |
| 84 #include "ui/views/widget/native_widget_aura.h" | 84 #include "ui/views/widget/native_widget_aura.h" |
| 85 #include "ui/views/widget/widget.h" | 85 #include "ui/views/widget/widget.h" |
| 86 | 86 |
| 87 #if !defined(OS_MACOSX) | 87 #if !defined(OS_MACOSX) |
| 88 #include "ash/accelerators/accelerator_controller.h" | 88 #include "ash/accelerators/accelerator_controller.h" |
| 89 #include "ash/accelerators/accelerator_filter.h" | 89 #include "ash/accelerators/accelerator_filter.h" |
| 90 #include "ash/accelerators/nested_dispatcher_controller.h" | 90 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 #if defined(USE_X11) |
| 94 #include "ui/aura/monitor_change_observer_x11.h" |
| 95 #endif |
| 96 |
| 93 namespace ash { | 97 namespace ash { |
| 94 | 98 |
| 95 namespace { | 99 namespace { |
| 96 | 100 |
| 97 using aura::Window; | 101 using aura::Window; |
| 98 using views::Widget; | 102 using views::Widget; |
| 99 | 103 |
| 100 // Creates a new window for use as a container. | 104 // Creates a new window for use as a container. |
| 101 aura::Window* CreateContainer(int window_id, | 105 aura::Window* CreateContainer(int window_id, |
| 102 const char* name, | 106 const char* name, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 RemoveRootWindowEventFilter(tooltip_controller_.get()); | 525 RemoveRootWindowEventFilter(tooltip_controller_.get()); |
| 522 aura::client::SetTooltipClient(GetRootWindow(), NULL); | 526 aura::client::SetTooltipClient(GetRootWindow(), NULL); |
| 523 | 527 |
| 524 // Make sure we delete WorkspaceController before launcher is | 528 // Make sure we delete WorkspaceController before launcher is |
| 525 // deleted as it has a reference to launcher model. | 529 // deleted as it has a reference to launcher model. |
| 526 workspace_controller_.reset(); | 530 workspace_controller_.reset(); |
| 527 | 531 |
| 528 // The system tray needs to be reset before all the windows are destroyed. | 532 // The system tray needs to be reset before all the windows are destroyed. |
| 529 tray_.reset(); | 533 tray_.reset(); |
| 530 | 534 |
| 535 // Desroy secondary monitor's widgets before all the windows are destroyed. |
| 536 monitor_controller_.reset(); |
| 537 |
| 531 // Delete containers now so that child windows does not access | 538 // Delete containers now so that child windows does not access |
| 532 // observers when they are destructed. | 539 // observers when they are destructed. |
| 533 aura::RootWindow* root_window = GetRootWindow(); | 540 aura::RootWindow* root_window = GetRootWindow(); |
| 534 while (!root_window->children().empty()) { | 541 while (!root_window->children().empty()) { |
| 535 aura::Window* child = root_window->children()[0]; | 542 aura::Window* child = root_window->children()[0]; |
| 536 delete child; | 543 delete child; |
| 537 } | 544 } |
| 538 | 545 |
| 539 // These need a valid Shell instance to clean up properly, so explicitly | 546 // These need a valid Shell instance to clean up properly, so explicitly |
| 540 // delete them before invalidating the instance. | 547 // delete them before invalidating the instance. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 554 | 561 |
| 555 DCHECK(instance_ == this); | 562 DCHECK(instance_ == this); |
| 556 instance_ = NULL; | 563 instance_ = NULL; |
| 557 } | 564 } |
| 558 | 565 |
| 559 // static | 566 // static |
| 560 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 567 Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
| 561 CHECK(!instance_); | 568 CHECK(!instance_); |
| 562 aura::Env::GetInstance()->SetMonitorManager( | 569 aura::Env::GetInstance()->SetMonitorManager( |
| 563 new internal::MultiMonitorManager()); | 570 new internal::MultiMonitorManager()); |
| 571 #if defined(USE_X11) |
| 572 aura::Env::GetInstance()->monitor_change_observer()->NotifyMonitorChange(); |
| 573 #endif |
| 564 instance_ = new Shell(delegate); | 574 instance_ = new Shell(delegate); |
| 565 instance_->Init(); | 575 instance_->Init(); |
| 566 return instance_; | 576 return instance_; |
| 567 } | 577 } |
| 568 | 578 |
| 569 // static | 579 // static |
| 570 Shell* Shell::GetInstance() { | 580 Shell* Shell::GetInstance() { |
| 571 DCHECK(instance_); | 581 DCHECK(instance_); |
| 572 return instance_; | 582 return instance_; |
| 573 } | 583 } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 desktop_background_controller_->SetDesktopBackgroundImageMode( | 874 desktop_background_controller_->SetDesktopBackgroundImageMode( |
| 865 GetWallpaper(index), GetWallpaperInfo(index).layout); | 875 GetWallpaper(index), GetWallpaperInfo(index).layout); |
| 866 } | 876 } |
| 867 | 877 |
| 868 void Shell::DisableWorkspaceGridLayout() { | 878 void Shell::DisableWorkspaceGridLayout() { |
| 869 if (workspace_controller_.get()) | 879 if (workspace_controller_.get()) |
| 870 workspace_controller_->workspace_manager()->set_grid_size(0); | 880 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 871 } | 881 } |
| 872 | 882 |
| 873 } // namespace ash | 883 } // namespace ash |
| OLD | NEW |