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