| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 #include "ui/wm/core/visibility_controller.h" | 108 #include "ui/wm/core/visibility_controller.h" |
| 109 #include "ui/wm/core/window_modality_controller.h" | 109 #include "ui/wm/core/window_modality_controller.h" |
| 110 | 110 |
| 111 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
| 112 #if defined(USE_X11) | 112 #if defined(USE_X11) |
| 113 #include "ui/gfx/x/x11_types.h" // nogncheck | 113 #include "ui/gfx/x/x11_types.h" // nogncheck |
| 114 #endif // defined(USE_X11) | 114 #endif // defined(USE_X11) |
| 115 #include "ash/accelerators/magnifier_key_scroller.h" | 115 #include "ash/accelerators/magnifier_key_scroller.h" |
| 116 #include "ash/accelerators/spoken_feedback_toggler.h" | 116 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 117 #include "ash/common/ash_constants.h" | 117 #include "ash/common/ash_constants.h" |
| 118 #include "ash/common/dbus_thread_manager_ash.h" |
| 118 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller
.h" | 119 #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller
.h" |
| 119 #include "ash/common/system/chromeos/power/power_status.h" | 120 #include "ash/common/system/chromeos/power/power_status.h" |
| 120 #include "ash/display/display_change_observer_chromeos.h" | 121 #include "ash/display/display_change_observer_chromeos.h" |
| 121 #include "ash/display/display_color_manager_chromeos.h" | 122 #include "ash/display/display_color_manager_chromeos.h" |
| 122 #include "ash/display/display_error_observer_chromeos.h" | 123 #include "ash/display/display_error_observer_chromeos.h" |
| 123 #include "ash/display/projecting_observer_chromeos.h" | 124 #include "ash/display/projecting_observer_chromeos.h" |
| 124 #include "ash/display/resolution_notification_controller.h" | 125 #include "ash/display/resolution_notification_controller.h" |
| 125 #include "ash/display/screen_orientation_controller_chromeos.h" | 126 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 126 #include "ash/sticky_keys/sticky_keys_controller.h" | 127 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 127 #include "ash/system/chromeos/power/power_event_observer.h" | 128 #include "ash/system/chromeos/power/power_event_observer.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 native_cursor_manager_(nullptr), | 497 native_cursor_manager_(nullptr), |
| 497 simulate_modal_window_open_for_testing_(false), | 498 simulate_modal_window_open_for_testing_(false), |
| 498 is_touch_hud_projection_enabled_(false) { | 499 is_touch_hud_projection_enabled_(false) { |
| 499 DCHECK(aura::Env::GetInstanceDontCreate()); | 500 DCHECK(aura::Env::GetInstanceDontCreate()); |
| 500 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport()); | 501 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport()); |
| 501 display_manager_.reset(ScreenAsh::CreateDisplayManager()); | 502 display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
| 502 window_tree_host_manager_.reset(new WindowTreeHostManager); | 503 window_tree_host_manager_.reset(new WindowTreeHostManager); |
| 503 user_metrics_recorder_.reset(new UserMetricsRecorder); | 504 user_metrics_recorder_.reset(new UserMetricsRecorder); |
| 504 | 505 |
| 505 #if defined(OS_CHROMEOS) | 506 #if defined(OS_CHROMEOS) |
| 507 DCHECK(DBusThreadManagerAsh::Get()); |
| 506 PowerStatus::Initialize(); | 508 PowerStatus::Initialize(); |
| 507 #endif | 509 #endif |
| 508 } | 510 } |
| 509 | 511 |
| 510 Shell::~Shell() { | 512 Shell::~Shell() { |
| 511 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); | 513 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); |
| 512 | 514 |
| 513 user_metrics_recorder_->OnShellShuttingDown(); | 515 user_metrics_recorder_->OnShellShuttingDown(); |
| 514 | 516 |
| 515 wm_shell_->delegate()->PreShutdown(); | 517 wm_shell_->delegate()->PreShutdown(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 display_configurator_->RemoveObserver(display_error_observer_.get()); | 660 display_configurator_->RemoveObserver(display_error_observer_.get()); |
| 659 if (projecting_observer_) { | 661 if (projecting_observer_) { |
| 660 display_configurator_->RemoveObserver(projecting_observer_.get()); | 662 display_configurator_->RemoveObserver(projecting_observer_.get()); |
| 661 wm_shell_->RemoveShellObserver(projecting_observer_.get()); | 663 wm_shell_->RemoveShellObserver(projecting_observer_.get()); |
| 662 } | 664 } |
| 663 display_change_observer_.reset(); | 665 display_change_observer_.reset(); |
| 664 | 666 |
| 665 PowerStatus::Shutdown(); | 667 PowerStatus::Shutdown(); |
| 666 | 668 |
| 667 // Ensure that DBusThreadManager outlives this Shell. | 669 // Ensure that DBusThreadManager outlives this Shell. |
| 668 DCHECK(chromeos::DBusThreadManager::IsInitialized()); | 670 // DCHECK(chromeos::DBusThreadManager::IsInitialized()); |
| 671 DCHECK(DBusThreadManagerAsh::Get());//IsInitialized? |
| 669 #endif | 672 #endif |
| 670 | 673 |
| 671 // Needs to happen right before |instance_| is reset. | 674 // Needs to happen right before |instance_| is reset. |
| 672 wm_shell_.reset(); | 675 wm_shell_.reset(); |
| 673 | 676 |
| 674 DCHECK(instance_ == this); | 677 DCHECK(instance_ == this); |
| 675 instance_ = nullptr; | 678 instance_ = nullptr; |
| 676 } | 679 } |
| 677 | 680 |
| 678 void Shell::Init(const ShellInitParams& init_params) { | 681 void Shell::Init(const ShellInitParams& init_params) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), | 721 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), |
| 719 !gpu_support_->IsPanelFittingDisabled()); | 722 !gpu_support_->IsPanelFittingDisabled()); |
| 720 #elif defined(USE_X11) | 723 #elif defined(USE_X11) |
| 721 display_configurator_->Init( | 724 display_configurator_->Init( |
| 722 base::MakeUnique<ui::NativeDisplayDelegateX11>(), | 725 base::MakeUnique<ui::NativeDisplayDelegateX11>(), |
| 723 !gpu_support_->IsPanelFittingDisabled()); | 726 !gpu_support_->IsPanelFittingDisabled()); |
| 724 #endif | 727 #endif |
| 725 } | 728 } |
| 726 | 729 |
| 727 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. | 730 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. |
| 728 chromeos::DBusThreadManager* dbus_thread_manager = | 731 projecting_observer_.reset(new ProjectingObserver( |
| 729 chromeos::DBusThreadManager::Get(); | 732 DBusThreadManagerAsh::Get()->GetPowerManagerClient())); |
| 730 projecting_observer_.reset( | |
| 731 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); | |
| 732 display_configurator_->AddObserver(projecting_observer_.get()); | 733 display_configurator_->AddObserver(projecting_observer_.get()); |
| 733 wm_shell_->AddShellObserver(projecting_observer_.get()); | 734 wm_shell_->AddShellObserver(projecting_observer_.get()); |
| 734 | 735 |
| 735 if (!in_mus_ && !display_initialized && | 736 if (!in_mus_ && !display_initialized && |
| 736 base::SysInfo::IsRunningOnChromeOS()) { | 737 base::SysInfo::IsRunningOnChromeOS()) { |
| 737 display_change_observer_.reset(new DisplayChangeObserver); | 738 display_change_observer_.reset(new DisplayChangeObserver); |
| 738 // Register |display_change_observer_| first so that the rest of | 739 // Register |display_change_observer_| first so that the rest of |
| 739 // observer gets invoked after the root windows are configured. | 740 // observer gets invoked after the root windows are configured. |
| 740 display_configurator_->AddObserver(display_change_observer_.get()); | 741 display_configurator_->AddObserver(display_change_observer_.get()); |
| 741 display_error_observer_.reset(new DisplayErrorObserver()); | 742 display_error_observer_.reset(new DisplayErrorObserver()); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 1020 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
| 1020 return std::unique_ptr<ui::EventTargetIterator>(); | 1021 return std::unique_ptr<ui::EventTargetIterator>(); |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 ui::EventTargeter* Shell::GetEventTargeter() { | 1024 ui::EventTargeter* Shell::GetEventTargeter() { |
| 1024 NOTREACHED(); | 1025 NOTREACHED(); |
| 1025 return nullptr; | 1026 return nullptr; |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 } // namespace ash | 1029 } // namespace ash |
| OLD | NEW |