| 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/mus/accelerators/accelerator_registrar_impl.h" | 10 #include "ash/mus/accelerators/accelerator_registrar_impl.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 ShutdownComponents(); | 82 ShutdownComponents(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( | 85 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
| 86 AcceleratorRegistrarImpl* registrar) { | 86 AcceleratorRegistrarImpl* registrar) { |
| 87 accelerator_registrars_.erase(registrar); | 87 accelerator_registrars_.erase(registrar); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void WindowManagerApplication::InitWindowManager( | 90 void WindowManagerApplication::InitWindowManager( |
| 91 ::ui::WindowTreeClient* window_tree_client) { | 91 ui::WindowTreeClient* window_tree_client) { |
| 92 InitializeComponents(); | 92 InitializeComponents(); |
| 93 | 93 |
| 94 window_manager_->Init(window_tree_client); | 94 window_manager_->Init(window_tree_client); |
| 95 window_manager_->AddObserver(this); | 95 window_manager_->AddObserver(this); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void WindowManagerApplication::OnStart(const shell::Identity& identity) { | 98 void WindowManagerApplication::OnStart(const shell::Identity& identity) { |
| 99 ::ui::GpuService::Initialize(connector()); | 99 ui::GpuService::Initialize(connector()); |
| 100 window_manager_.reset(new WindowManager(connector())); | 100 window_manager_.reset(new WindowManager(connector())); |
| 101 | 101 |
| 102 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); | 102 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); |
| 103 MaterialDesignController::Initialize(); | 103 MaterialDesignController::Initialize(); |
| 104 | 104 |
| 105 tracing_.Initialize(connector(), identity.name()); | 105 tracing_.Initialize(connector(), identity.name()); |
| 106 | 106 |
| 107 ::ui::WindowTreeClient* window_tree_client = new ::ui::WindowTreeClient( | 107 ui::WindowTreeClient* window_tree_client = new ui::WindowTreeClient( |
| 108 window_manager_.get(), window_manager_.get(), nullptr); | 108 window_manager_.get(), window_manager_.get(), nullptr); |
| 109 window_tree_client->ConnectAsWindowManager(connector()); | 109 window_tree_client->ConnectAsWindowManager(connector()); |
| 110 | 110 |
| 111 InitWindowManager(window_tree_client); | 111 InitWindowManager(window_tree_client); |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool WindowManagerApplication::OnConnect(shell::Connection* connection) { | 114 bool WindowManagerApplication::OnConnect(shell::Connection* connection) { |
| 115 connection->AddInterface<mojom::ShelfLayout>(this); | 115 connection->AddInterface<mojom::ShelfLayout>(this); |
| 116 connection->AddInterface<mojom::UserWindowController>(this); | 116 connection->AddInterface<mojom::UserWindowController>(this); |
| 117 connection->AddInterface<::ui::mojom::AcceleratorRegistrar>(this); | 117 connection->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 118 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") { | 118 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") { |
| 119 connection->GetInterface(&session_); | 119 connection->GetInterface(&session_); |
| 120 session_->AddScreenlockStateListener( | 120 session_->AddScreenlockStateListener( |
| 121 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 121 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 122 } | 122 } |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void WindowManagerApplication::Create( | 126 void WindowManagerApplication::Create( |
| 127 const shell::Identity& remote_identity, | 127 const shell::Identity& remote_identity, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 140 if (!window_manager_->GetRootWindowControllers().empty()) { | 140 if (!window_manager_->GetRootWindowControllers().empty()) { |
| 141 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), | 141 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
| 142 std::move(request)); | 142 std::move(request)); |
| 143 } else { | 143 } else { |
| 144 user_window_controller_requests_.push_back(std::move(request)); | 144 user_window_controller_requests_.push_back(std::move(request)); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 void WindowManagerApplication::Create( | 148 void WindowManagerApplication::Create( |
| 149 const shell::Identity& remote_identity, | 149 const shell::Identity& remote_identity, |
| 150 mojo::InterfaceRequest<::ui::mojom::AcceleratorRegistrar> request) { | 150 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) { |
| 151 if (!window_manager_->window_manager_client()) | 151 if (!window_manager_->window_manager_client()) |
| 152 return; // Can happen during shutdown. | 152 return; // Can happen during shutdown. |
| 153 | 153 |
| 154 uint16_t accelerator_namespace_id; | 154 uint16_t accelerator_namespace_id; |
| 155 if (!window_manager_->GetNextAcceleratorNamespaceId( | 155 if (!window_manager_->GetNextAcceleratorNamespaceId( |
| 156 &accelerator_namespace_id)) { | 156 &accelerator_namespace_id)) { |
| 157 DVLOG(1) << "Max number of accelerators registered, ignoring request."; | 157 DVLOG(1) << "Max number of accelerators registered, ignoring request."; |
| 158 // All ids are used. Normally shouldn't happen, so we close the connection. | 158 // All ids are used. Normally shouldn't happen, so we close the connection. |
| 159 return; | 159 return; |
| 160 } | 160 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 RootWindowController* controller) { | 198 RootWindowController* controller) { |
| 199 // TODO(msw): this isn't right, ownership should belong in WindowManager | 199 // TODO(msw): this isn't right, ownership should belong in WindowManager |
| 200 // and/or RootWindowController. But this is temporary until we get rid of | 200 // and/or RootWindowController. But this is temporary until we get rid of |
| 201 // sysui. | 201 // sysui. |
| 202 shelf_layout_.reset(); | 202 shelf_layout_.reset(); |
| 203 user_window_controller_.reset(); | 203 user_window_controller_.reset(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace mus | 206 } // namespace mus |
| 207 } // namespace ash | 207 } // namespace ash |
| OLD | NEW |