| 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/native_widget_aura.h" | 92 #include "ui/views/widget/native_widget_aura.h" |
| 93 #include "ui/views/widget/widget.h" | 93 #include "ui/views/widget/widget.h" |
| 94 | 94 |
| 95 #if !defined(OS_MACOSX) | 95 #if !defined(OS_MACOSX) |
| 96 #include "ash/accelerators/accelerator_controller.h" | 96 #include "ash/accelerators/accelerator_controller.h" |
| 97 #include "ash/accelerators/accelerator_filter.h" | 97 #include "ash/accelerators/accelerator_filter.h" |
| 98 #include "ash/accelerators/nested_dispatcher_controller.h" | 98 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 #include "ash/display/output_configurator_animation.h" |
| 102 #include "chromeos/display/output_configurator.h" | 103 #include "chromeos/display/output_configurator.h" |
| 103 #include "ui/aura/dispatcher_linux.h" | 104 #include "ui/aura/dispatcher_linux.h" |
| 104 #endif // defined(OS_CHROMEOS) | 105 #endif // defined(OS_CHROMEOS) |
| 105 | 106 |
| 106 namespace ash { | 107 namespace ash { |
| 107 | 108 |
| 108 namespace { | 109 namespace { |
| 109 | 110 |
| 110 using aura::Window; | 111 using aura::Window; |
| 111 using views::Widget; | 112 using views::Widget; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Shell, public: | 176 // Shell, public: |
| 176 | 177 |
| 177 Shell::Shell(ShellDelegate* delegate) | 178 Shell::Shell(ShellDelegate* delegate) |
| 178 : screen_(new ScreenAsh), | 179 : screen_(new ScreenAsh), |
| 179 active_root_window_(NULL), | 180 active_root_window_(NULL), |
| 180 env_filter_(NULL), | 181 env_filter_(NULL), |
| 181 delegate_(delegate), | 182 delegate_(delegate), |
| 182 #if defined(OS_CHROMEOS) | 183 #if defined(OS_CHROMEOS) |
| 183 output_configurator_(new chromeos::OutputConfigurator( | 184 output_configurator_(new chromeos::OutputConfigurator( |
| 184 internal::DisplayController::IsExtendedDesktopEnabled())), | 185 internal::DisplayController::IsExtendedDesktopEnabled())), |
| 186 output_configurator_animation_( |
| 187 new internal::OutputConfiguratorAnimation()), |
| 185 #endif // defined(OS_CHROMEOS) | 188 #endif // defined(OS_CHROMEOS) |
| 186 shelf_(NULL), | 189 shelf_(NULL), |
| 187 panel_layout_manager_(NULL), | 190 panel_layout_manager_(NULL), |
| 188 status_area_widget_(NULL), | 191 status_area_widget_(NULL), |
| 189 browser_context_(NULL) { | 192 browser_context_(NULL) { |
| 190 gfx::Screen::SetInstance(screen_); | 193 gfx::Screen::SetInstance(screen_); |
| 191 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); | 194 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); |
| 192 #if defined(OS_CHROMEOS) | 195 #if defined(OS_CHROMEOS) |
| 193 // OutputConfigurator needs to get events regarding added/removed outputs. | 196 output_configurator_->AddObserver(output_configurator_animation_.get()); |
| 194 static_cast<aura::DispatcherLinux*>( | 197 static_cast<aura::DispatcherLinux*>( |
| 195 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( | 198 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( |
| 196 output_configurator()); | 199 output_configurator()); |
| 197 #endif // defined(OS_CHROMEOS) | 200 #endif // defined(OS_CHROMEOS) |
| 198 } | 201 } |
| 199 | 202 |
| 200 Shell::~Shell() { | 203 Shell::~Shell() { |
| 201 views::FocusManagerFactory::Install(NULL); | 204 views::FocusManagerFactory::Install(NULL); |
| 202 | 205 |
| 203 // Remove the focus from any window. This will prevent overhead and side | 206 // Remove the focus from any window. This will prevent overhead and side |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 launcher_.reset(); | 268 launcher_.reset(); |
| 266 | 269 |
| 267 // Delete the activation controller after other controllers and launcher | 270 // Delete the activation controller after other controllers and launcher |
| 268 // because they might have registered ActivationChangeObserver. | 271 // because they might have registered ActivationChangeObserver. |
| 269 activation_controller_.reset(); | 272 activation_controller_.reset(); |
| 270 | 273 |
| 271 DCHECK(instance_ == this); | 274 DCHECK(instance_ == this); |
| 272 instance_ = NULL; | 275 instance_ = NULL; |
| 273 | 276 |
| 274 #if defined(OS_CHROMEOS) | 277 #if defined(OS_CHROMEOS) |
| 278 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
| 275 // Remove OutputConfigurator from Dispatcher. | 279 // Remove OutputConfigurator from Dispatcher. |
| 276 static_cast<aura::DispatcherLinux*>( | 280 static_cast<aura::DispatcherLinux*>( |
| 277 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( | 281 aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( |
| 278 output_configurator()); | 282 output_configurator()); |
| 279 #endif // defined(OS_CHROMEOS) | 283 #endif // defined(OS_CHROMEOS) |
| 280 } | 284 } |
| 281 | 285 |
| 282 // static | 286 // static |
| 283 Shell* Shell::CreateInstance(ShellDelegate* delegate) { | 287 Shell* Shell::CreateInstance(ShellDelegate* delegate) { |
| 284 CHECK(!instance_); | 288 CHECK(!instance_); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 } | 787 } |
| 784 | 788 |
| 785 void Shell::ShowCursor(bool visible) { | 789 void Shell::ShowCursor(bool visible) { |
| 786 RootWindowList root_windows = GetAllRootWindows(); | 790 RootWindowList root_windows = GetAllRootWindows(); |
| 787 for (RootWindowList::iterator iter = root_windows.begin(); | 791 for (RootWindowList::iterator iter = root_windows.begin(); |
| 788 iter != root_windows.end(); ++iter) | 792 iter != root_windows.end(); ++iter) |
| 789 (*iter)->ShowCursor(visible); | 793 (*iter)->ShowCursor(visible); |
| 790 } | 794 } |
| 791 | 795 |
| 792 } // namespace ash | 796 } // namespace ash |
| OLD | NEW |