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/accelerometer/accelerometer_controller.h" |
14 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
15 #include "ash/autoclick/autoclick_controller.h" | 16 #include "ash/autoclick/autoclick_controller.h" |
16 #include "ash/desktop_background/desktop_background_controller.h" | 17 #include "ash/desktop_background/desktop_background_controller.h" |
17 #include "ash/desktop_background/desktop_background_view.h" | 18 #include "ash/desktop_background/desktop_background_view.h" |
18 #include "ash/desktop_background/user_wallpaper_delegate.h" | 19 #include "ash/desktop_background/user_wallpaper_delegate.h" |
19 #include "ash/display/cursor_window_controller.h" | 20 #include "ash/display/cursor_window_controller.h" |
20 #include "ash/display/display_controller.h" | 21 #include "ash/display/display_controller.h" |
21 #include "ash/display/display_manager.h" | 22 #include "ash/display/display_manager.h" |
22 #include "ash/display/event_transformation_handler.h" | 23 #include "ash/display/event_transformation_handler.h" |
23 #include "ash/display/mouse_cursor_event_filter.h" | 24 #include "ash/display/mouse_cursor_event_filter.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 600 |
600 //////////////////////////////////////////////////////////////////////////////// | 601 //////////////////////////////////////////////////////////////////////////////// |
601 // Shell, private: | 602 // Shell, private: |
602 | 603 |
603 Shell::Shell(ShellDelegate* delegate) | 604 Shell::Shell(ShellDelegate* delegate) |
604 : target_root_window_(NULL), | 605 : target_root_window_(NULL), |
605 scoped_target_root_window_(NULL), | 606 scoped_target_root_window_(NULL), |
606 delegate_(delegate), | 607 delegate_(delegate), |
607 window_positioner_(new WindowPositioner), | 608 window_positioner_(new WindowPositioner), |
608 activation_client_(NULL), | 609 activation_client_(NULL), |
| 610 accelerometer_controller_(new AccelerometerController()), |
609 #if defined(OS_CHROMEOS) | 611 #if defined(OS_CHROMEOS) |
610 output_configurator_(new ui::OutputConfigurator()), | 612 output_configurator_(new ui::OutputConfigurator()), |
611 #endif // defined(OS_CHROMEOS) | 613 #endif // defined(OS_CHROMEOS) |
612 native_cursor_manager_(new AshNativeCursorManager), | 614 native_cursor_manager_(new AshNativeCursorManager), |
613 cursor_manager_( | 615 cursor_manager_( |
614 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), | 616 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), |
615 simulate_modal_window_open_for_testing_(false), | 617 simulate_modal_window_open_for_testing_(false), |
616 is_touch_hud_projection_enabled_(false) { | 618 is_touch_hud_projection_enabled_(false) { |
617 DCHECK(delegate_.get()); | 619 DCHECK(delegate_.get()); |
618 gpu_support_.reset(delegate_->CreateGPUSupport()); | 620 gpu_support_.reset(delegate_->CreateGPUSupport()); |
619 display_manager_.reset(new internal::DisplayManager); | 621 display_manager_.reset(new internal::DisplayManager); |
| 622 accelerometer_controller_->AddObserver(display_manager_.get()); |
620 display_controller_.reset(new DisplayController); | 623 display_controller_.reset(new DisplayController); |
621 #if defined(OS_CHROMEOS) && defined(USE_X11) | 624 #if defined(OS_CHROMEOS) && defined(USE_X11) |
622 user_metrics_recorder_.reset(new UserMetricsRecorder); | 625 user_metrics_recorder_.reset(new UserMetricsRecorder); |
623 #endif // defined(OS_CHROMEOS) | 626 #endif // defined(OS_CHROMEOS) |
624 | 627 |
625 #if defined(OS_CHROMEOS) | 628 #if defined(OS_CHROMEOS) |
626 internal::PowerStatus::Initialize(); | 629 internal::PowerStatus::Initialize(); |
627 #endif | 630 #endif |
628 } | 631 } |
629 | 632 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 lock_state_controller_.reset(); | 748 lock_state_controller_.reset(); |
746 | 749 |
747 #if defined(OS_CHROMEOS) | 750 #if defined(OS_CHROMEOS) |
748 resolution_notification_controller_.reset(); | 751 resolution_notification_controller_.reset(); |
749 #endif | 752 #endif |
750 desktop_background_controller_.reset(); | 753 desktop_background_controller_.reset(); |
751 | 754 |
752 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 755 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
753 // DisplayController before resetting |display_controller_|, since destruction | 756 // DisplayController before resetting |display_controller_|, since destruction |
754 // of its owned RootWindowControllers relies on the value. | 757 // of its owned RootWindowControllers relies on the value. |
| 758 accelerometer_controller_->RemoveObserver(display_manager_.get()); |
755 display_manager_->CreateScreenForShutdown(); | 759 display_manager_->CreateScreenForShutdown(); |
756 display_controller_->Shutdown(); | 760 display_controller_->Shutdown(); |
757 display_controller_.reset(); | 761 display_controller_.reset(); |
758 screen_position_controller_.reset(); | 762 screen_position_controller_.reset(); |
759 | 763 |
760 keyboard_controller_.reset(); | 764 keyboard_controller_.reset(); |
761 accessibility_delegate_.reset(); | 765 accessibility_delegate_.reset(); |
762 new_window_delegate_.reset(); | 766 new_window_delegate_.reset(); |
763 media_delegate_.reset(); | 767 media_delegate_.reset(); |
764 | 768 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 //////////////////////////////////////////////////////////////////////////////// | 1119 //////////////////////////////////////////////////////////////////////////////// |
1116 // Shell, aura::client::ActivationChangeObserver implementation: | 1120 // Shell, aura::client::ActivationChangeObserver implementation: |
1117 | 1121 |
1118 void Shell::OnWindowActivated(aura::Window* gained_active, | 1122 void Shell::OnWindowActivated(aura::Window* gained_active, |
1119 aura::Window* lost_active) { | 1123 aura::Window* lost_active) { |
1120 if (gained_active) | 1124 if (gained_active) |
1121 target_root_window_ = gained_active->GetRootWindow(); | 1125 target_root_window_ = gained_active->GetRootWindow(); |
1122 } | 1126 } |
1123 | 1127 |
1124 } // namespace ash | 1128 } // namespace ash |
OLD | NEW |