| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 #include "ui/views/widget/widget.h" | 92 #include "ui/views/widget/widget.h" |
| 93 | 93 |
| 94 #if !defined(OS_MACOSX) | 94 #if !defined(OS_MACOSX) |
| 95 #include "ash/accelerators/accelerator_controller.h" | 95 #include "ash/accelerators/accelerator_controller.h" |
| 96 #include "ash/accelerators/accelerator_filter.h" | 96 #include "ash/accelerators/accelerator_filter.h" |
| 97 #include "ash/accelerators/nested_dispatcher_controller.h" | 97 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 98 #endif | 98 #endif |
| 99 | 99 |
| 100 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
| 101 #include "ash/display/output_configurator_animation.h" | 101 #include "ash/display/output_configurator_animation.h" |
| 102 #include "base/message_pump_aurax11.h" |
| 102 #include "chromeos/display/output_configurator.h" | 103 #include "chromeos/display/output_configurator.h" |
| 103 #include "ui/aura/dispatcher_linux.h" | |
| 104 #endif // defined(OS_CHROMEOS) | 104 #endif // defined(OS_CHROMEOS) |
| 105 | 105 |
| 106 namespace ash { | 106 namespace ash { |
| 107 | 107 |
| 108 namespace { | 108 namespace { |
| 109 | 109 |
| 110 using aura::Window; | 110 using aura::Window; |
| 111 using views::Widget; | 111 using views::Widget; |
| 112 | 112 |
| 113 // This dummy class is used for shell unit tests. We dont have chrome delegate | 113 // This dummy class is used for shell unit tests. We dont have chrome delegate |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 new internal::OutputConfiguratorAnimation()), | 189 new internal::OutputConfiguratorAnimation()), |
| 190 #endif // defined(OS_CHROMEOS) | 190 #endif // defined(OS_CHROMEOS) |
| 191 shelf_(NULL), | 191 shelf_(NULL), |
| 192 panel_layout_manager_(NULL), | 192 panel_layout_manager_(NULL), |
| 193 status_area_widget_(NULL), | 193 status_area_widget_(NULL), |
| 194 browser_context_(NULL) { | 194 browser_context_(NULL) { |
| 195 gfx::Screen::SetInstance(screen_); | 195 gfx::Screen::SetInstance(screen_); |
| 196 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); | 196 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); |
| 197 #if defined(OS_CHROMEOS) | 197 #if defined(OS_CHROMEOS) |
| 198 output_configurator_->AddObserver(output_configurator_animation_.get()); | 198 output_configurator_->AddObserver(output_configurator_animation_.get()); |
| 199 static_cast<aura::DispatcherLinux*>( | 199 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow( |
| 200 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( | 200 output_configurator()); |
| 201 output_configurator()); | |
| 202 #endif // defined(OS_CHROMEOS) | 201 #endif // defined(OS_CHROMEOS) |
| 203 } | 202 } |
| 204 | 203 |
| 205 Shell::~Shell() { | 204 Shell::~Shell() { |
| 206 views::FocusManagerFactory::Install(NULL); | 205 views::FocusManagerFactory::Install(NULL); |
| 207 | 206 |
| 208 // Remove the focus from any window. This will prevent overhead and side | 207 // Remove the focus from any window. This will prevent overhead and side |
| 209 // effects (e.g. crashes) from changing focus during shutdown. | 208 // effects (e.g. crashes) from changing focus during shutdown. |
| 210 // See bug crbug.com/134502. | 209 // See bug crbug.com/134502. |
| 211 if (active_root_window_) | 210 if (active_root_window_) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 270 |
| 272 // Delete the activation controller after other controllers and launcher | 271 // Delete the activation controller after other controllers and launcher |
| 273 // because they might have registered ActivationChangeObserver. | 272 // because they might have registered ActivationChangeObserver. |
| 274 activation_controller_.reset(); | 273 activation_controller_.reset(); |
| 275 | 274 |
| 276 DCHECK(instance_ == this); | 275 DCHECK(instance_ == this); |
| 277 instance_ = NULL; | 276 instance_ = NULL; |
| 278 | 277 |
| 279 #if defined(OS_CHROMEOS) | 278 #if defined(OS_CHROMEOS) |
| 280 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 279 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
| 281 // Remove OutputConfigurator from Dispatcher. | 280 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( |
| 282 static_cast<aura::DispatcherLinux*>( | 281 output_configurator()); |
| 283 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( | |
| 284 output_configurator()); | |
| 285 #endif // defined(OS_CHROMEOS) | 282 #endif // defined(OS_CHROMEOS) |
| 286 } | 283 } |
| 287 | 284 |
| 288 // static | 285 // static |
| 289 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 286 Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
| 290 CHECK(!instance_); | 287 CHECK(!instance_); |
| 291 aura::Env::GetInstance()->SetDisplayManager( | 288 aura::Env::GetInstance()->SetDisplayManager( |
| 292 new internal::MultiDisplayManager()); | 289 new internal::MultiDisplayManager()); |
| 293 instance_ = new Shell(delegate); | 290 instance_ = new Shell(delegate); |
| 294 instance_->Init(); | 291 instance_->Init(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 } | 782 } |
| 786 | 783 |
| 787 void Shell::ShowCursor(bool visible) { | 784 void Shell::ShowCursor(bool visible) { |
| 788 RootWindowList root_windows = GetAllRootWindows(); | 785 RootWindowList root_windows = GetAllRootWindows(); |
| 789 for (RootWindowList::iterator iter = root_windows.begin(); | 786 for (RootWindowList::iterator iter = root_windows.begin(); |
| 790 iter != root_windows.end(); ++iter) | 787 iter != root_windows.end(); ++iter) |
| 791 (*iter)->ShowCursor(visible); | 788 (*iter)->ShowCursor(visible); |
| 792 } | 789 } |
| 793 | 790 |
| 794 } // namespace ash | 791 } // namespace ash |
| OLD | NEW |