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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ash/focus_cycler.h" | 29 #include "ash/focus_cycler.h" |
30 #include "ash/gpu_support.h" | 30 #include "ash/gpu_support.h" |
31 #include "ash/high_contrast/high_contrast_controller.h" | 31 #include "ash/high_contrast/high_contrast_controller.h" |
32 #include "ash/host/root_window_host_factory.h" | 32 #include "ash/host/root_window_host_factory.h" |
33 #include "ash/keyboard_uma_event_filter.h" | 33 #include "ash/keyboard_uma_event_filter.h" |
34 #include "ash/magnifier/magnification_controller.h" | 34 #include "ash/magnifier/magnification_controller.h" |
35 #include "ash/magnifier/partial_magnification_controller.h" | 35 #include "ash/magnifier/partial_magnification_controller.h" |
36 #include "ash/media_delegate.h" | 36 #include "ash/media_delegate.h" |
37 #include "ash/new_window_delegate.h" | 37 #include "ash/new_window_delegate.h" |
38 #include "ash/root_window_controller.h" | 38 #include "ash/root_window_controller.h" |
39 #include "ash/screen_ash.h" | |
40 #include "ash/session_state_delegate.h" | 39 #include "ash/session_state_delegate.h" |
41 #include "ash/shelf/app_list_shelf_item_delegate.h" | 40 #include "ash/shelf/app_list_shelf_item_delegate.h" |
42 #include "ash/shelf/shelf_delegate.h" | 41 #include "ash/shelf/shelf_delegate.h" |
43 #include "ash/shelf/shelf_item_delegate.h" | 42 #include "ash/shelf/shelf_item_delegate.h" |
44 #include "ash/shelf/shelf_item_delegate_manager.h" | 43 #include "ash/shelf/shelf_item_delegate_manager.h" |
45 #include "ash/shelf/shelf_layout_manager.h" | 44 #include "ash/shelf/shelf_layout_manager.h" |
46 #include "ash/shelf/shelf_model.h" | 45 #include "ash/shelf/shelf_model.h" |
47 #include "ash/shelf/shelf_widget.h" | 46 #include "ash/shelf/shelf_widget.h" |
48 #include "ash/shelf/shelf_window_watcher.h" | 47 #include "ash/shelf/shelf_window_watcher.h" |
49 #include "ash/shell_delegate.h" | 48 #include "ash/shell_delegate.h" |
(...skipping 26 matching lines...) Expand all Loading... |
76 #include "ash/wm/user_activity_detector.h" | 75 #include "ash/wm/user_activity_detector.h" |
77 #include "ash/wm/video_detector.h" | 76 #include "ash/wm/video_detector.h" |
78 #include "ash/wm/window_animations.h" | 77 #include "ash/wm/window_animations.h" |
79 #include "ash/wm/window_cycle_controller.h" | 78 #include "ash/wm/window_cycle_controller.h" |
80 #include "ash/wm/window_positioner.h" | 79 #include "ash/wm/window_positioner.h" |
81 #include "ash/wm/window_properties.h" | 80 #include "ash/wm/window_properties.h" |
82 #include "ash/wm/window_util.h" | 81 #include "ash/wm/window_util.h" |
83 #include "ash/wm/workspace_controller.h" | 82 #include "ash/wm/workspace_controller.h" |
84 #include "base/bind.h" | 83 #include "base/bind.h" |
85 #include "base/command_line.h" | 84 #include "base/command_line.h" |
86 #include "base/debug/leak_annotations.h" | |
87 #include "base/debug/trace_event.h" | 85 #include "base/debug/trace_event.h" |
88 #include "ui/aura/client/aura_constants.h" | 86 #include "ui/aura/client/aura_constants.h" |
89 #include "ui/aura/client/user_action_client.h" | 87 #include "ui/aura/client/user_action_client.h" |
90 #include "ui/aura/env.h" | 88 #include "ui/aura/env.h" |
91 #include "ui/aura/layout_manager.h" | 89 #include "ui/aura/layout_manager.h" |
92 #include "ui/aura/root_window.h" | 90 #include "ui/aura/root_window.h" |
93 #include "ui/aura/window.h" | 91 #include "ui/aura/window.h" |
94 #include "ui/base/ui_base_switches.h" | 92 #include "ui/base/ui_base_switches.h" |
95 #include "ui/compositor/layer.h" | 93 #include "ui/compositor/layer.h" |
96 #include "ui/compositor/layer_animator.h" | 94 #include "ui/compositor/layer_animator.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } | 560 } |
563 | 561 |
564 void Shell::SetGPUSupport(scoped_ptr<GPUSupport> gpu_support) { | 562 void Shell::SetGPUSupport(scoped_ptr<GPUSupport> gpu_support) { |
565 gpu_support_ = gpu_support.Pass(); | 563 gpu_support_ = gpu_support.Pass(); |
566 } | 564 } |
567 | 565 |
568 //////////////////////////////////////////////////////////////////////////////// | 566 //////////////////////////////////////////////////////////////////////////////// |
569 // Shell, private: | 567 // Shell, private: |
570 | 568 |
571 Shell::Shell(ShellDelegate* delegate) | 569 Shell::Shell(ShellDelegate* delegate) |
572 : screen_(new ScreenAsh), | 570 : target_root_window_(NULL), |
573 target_root_window_(NULL), | |
574 scoped_target_root_window_(NULL), | 571 scoped_target_root_window_(NULL), |
575 delegate_(delegate), | 572 delegate_(delegate), |
576 window_positioner_(new WindowPositioner), | 573 window_positioner_(new WindowPositioner), |
577 activation_client_(NULL), | 574 activation_client_(NULL), |
578 #if defined(OS_CHROMEOS) && defined(USE_X11) | 575 #if defined(OS_CHROMEOS) && defined(USE_X11) |
579 output_configurator_(new chromeos::OutputConfigurator()), | 576 output_configurator_(new chromeos::OutputConfigurator()), |
580 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 577 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
581 native_cursor_manager_(new AshNativeCursorManager), | 578 native_cursor_manager_(new AshNativeCursorManager), |
582 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 579 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
583 native_cursor_manager_)), | 580 native_cursor_manager_)), |
584 simulate_modal_window_open_for_testing_(false), | 581 simulate_modal_window_open_for_testing_(false), |
585 is_touch_hud_projection_enabled_(false), | 582 is_touch_hud_projection_enabled_(false), |
586 gpu_support_(new DefaultGPUSupportImpl) { | 583 gpu_support_(new DefaultGPUSupportImpl) { |
587 DCHECK(delegate_.get()); | 584 DCHECK(delegate_.get()); |
588 display_manager_.reset(new internal::DisplayManager); | 585 display_manager_.reset(new internal::DisplayManager); |
589 | |
590 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | |
591 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | |
592 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | |
593 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | |
594 display_controller_.reset(new DisplayController); | 586 display_controller_.reset(new DisplayController); |
595 #if defined(OS_CHROMEOS) && defined(USE_X11) | 587 #if defined(OS_CHROMEOS) && defined(USE_X11) |
596 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 588 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
597 user_metrics_recorder_.reset(new UserMetricsRecorder); | 589 user_metrics_recorder_.reset(new UserMetricsRecorder); |
598 | 590 |
599 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( | 591 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( |
600 output_configurator()); | 592 output_configurator()); |
601 // We can't do this with a root window listener because XI_HierarchyChanged | 593 // We can't do this with a root window listener because XI_HierarchyChanged |
602 // messages don't have a target window. | 594 // messages don't have a target window. |
603 base::MessagePumpX11::Current()->AddObserver(output_configurator()); | 595 base::MessagePumpX11::Current()->AddObserver(output_configurator()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 | 697 |
706 power_button_controller_.reset(); | 698 power_button_controller_.reset(); |
707 lock_state_controller_.reset(); | 699 lock_state_controller_.reset(); |
708 | 700 |
709 resolution_notification_controller_.reset(); | 701 resolution_notification_controller_.reset(); |
710 desktop_background_controller_.reset(); | 702 desktop_background_controller_.reset(); |
711 | 703 |
712 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 704 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
713 // DisplayController before resetting |display_controller_|, since destruction | 705 // DisplayController before resetting |display_controller_|, since destruction |
714 // of its owned RootWindowControllers relies on the value. | 706 // of its owned RootWindowControllers relies on the value. |
| 707 display_manager_->CreateScreenForShutdown(); |
715 display_controller_->Shutdown(); | 708 display_controller_->Shutdown(); |
716 display_controller_.reset(); | 709 display_controller_.reset(); |
717 screen_position_controller_.reset(); | 710 screen_position_controller_.reset(); |
718 | 711 |
719 keyboard_controller_.reset(); | 712 keyboard_controller_.reset(); |
720 accessibility_delegate_.reset(); | 713 accessibility_delegate_.reset(); |
721 new_window_delegate_.reset(); | 714 new_window_delegate_.reset(); |
722 media_delegate_.reset(); | 715 media_delegate_.reset(); |
723 | 716 |
724 #if defined(OS_CHROMEOS) && defined(USE_X11) | 717 #if defined(OS_CHROMEOS) && defined(USE_X11) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 root_window_host_factory_.reset(delegate_->CreateWindowTreeHostFactory()); | 797 root_window_host_factory_.reset(delegate_->CreateWindowTreeHostFactory()); |
805 | 798 |
806 display_controller_->Start(); | 799 display_controller_->Start(); |
807 display_controller_->InitPrimaryDisplay(); | 800 display_controller_->InitPrimaryDisplay(); |
808 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); | 801 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); |
809 target_root_window_ = root_window; | 802 target_root_window_ = root_window; |
810 | 803 |
811 resolution_notification_controller_.reset( | 804 resolution_notification_controller_.reset( |
812 new internal::ResolutionNotificationController); | 805 new internal::ResolutionNotificationController); |
813 | 806 |
814 cursor_manager_.SetDisplay(DisplayController::GetPrimaryDisplay()); | 807 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
815 | 808 |
816 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 809 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
817 accelerator_controller_.reset(new AcceleratorController); | 810 accelerator_controller_.reset(new AcceleratorController); |
818 | 811 |
819 // The order in which event filters are added is significant. | 812 // The order in which event filters are added is significant. |
820 event_rewriter_filter_.reset(new internal::EventRewriterEventFilter); | 813 event_rewriter_filter_.reset(new internal::EventRewriterEventFilter); |
821 AddPreTargetHandler(event_rewriter_filter_.get()); | 814 AddPreTargetHandler(event_rewriter_filter_.get()); |
822 | 815 |
823 #if defined(OS_CHROMEOS) | 816 #if defined(OS_CHROMEOS) |
824 // The StickyKeysController also rewrites events and must be added | 817 // The StickyKeysController also rewrites events and must be added |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 //////////////////////////////////////////////////////////////////////////////// | 1051 //////////////////////////////////////////////////////////////////////////////// |
1059 // Shell, aura::client::ActivationChangeObserver implementation: | 1052 // Shell, aura::client::ActivationChangeObserver implementation: |
1060 | 1053 |
1061 void Shell::OnWindowActivated(aura::Window* gained_active, | 1054 void Shell::OnWindowActivated(aura::Window* gained_active, |
1062 aura::Window* lost_active) { | 1055 aura::Window* lost_active) { |
1063 if (gained_active) | 1056 if (gained_active) |
1064 target_root_window_ = gained_active->GetRootWindow(); | 1057 target_root_window_ = gained_active->GetRootWindow(); |
1065 } | 1058 } |
1066 | 1059 |
1067 } // namespace ash | 1060 } // namespace ash |
OLD | NEW |