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 17 matching lines...) Expand all Loading... | |
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/high_contrast/high_contrast_controller.h" | 30 #include "ash/high_contrast/high_contrast_controller.h" |
31 #include "ash/host/root_window_host_factory.h" | 31 #include "ash/host/root_window_host_factory.h" |
32 #include "ash/keyboard_uma_event_filter.h" | 32 #include "ash/keyboard_uma_event_filter.h" |
33 #include "ash/magnifier/magnification_controller.h" | 33 #include "ash/magnifier/magnification_controller.h" |
34 #include "ash/magnifier/partial_magnification_controller.h" | 34 #include "ash/magnifier/partial_magnification_controller.h" |
35 #include "ash/media_delegate.h" | 35 #include "ash/media_delegate.h" |
36 #include "ash/new_window_delegate.h" | 36 #include "ash/new_window_delegate.h" |
37 #include "ash/root_window_controller.h" | 37 #include "ash/root_window_controller.h" |
38 #include "ash/screen_ash.h" | |
39 #include "ash/session_state_delegate.h" | 38 #include "ash/session_state_delegate.h" |
40 #include "ash/shelf/app_list_shelf_item_delegate.h" | 39 #include "ash/shelf/app_list_shelf_item_delegate.h" |
41 #include "ash/shelf/shelf_delegate.h" | 40 #include "ash/shelf/shelf_delegate.h" |
42 #include "ash/shelf/shelf_item_delegate.h" | 41 #include "ash/shelf/shelf_item_delegate.h" |
43 #include "ash/shelf/shelf_item_delegate_manager.h" | 42 #include "ash/shelf/shelf_item_delegate_manager.h" |
44 #include "ash/shelf/shelf_layout_manager.h" | 43 #include "ash/shelf/shelf_layout_manager.h" |
45 #include "ash/shelf/shelf_model.h" | 44 #include "ash/shelf/shelf_model.h" |
46 #include "ash/shelf/shelf_widget.h" | 45 #include "ash/shelf/shelf_widget.h" |
47 #include "ash/shelf/shelf_window_watcher.h" | 46 #include "ash/shelf/shelf_window_watcher.h" |
48 #include "ash/shell_delegate.h" | 47 #include "ash/shell_delegate.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 | 541 |
543 void Shell::DoInitialWorkspaceAnimation() { | 542 void Shell::DoInitialWorkspaceAnimation() { |
544 return GetPrimaryRootWindowController()->workspace_controller()-> | 543 return GetPrimaryRootWindowController()->workspace_controller()-> |
545 DoInitialAnimation(); | 544 DoInitialAnimation(); |
546 } | 545 } |
547 | 546 |
548 //////////////////////////////////////////////////////////////////////////////// | 547 //////////////////////////////////////////////////////////////////////////////// |
549 // Shell, private: | 548 // Shell, private: |
550 | 549 |
551 Shell::Shell(ShellDelegate* delegate) | 550 Shell::Shell(ShellDelegate* delegate) |
552 : screen_(new ScreenAsh), | 551 : target_root_window_(NULL), |
553 target_root_window_(NULL), | |
554 scoped_target_root_window_(NULL), | 552 scoped_target_root_window_(NULL), |
555 delegate_(delegate), | 553 delegate_(delegate), |
556 window_positioner_(new WindowPositioner), | 554 window_positioner_(new WindowPositioner), |
557 activation_client_(NULL), | 555 activation_client_(NULL), |
558 #if defined(OS_CHROMEOS) && defined(USE_X11) | 556 #if defined(OS_CHROMEOS) && defined(USE_X11) |
559 output_configurator_(new chromeos::OutputConfigurator()), | 557 output_configurator_(new chromeos::OutputConfigurator()), |
560 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 558 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
561 native_cursor_manager_(new AshNativeCursorManager), | 559 native_cursor_manager_(new AshNativeCursorManager), |
562 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 560 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
563 native_cursor_manager_)), | 561 native_cursor_manager_)), |
564 simulate_modal_window_open_for_testing_(false), | 562 simulate_modal_window_open_for_testing_(false), |
565 is_touch_hud_projection_enabled_(false) { | 563 is_touch_hud_projection_enabled_(false) { |
566 DCHECK(delegate_.get()); | 564 DCHECK(delegate_.get()); |
567 display_manager_.reset(new internal::DisplayManager); | 565 display_manager_.reset(new internal::DisplayManager); |
568 | 566 |
569 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | 567 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, |
570 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | 568 display_manager_->screen()); |
571 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | 569 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) { |
572 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | 570 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, |
571 display_manager_->screen()); | |
572 } | |
Jun Mukai
2014/01/15 19:20:15
If the screen object is owned by DisplayManager, I
oshima
2014/01/15 19:42:51
That's good point, although I can't move the shutd
| |
573 display_controller_.reset(new DisplayController); | 573 display_controller_.reset(new DisplayController); |
574 #if defined(OS_CHROMEOS) && defined(USE_X11) | 574 #if defined(OS_CHROMEOS) && defined(USE_X11) |
575 bool is_panel_fitting_disabled = | 575 bool is_panel_fitting_disabled = |
576 content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 576 content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
577 gpu::GPU_FEATURE_TYPE_PANEL_FITTING); | 577 gpu::GPU_FEATURE_TYPE_PANEL_FITTING); |
578 | 578 |
579 output_configurator_->Init(!is_panel_fitting_disabled); | 579 output_configurator_->Init(!is_panel_fitting_disabled); |
580 user_metrics_recorder_.reset(new UserMetricsRecorder); | 580 user_metrics_recorder_.reset(new UserMetricsRecorder); |
581 | 581 |
582 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( | 582 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be | 684 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
685 // destroyed before |shelf_model_| is destroyed. | 685 // destroyed before |shelf_model_| is destroyed. |
686 shelf_item_delegate_manager_.reset(); | 686 shelf_item_delegate_manager_.reset(); |
687 shelf_model_.reset(); | 687 shelf_model_.reset(); |
688 | 688 |
689 power_button_controller_.reset(); | 689 power_button_controller_.reset(); |
690 lock_state_controller_.reset(); | 690 lock_state_controller_.reset(); |
691 | 691 |
692 resolution_notification_controller_.reset(); | 692 resolution_notification_controller_.reset(); |
693 desktop_background_controller_.reset(); | 693 desktop_background_controller_.reset(); |
694 bool native_is_alternative = | |
695 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE) == | |
696 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | |
697 gfx::Screen* for_shutdown = | |
698 display_manager_->CreateScreenForShutdown(); | |
699 // This object should be alive until the end. | |
700 ANNOTATE_LEAKING_OBJECT_PTR(for_shutdown); | |
701 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, for_shutdown); | |
702 if (native_is_alternative) | |
703 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, for_shutdown); | |
694 | 704 |
695 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 705 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
696 // DisplayController before resetting |display_controller_|, since destruction | 706 // DisplayController before resetting |display_controller_|, since destruction |
697 // of its owned RootWindowControllers relies on the value. | 707 // of its owned RootWindowControllers relies on the value. |
698 display_controller_->Shutdown(); | 708 display_controller_->Shutdown(); |
699 display_controller_.reset(); | 709 display_controller_.reset(); |
700 screen_position_controller_.reset(); | 710 screen_position_controller_.reset(); |
701 | 711 |
702 keyboard_controller_.reset(); | 712 keyboard_controller_.reset(); |
703 accessibility_delegate_.reset(); | 713 accessibility_delegate_.reset(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 root_window_host_factory_.reset(delegate_->CreateWindowTreeHostFactory()); | 797 root_window_host_factory_.reset(delegate_->CreateWindowTreeHostFactory()); |
788 | 798 |
789 display_controller_->Start(); | 799 display_controller_->Start(); |
790 display_controller_->InitPrimaryDisplay(); | 800 display_controller_->InitPrimaryDisplay(); |
791 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); | 801 aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); |
792 target_root_window_ = root_window; | 802 target_root_window_ = root_window; |
793 | 803 |
794 resolution_notification_controller_.reset( | 804 resolution_notification_controller_.reset( |
795 new internal::ResolutionNotificationController); | 805 new internal::ResolutionNotificationController); |
796 | 806 |
797 cursor_manager_.SetDisplay(DisplayController::GetPrimaryDisplay()); | 807 cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); |
798 | 808 |
799 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 809 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
800 accelerator_controller_.reset(new AcceleratorController); | 810 accelerator_controller_.reset(new AcceleratorController); |
801 | 811 |
802 // The order in which event filters are added is significant. | 812 // The order in which event filters are added is significant. |
803 event_rewriter_filter_.reset(new internal::EventRewriterEventFilter); | 813 event_rewriter_filter_.reset(new internal::EventRewriterEventFilter); |
804 AddPreTargetHandler(event_rewriter_filter_.get()); | 814 AddPreTargetHandler(event_rewriter_filter_.get()); |
805 | 815 |
806 #if defined(OS_CHROMEOS) | 816 #if defined(OS_CHROMEOS) |
807 // 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... | |
1041 //////////////////////////////////////////////////////////////////////////////// | 1051 //////////////////////////////////////////////////////////////////////////////// |
1042 // Shell, aura::client::ActivationChangeObserver implementation: | 1052 // Shell, aura::client::ActivationChangeObserver implementation: |
1043 | 1053 |
1044 void Shell::OnWindowActivated(aura::Window* gained_active, | 1054 void Shell::OnWindowActivated(aura::Window* gained_active, |
1045 aura::Window* lost_active) { | 1055 aura::Window* lost_active) { |
1046 if (gained_active) | 1056 if (gained_active) |
1047 target_root_window_ = gained_active->GetRootWindow(); | 1057 target_root_window_ = gained_active->GetRootWindow(); |
1048 } | 1058 } |
1049 | 1059 |
1050 } // namespace ash | 1060 } // namespace ash |
OLD | NEW |