| 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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| 11 #include "ash/accelerators/accelerator_filter.h" | 11 #include "ash/accelerators/accelerator_filter.h" |
| 12 #include "ash/accelerators/focus_manager_factory.h" | 12 #include "ash/accelerators/focus_manager_factory.h" |
| 13 #include "ash/accelerators/nested_dispatcher_controller.h" | 13 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/autoclick/autoclick_controller.h" | 15 #include "ash/autoclick/autoclick_controller.h" |
| 16 #include "ash/caps_lock_delegate.h" | 16 #include "ash/caps_lock_delegate.h" |
| 17 #include "ash/desktop_background/desktop_background_controller.h" | 17 #include "ash/desktop_background/desktop_background_controller.h" |
| 18 #include "ash/desktop_background/desktop_background_view.h" | 18 #include "ash/desktop_background/desktop_background_view.h" |
| 19 #include "ash/desktop_background/user_wallpaper_delegate.h" | 19 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 20 #include "ash/display/display_controller.h" | 20 #include "ash/display/display_controller.h" |
| 21 #include "ash/display/display_manager.h" | 21 #include "ash/display/display_manager.h" |
| 22 #include "ash/display/event_transformation_handler.h" | 22 #include "ash/display/event_transformation_handler.h" |
| 23 #include "ash/display/mouse_cursor_event_filter.h" | 23 #include "ash/display/mouse_cursor_event_filter.h" |
| 24 #include "ash/display/resolution_notification_controller.h" | 24 #include "ash/display/resolution_notification_controller.h" |
| 25 #include "ash/display/screen_position_controller.h" | 25 #include "ash/display/screen_position_controller.h" |
| 26 #include "ash/display/virtual_keyboard_window_controller.h" | 26 #include "ash/display/virtual_keyboard_window_controller.h" |
| 27 #include "ash/drag_drop/drag_drop_controller.h" | 27 #include "ash/drag_drop/drag_drop_controller.h" |
| 28 #include "ash/first_run/first_run_helper_impl.h" | 28 #include "ash/first_run/first_run_helper_impl.h" |
| 29 #include "ash/focus_cycler.h" | 29 #include "ash/focus_cycler.h" |
| 30 #include "ash/gpu_support.h" | |
| 31 #include "ash/high_contrast/high_contrast_controller.h" | 30 #include "ash/high_contrast/high_contrast_controller.h" |
| 32 #include "ash/host/root_window_host_factory.h" | 31 #include "ash/host/root_window_host_factory.h" |
| 33 #include "ash/keyboard_uma_event_filter.h" | 32 #include "ash/keyboard_uma_event_filter.h" |
| 34 #include "ash/magnifier/magnification_controller.h" | 33 #include "ash/magnifier/magnification_controller.h" |
| 35 #include "ash/magnifier/partial_magnification_controller.h" | 34 #include "ash/magnifier/partial_magnification_controller.h" |
| 36 #include "ash/media_delegate.h" | 35 #include "ash/media_delegate.h" |
| 37 #include "ash/new_window_delegate.h" | 36 #include "ash/new_window_delegate.h" |
| 38 #include "ash/root_window_controller.h" | 37 #include "ash/root_window_controller.h" |
| 39 #include "ash/screen_ash.h" | 38 #include "ash/screen_ash.h" |
| 40 #include "ash/session_state_delegate.h" | 39 #include "ash/session_state_delegate.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 118 |
| 120 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
| 121 #if defined(USE_X11) | 120 #if defined(USE_X11) |
| 122 #include "ash/ash_constants.h" | 121 #include "ash/ash_constants.h" |
| 123 #include "ash/display/display_change_observer_chromeos.h" | 122 #include "ash/display/display_change_observer_chromeos.h" |
| 124 #include "ash/display/display_error_observer_chromeos.h" | 123 #include "ash/display/display_error_observer_chromeos.h" |
| 125 #include "ash/display/output_configurator_animation.h" | 124 #include "ash/display/output_configurator_animation.h" |
| 126 #include "base/message_loop/message_pump_x11.h" | 125 #include "base/message_loop/message_pump_x11.h" |
| 127 #include "base/sys_info.h" | 126 #include "base/sys_info.h" |
| 128 #include "chromeos/display/output_configurator.h" | 127 #include "chromeos/display/output_configurator.h" |
| 128 #include "content/public/browser/gpu_data_manager.h" |
| 129 #include "gpu/config/gpu_feature_type.h" |
| 129 #endif // defined(USE_X11) | 130 #endif // defined(USE_X11) |
| 130 #include "ash/sticky_keys/sticky_keys_controller.h" | 131 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 131 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" | 132 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" |
| 132 #include "ash/system/chromeos/power/power_event_observer.h" | 133 #include "ash/system/chromeos/power/power_event_observer.h" |
| 133 #include "ash/system/chromeos/power/power_status.h" | 134 #include "ash/system/chromeos/power/power_status.h" |
| 134 #include "ash/system/chromeos/power/user_activity_notifier.h" | 135 #include "ash/system/chromeos/power/user_activity_notifier.h" |
| 135 #include "ash/system/chromeos/power/video_activity_notifier.h" | 136 #include "ash/system/chromeos/power/video_activity_notifier.h" |
| 136 #endif // defined(OS_CHROMEOS) | 137 #endif // defined(OS_CHROMEOS) |
| 137 | 138 |
| 138 namespace ash { | 139 namespace ash { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 153 // Overridden from views::corewm::VisibilityController: | 154 // Overridden from views::corewm::VisibilityController: |
| 154 virtual bool CallAnimateOnChildWindowVisibilityChanged( | 155 virtual bool CallAnimateOnChildWindowVisibilityChanged( |
| 155 aura::Window* window, | 156 aura::Window* window, |
| 156 bool visible) OVERRIDE { | 157 bool visible) OVERRIDE { |
| 157 return AnimateOnChildWindowVisibilityChanged(window, visible); | 158 return AnimateOnChildWindowVisibilityChanged(window, visible); |
| 158 } | 159 } |
| 159 | 160 |
| 160 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); | 161 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 class DefaultGPUSupportImpl : public GPUSupport { | |
| 164 public: | |
| 165 DefaultGPUSupportImpl() {} | |
| 166 virtual ~DefaultGPUSupportImpl() {} | |
| 167 | |
| 168 private: | |
| 169 // Overridden from GPUSupport: | |
| 170 virtual bool IsPanelFittingDisabled() const OVERRIDE { | |
| 171 return false; | |
| 172 } | |
| 173 virtual void DisableGpuWatchdog() OVERRIDE {} | |
| 174 virtual void GetGpuProcessHandles( | |
| 175 const GetGpuProcessHandlesCallback& callback) const OVERRIDE {} | |
| 176 | |
| 177 DISALLOW_COPY_AND_ASSIGN(DefaultGPUSupportImpl); | |
| 178 }; | |
| 179 | |
| 180 } // namespace | 164 } // namespace |
| 181 | 165 |
| 182 // static | 166 // static |
| 183 Shell* Shell::instance_ = NULL; | 167 Shell* Shell::instance_ = NULL; |
| 184 // static | 168 // static |
| 185 bool Shell::initially_hide_cursor_ = false; | 169 bool Shell::initially_hide_cursor_ = false; |
| 186 | 170 |
| 187 //////////////////////////////////////////////////////////////////////////////// | 171 //////////////////////////////////////////////////////////////////////////////// |
| 188 // Shell, public: | 172 // Shell, public: |
| 189 | 173 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 ash::FirstRunHelper* Shell::CreateFirstRunHelper() { | 538 ash::FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 555 return new ash::FirstRunHelperImpl; | 539 return new ash::FirstRunHelperImpl; |
| 556 } | 540 } |
| 557 #endif // defined(OS_CHROMEOS) | 541 #endif // defined(OS_CHROMEOS) |
| 558 | 542 |
| 559 void Shell::DoInitialWorkspaceAnimation() { | 543 void Shell::DoInitialWorkspaceAnimation() { |
| 560 return GetPrimaryRootWindowController()->workspace_controller()-> | 544 return GetPrimaryRootWindowController()->workspace_controller()-> |
| 561 DoInitialAnimation(); | 545 DoInitialAnimation(); |
| 562 } | 546 } |
| 563 | 547 |
| 564 void Shell::SetGPUSupport(scoped_ptr<GPUSupport> gpu_support) { | |
| 565 gpu_support_ = gpu_support.Pass(); | |
| 566 } | |
| 567 | |
| 568 //////////////////////////////////////////////////////////////////////////////// | 548 //////////////////////////////////////////////////////////////////////////////// |
| 569 // Shell, private: | 549 // Shell, private: |
| 570 | 550 |
| 571 Shell::Shell(ShellDelegate* delegate) | 551 Shell::Shell(ShellDelegate* delegate) |
| 572 : screen_(new ScreenAsh), | 552 : screen_(new ScreenAsh), |
| 573 target_root_window_(NULL), | 553 target_root_window_(NULL), |
| 574 scoped_target_root_window_(NULL), | 554 scoped_target_root_window_(NULL), |
| 575 delegate_(delegate), | 555 delegate_(delegate), |
| 576 window_positioner_(new WindowPositioner), | 556 window_positioner_(new WindowPositioner), |
| 577 activation_client_(NULL), | 557 activation_client_(NULL), |
| 578 #if defined(OS_CHROMEOS) && defined(USE_X11) | 558 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 579 output_configurator_(new chromeos::OutputConfigurator()), | 559 output_configurator_(new chromeos::OutputConfigurator()), |
| 580 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 560 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
| 581 native_cursor_manager_(new AshNativeCursorManager), | 561 native_cursor_manager_(new AshNativeCursorManager), |
| 582 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 562 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
| 583 native_cursor_manager_)), | 563 native_cursor_manager_)), |
| 584 simulate_modal_window_open_for_testing_(false), | 564 simulate_modal_window_open_for_testing_(false), |
| 585 is_touch_hud_projection_enabled_(false), | 565 is_touch_hud_projection_enabled_(false) { |
| 586 gpu_support_(new DefaultGPUSupportImpl) { | |
| 587 DCHECK(delegate_.get()); | 566 DCHECK(delegate_.get()); |
| 588 display_manager_.reset(new internal::DisplayManager); | 567 display_manager_.reset(new internal::DisplayManager); |
| 589 | 568 |
| 590 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | 569 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 |
| 591 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | 570 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); |
| 592 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | 571 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) |
| 593 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | 572 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); |
| 594 display_controller_.reset(new DisplayController); | 573 display_controller_.reset(new DisplayController); |
| 595 #if defined(OS_CHROMEOS) && defined(USE_X11) | 574 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 596 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 575 bool is_panel_fitting_disabled = |
| 576 content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 577 gpu::GPU_FEATURE_TYPE_PANEL_FITTING); |
| 578 |
| 579 output_configurator_->Init(!is_panel_fitting_disabled); |
| 597 user_metrics_recorder_.reset(new UserMetricsRecorder); | 580 user_metrics_recorder_.reset(new UserMetricsRecorder); |
| 598 | 581 |
| 599 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( | 582 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( |
| 600 output_configurator()); | 583 output_configurator()); |
| 601 // We can't do this with a root window listener because XI_HierarchyChanged | 584 // We can't do this with a root window listener because XI_HierarchyChanged |
| 602 // messages don't have a target window. | 585 // messages don't have a target window. |
| 603 base::MessagePumpX11::Current()->AddObserver(output_configurator()); | 586 base::MessagePumpX11::Current()->AddObserver(output_configurator()); |
| 604 #endif // defined(OS_CHROMEOS) | 587 #endif // defined(OS_CHROMEOS) |
| 605 | 588 |
| 606 #if defined(OS_CHROMEOS) | 589 #if defined(OS_CHROMEOS) |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 //////////////////////////////////////////////////////////////////////////////// | 1041 //////////////////////////////////////////////////////////////////////////////// |
| 1059 // Shell, aura::client::ActivationChangeObserver implementation: | 1042 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1060 | 1043 |
| 1061 void Shell::OnWindowActivated(aura::Window* gained_active, | 1044 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1062 aura::Window* lost_active) { | 1045 aura::Window* lost_active) { |
| 1063 if (gained_active) | 1046 if (gained_active) |
| 1064 target_root_window_ = gained_active->GetRootWindow(); | 1047 target_root_window_ = gained_active->GetRootWindow(); |
| 1065 } | 1048 } |
| 1066 | 1049 |
| 1067 } // namespace ash | 1050 } // namespace ash |
| OLD | NEW |