| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "ui/views/widget/native_widget_aura.h" | 100 #include "ui/views/widget/native_widget_aura.h" |
| 101 #include "ui/views/widget/widget.h" | 101 #include "ui/views/widget/widget.h" |
| 102 #include "ui/views/window/dialog_delegate.h" | 102 #include "ui/views/window/dialog_delegate.h" |
| 103 | 103 |
| 104 #if !defined(OS_MACOSX) | 104 #if !defined(OS_MACOSX) |
| 105 #include "ash/accelerators/accelerator_controller.h" | 105 #include "ash/accelerators/accelerator_controller.h" |
| 106 #include "ash/accelerators/accelerator_filter.h" | 106 #include "ash/accelerators/accelerator_filter.h" |
| 107 #include "ash/accelerators/nested_dispatcher_controller.h" | 107 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 111 #include "ash/ash_constants.h" | 111 #include "ash/ash_constants.h" |
| 112 #include "ash/display/display_change_observer_x11.h" | 112 #include "ash/display/display_change_observer_x11.h" |
| 113 #include "ash/display/display_error_dialog.h" | 113 #include "ash/display/display_error_dialog.h" |
| 114 #include "ash/display/output_configurator_animation.h" | 114 #include "ash/display/output_configurator_animation.h" |
| 115 #include "base/chromeos/chromeos_version.h" | 115 #include "base/chromeos/chromeos_version.h" |
| 116 #include "base/message_pump_aurax11.h" | 116 #include "base/message_pump_aurax11.h" |
| 117 #include "chromeos/display/output_configurator.h" | 117 #include "chromeos/display/output_configurator.h" |
| 118 #include "content/public/browser/gpu_data_manager.h" | 118 #include "content/public/browser/gpu_data_manager.h" |
| 119 #include "content/public/common/content_switches.h" | 119 #include "content/public/common/content_switches.h" |
| 120 #include "content/public/common/gpu_feature_type.h" | 120 #include "content/public/common/gpu_feature_type.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 bool Shell::initially_hide_cursor_ = false; | 194 bool Shell::initially_hide_cursor_ = false; |
| 195 | 195 |
| 196 //////////////////////////////////////////////////////////////////////////////// | 196 //////////////////////////////////////////////////////////////////////////////// |
| 197 // Shell, public: | 197 // Shell, public: |
| 198 | 198 |
| 199 Shell::Shell(ShellDelegate* delegate) | 199 Shell::Shell(ShellDelegate* delegate) |
| 200 : screen_(new ScreenAsh), | 200 : screen_(new ScreenAsh), |
| 201 active_root_window_(NULL), | 201 active_root_window_(NULL), |
| 202 delegate_(delegate), | 202 delegate_(delegate), |
| 203 activation_client_(NULL), | 203 activation_client_(NULL), |
| 204 #if defined(OS_CHROMEOS) | 204 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 205 output_configurator_(new chromeos::OutputConfigurator()), | 205 output_configurator_(new chromeos::OutputConfigurator()), |
| 206 #endif // defined(OS_CHROMEOS) | 206 #endif // defined(OS_CHROMEOS) |
| 207 native_cursor_manager_(new AshNativeCursorManager), | 207 native_cursor_manager_(new AshNativeCursorManager), |
| 208 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 208 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
| 209 native_cursor_manager_)), | 209 native_cursor_manager_)), |
| 210 browser_context_(NULL), | 210 browser_context_(NULL), |
| 211 simulate_modal_window_open_for_testing_(false) { | 211 simulate_modal_window_open_for_testing_(false) { |
| 212 DCHECK(delegate_.get()); | 212 DCHECK(delegate_.get()); |
| 213 display_manager_.reset(new internal::DisplayManager); | 213 display_manager_.reset(new internal::DisplayManager); |
| 214 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | 214 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 |
| 215 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | 215 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); |
| 216 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | 216 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) |
| 217 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | 217 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); |
| 218 display_controller_.reset(new DisplayController); | 218 display_controller_.reset(new DisplayController); |
| 219 #if defined(OS_CHROMEOS) | 219 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 220 bool is_panel_fitting_disabled = | 220 bool is_panel_fitting_disabled = |
| 221 content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 221 content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 222 content::GPU_FEATURE_TYPE_PANEL_FITTING) || | 222 content::GPU_FEATURE_TYPE_PANEL_FITTING) || |
| 223 CommandLine::ForCurrentProcess()->HasSwitch( | 223 CommandLine::ForCurrentProcess()->HasSwitch( |
| 224 ::switches::kDisablePanelFitting); | 224 ::switches::kDisablePanelFitting); |
| 225 | 225 |
| 226 output_configurator_->Init( | 226 output_configurator_->Init( |
| 227 !is_panel_fitting_disabled, | 227 !is_panel_fitting_disabled, |
| 228 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); | 228 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); |
| 229 | 229 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // DisplayController before resetting |display_controller_|, since destruction | 302 // DisplayController before resetting |display_controller_|, since destruction |
| 303 // of its owned RootWindowControllers relies on the value. | 303 // of its owned RootWindowControllers relies on the value. |
| 304 display_controller_->Shutdown(); | 304 display_controller_->Shutdown(); |
| 305 display_controller_.reset(); | 305 display_controller_.reset(); |
| 306 screen_position_controller_.reset(); | 306 screen_position_controller_.reset(); |
| 307 | 307 |
| 308 // Delete the activation controller after other controllers and launcher | 308 // Delete the activation controller after other controllers and launcher |
| 309 // because they might have registered ActivationChangeObserver. | 309 // because they might have registered ActivationChangeObserver. |
| 310 activation_controller_.reset(); | 310 activation_controller_.reset(); |
| 311 | 311 |
| 312 #if defined(OS_CHROMEOS) | 312 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 313 if (display_change_observer_) | 313 if (display_change_observer_) |
| 314 output_configurator_->RemoveObserver(display_change_observer_.get()); | 314 output_configurator_->RemoveObserver(display_change_observer_.get()); |
| 315 if (output_configurator_animation_) | 315 if (output_configurator_animation_) |
| 316 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 316 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
| 317 if (display_error_observer_) | 317 if (display_error_observer_) |
| 318 output_configurator_->RemoveObserver(display_error_observer_.get()); | 318 output_configurator_->RemoveObserver(display_error_observer_.get()); |
| 319 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( | 319 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( |
| 320 output_configurator()); | 320 output_configurator()); |
| 321 display_change_observer_.reset(); | 321 display_change_observer_.reset(); |
| 322 #endif // defined(OS_CHROMEOS) | 322 #endif // defined(OS_CHROMEOS) |
| 323 | 323 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 // static | 416 // static |
| 417 bool Shell::IsLauncherPerDisplayEnabled() { | 417 bool Shell::IsLauncherPerDisplayEnabled() { |
| 418 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 418 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 419 return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay); | 419 return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void Shell::Init() { | 422 void Shell::Init() { |
| 423 delegate_->PreInit(); | 423 delegate_->PreInit(); |
| 424 #if defined(OS_CHROMEOS) | 424 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 425 output_configurator_animation_.reset( | 425 output_configurator_animation_.reset( |
| 426 new internal::OutputConfiguratorAnimation()); | 426 new internal::OutputConfiguratorAnimation()); |
| 427 output_configurator_->AddObserver(output_configurator_animation_.get()); | 427 output_configurator_->AddObserver(output_configurator_animation_.get()); |
| 428 if (base::chromeos::IsRunningOnChromeOS()) { | 428 if (base::chromeos::IsRunningOnChromeOS()) { |
| 429 display_change_observer_.reset(new internal::DisplayChangeObserverX11); | 429 display_change_observer_.reset(new internal::DisplayChangeObserverX11); |
| 430 // Register |display_change_observer_| first so that the rest of | 430 // Register |display_change_observer_| first so that the rest of |
| 431 // observer gets invoked after the root windows are configured. | 431 // observer gets invoked after the root windows are configured. |
| 432 output_configurator_->AddObserver(display_change_observer_.get()); | 432 output_configurator_->AddObserver(display_change_observer_.get()); |
| 433 display_error_observer_.reset(new internal::DisplayErrorObserver()); | 433 display_error_observer_.reset(new internal::DisplayErrorObserver()); |
| 434 output_configurator_->AddObserver(display_error_observer_.get()); | 434 output_configurator_->AddObserver(display_error_observer_.get()); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 //////////////////////////////////////////////////////////////////////////////// | 949 //////////////////////////////////////////////////////////////////////////////// |
| 950 // Shell, aura::client::ActivationChangeObserver implementation: | 950 // Shell, aura::client::ActivationChangeObserver implementation: |
| 951 | 951 |
| 952 void Shell::OnWindowActivated(aura::Window* gained_active, | 952 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 953 aura::Window* lost_active) { | 953 aura::Window* lost_active) { |
| 954 if (gained_active) | 954 if (gained_active) |
| 955 active_root_window_ = gained_active->GetRootWindow(); | 955 active_root_window_ = gained_active->GetRootWindow(); |
| 956 } | 956 } |
| 957 | 957 |
| 958 } // namespace ash | 958 } // namespace ash |
| OLD | NEW |