| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/window_manager_application.h" | 5 #include "ash/mus/window_manager_application.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #endif | 89 #endif |
| 90 ShutdownComponents(); | 90 ShutdownComponents(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( | 93 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
| 94 AcceleratorRegistrarImpl* registrar) { | 94 AcceleratorRegistrarImpl* registrar) { |
| 95 accelerator_registrars_.erase(registrar); | 95 accelerator_registrars_.erase(registrar); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void WindowManagerApplication::InitWindowManager( | 98 void WindowManagerApplication::InitWindowManager( |
| 99 ui::WindowTreeClient* window_tree_client) { | 99 std::unique_ptr<ui::WindowTreeClient> window_tree_client) { |
| 100 InitializeComponents(); | 100 InitializeComponents(); |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 // TODO(jamescook): Refactor StatisticsProvider so we can get just the data | 102 // TODO(jamescook): Refactor StatisticsProvider so we can get just the data |
| 103 // we need in ash. Right now StatisticsProviderImpl launches the crossystem | 103 // we need in ash. Right now StatisticsProviderImpl launches the crossystem |
| 104 // binary to get system data, which we don't want to do twice on startup. | 104 // binary to get system data, which we don't want to do twice on startup. |
| 105 statistics_provider_.reset( | 105 statistics_provider_.reset( |
| 106 new chromeos::system::ScopedFakeStatisticsProvider()); | 106 new chromeos::system::ScopedFakeStatisticsProvider()); |
| 107 statistics_provider_->SetMachineStatistic("initial_locale", "en-US"); | 107 statistics_provider_->SetMachineStatistic("initial_locale", "en-US"); |
| 108 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); | 108 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); |
| 109 #endif | 109 #endif |
| 110 window_manager_->Init(window_tree_client); | 110 window_manager_->Init(std::move(window_tree_client)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WindowManagerApplication::OnStart(const shell::Identity& identity) { | 113 void WindowManagerApplication::OnStart(const shell::Identity& identity) { |
| 114 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); | 114 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); |
| 115 gpu_service_ = ui::GpuService::Create(connector()); | 115 gpu_service_ = ui::GpuService::Create(connector()); |
| 116 compositor_context_factory_.reset( | 116 compositor_context_factory_.reset( |
| 117 new views::SurfaceContextFactory(gpu_service_.get())); | 117 new views::SurfaceContextFactory(gpu_service_.get())); |
| 118 aura::Env::GetInstance()->set_context_factory( | 118 aura::Env::GetInstance()->set_context_factory( |
| 119 compositor_context_factory_.get()); | 119 compositor_context_factory_.get()); |
| 120 window_manager_.reset(new WindowManager(connector())); | 120 window_manager_.reset(new WindowManager(connector())); |
| 121 | 121 |
| 122 MaterialDesignController::Initialize(); | 122 MaterialDesignController::Initialize(); |
| 123 | 123 |
| 124 tracing_.Initialize(connector(), identity.name()); | 124 tracing_.Initialize(connector(), identity.name()); |
| 125 | 125 |
| 126 ui::WindowTreeClient* window_tree_client = new ui::WindowTreeClient( | 126 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
| 127 window_manager_.get(), window_manager_.get(), nullptr); | 127 base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(), |
| 128 window_manager_.get()); |
| 128 window_tree_client->ConnectAsWindowManager(connector()); | 129 window_tree_client->ConnectAsWindowManager(connector()); |
| 129 | 130 |
| 130 native_widget_factory_mus_.reset( | 131 native_widget_factory_mus_.reset( |
| 131 new NativeWidgetFactoryMus(window_manager_.get())); | 132 new NativeWidgetFactoryMus(window_manager_.get())); |
| 132 | 133 |
| 133 InitWindowManager(window_tree_client); | 134 InitWindowManager(std::move(window_tree_client)); |
| 134 } | 135 } |
| 135 | 136 |
| 136 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, | 137 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, |
| 137 shell::InterfaceRegistry* registry) { | 138 shell::InterfaceRegistry* registry) { |
| 138 registry->AddInterface<ash::mojom::ShelfController>(this); | 139 registry->AddInterface<ash::mojom::ShelfController>(this); |
| 139 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 140 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 140 if (remote_identity.name() == "mojo:mash_session") { | 141 if (remote_identity.name() == "mojo:mash_session") { |
| 141 connector()->ConnectToInterface(remote_identity, &session_); | 142 connector()->ConnectToInterface(remote_identity, &session_); |
| 142 session_->AddScreenlockStateListener( | 143 session_->AddScreenlockStateListener( |
| 143 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 144 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 172 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 173 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 173 base::Unretained(this)))); | 174 base::Unretained(this)))); |
| 174 } | 175 } |
| 175 | 176 |
| 176 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 177 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 177 window_manager_->SetScreenLocked(locked); | 178 window_manager_->SetScreenLocked(locked); |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace mus | 181 } // namespace mus |
| 181 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |