| 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 "mash/wm/window_manager_application.h" | 5 #include "mash/wm/window_manager_application.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 connector_->ConnectToInterface("mojo:mus", &wm_factory_service); | 138 connector_->ConnectToInterface("mojo:mus", &wm_factory_service); |
| 139 wm_factory_service->SetWindowManagerFactory( | 139 wm_factory_service->SetWindowManagerFactory( |
| 140 window_manager_factory_binding_.CreateInterfacePtrAndBind()); | 140 window_manager_factory_binding_.CreateInterfacePtrAndBind()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 shelf_layout_.reset(new ShelfLayoutImpl); | 143 shelf_layout_.reset(new ShelfLayoutImpl); |
| 144 user_window_controller_.reset(new UserWindowControllerImpl()); | 144 user_window_controller_.reset(new UserWindowControllerImpl()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) { | 147 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) { |
| 148 connection->AddInterface<mojom::ShelfLayout>(this); | 148 connection->AddInterface<ash::mojom::ShelfLayout>(this); |
| 149 connection->AddInterface<mojom::UserWindowController>(this); | 149 connection->AddInterface<ash::mojom::UserWindowController>(this); |
| 150 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); | 150 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); |
| 151 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") | 151 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") |
| 152 connection->GetInterface(&session_); | 152 connection->GetInterface(&session_); |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WindowManagerApplication::Create( | 156 void WindowManagerApplication::Create( |
| 157 shell::Connection* connection, | 157 shell::Connection* connection, |
| 158 mojo::InterfaceRequest<mojom::ShelfLayout> request) { | 158 mojo::InterfaceRequest<ash::mojom::ShelfLayout> request) { |
| 159 // TODO(msw): Handle multiple shelves (one per display). | 159 // TODO(msw): Handle multiple shelves (one per display). |
| 160 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { | 160 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { |
| 161 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request)); | 161 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request)); |
| 162 } else { | 162 } else { |
| 163 shelf_layout_requests_.push_back(base::WrapUnique( | 163 shelf_layout_requests_.push_back( |
| 164 new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request)))); | 164 base::WrapUnique(new mojo::InterfaceRequest<ash::mojom::ShelfLayout>( |
| 165 std::move(request)))); |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 | 168 |
| 168 void WindowManagerApplication::Create( | 169 void WindowManagerApplication::Create( |
| 169 shell::Connection* connection, | 170 shell::Connection* connection, |
| 170 mojo::InterfaceRequest<mojom::UserWindowController> request) { | 171 mojo::InterfaceRequest<ash::mojom::UserWindowController> request) { |
| 171 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { | 172 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { |
| 172 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), | 173 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
| 173 std::move(request)); | 174 std::move(request)); |
| 174 } else { | 175 } else { |
| 175 user_window_controller_requests_.push_back(base::WrapUnique( | 176 user_window_controller_requests_.push_back(base::WrapUnique( |
| 176 new mojo::InterfaceRequest<mojom::UserWindowController>( | 177 new mojo::InterfaceRequest<ash::mojom::UserWindowController>( |
| 177 std::move(request)))); | 178 std::move(request)))); |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 void WindowManagerApplication::Create( | 182 void WindowManagerApplication::Create( |
| 182 shell::Connection* connection, | 183 shell::Connection* connection, |
| 183 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { | 184 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { |
| 184 static int accelerator_registrar_count = 0; | 185 static int accelerator_registrar_count = 0; |
| 185 if (accelerator_registrar_count == std::numeric_limits<int>::max()) { | 186 if (accelerator_registrar_count == std::numeric_limits<int>::max()) { |
| 186 // Restart from zero if we have reached the limit. It is technically | 187 // Restart from zero if we have reached the limit. It is technically |
| (...skipping 11 matching lines...) Expand all Loading... |
| 198 | 199 |
| 199 void WindowManagerApplication::CreateWindowManager( | 200 void WindowManagerApplication::CreateWindowManager( |
| 200 mus::mojom::DisplayPtr display, | 201 mus::mojom::DisplayPtr display, |
| 201 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { | 202 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { |
| 202 AddRootWindowController(RootWindowController::CreateFromDisplay( | 203 AddRootWindowController(RootWindowController::CreateFromDisplay( |
| 203 this, std::move(display), std::move(client_request))); | 204 this, std::move(display), std::move(client_request))); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace wm | 207 } // namespace wm |
| 207 } // namespace mash | 208 } // namespace mash |
| OLD | NEW |