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/mus/accelerator_registrar_impl.h" | 9 #include "ash/mus/accelerator_registrar_impl.h" |
10 #include "ash/mus/root_window_controller.h" | 10 #include "ash/mus/root_window_controller.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 void WindowManagerApplication::Create( | 86 void WindowManagerApplication::Create( |
87 shell::Connection* connection, | 87 shell::Connection* connection, |
88 mojo::InterfaceRequest<mojom::ShelfLayout> request) { | 88 mojo::InterfaceRequest<mojom::ShelfLayout> request) { |
89 // TODO(msw): Handle multiple shelves (one per display). | 89 // TODO(msw): Handle multiple shelves (one per display). |
90 if (!window_manager_->GetRootWindowControllers().empty()) { | 90 if (!window_manager_->GetRootWindowControllers().empty()) { |
91 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request)); | 91 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request)); |
92 } else { | 92 } else { |
93 shelf_layout_requests_.push_back(base::WrapUnique( | 93 shelf_layout_requests_.push_back(std::move(request)); |
94 new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request)))); | |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
98 void WindowManagerApplication::Create( | 97 void WindowManagerApplication::Create( |
99 shell::Connection* connection, | 98 shell::Connection* connection, |
100 mojo::InterfaceRequest<mojom::UserWindowController> request) { | 99 mojo::InterfaceRequest<mojom::UserWindowController> request) { |
101 if (!window_manager_->GetRootWindowControllers().empty()) { | 100 if (!window_manager_->GetRootWindowControllers().empty()) { |
102 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), | 101 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
103 std::move(request)); | 102 std::move(request)); |
104 } else { | 103 } else { |
105 user_window_controller_requests_.push_back(base::WrapUnique( | 104 user_window_controller_requests_.push_back(std::move(request)); |
106 new mojo::InterfaceRequest<mojom::UserWindowController>( | |
107 std::move(request)))); | |
108 } | 105 } |
109 } | 106 } |
110 | 107 |
111 void WindowManagerApplication::Create( | 108 void WindowManagerApplication::Create( |
112 shell::Connection* connection, | 109 shell::Connection* connection, |
113 mojo::InterfaceRequest<::mus::mojom::AcceleratorRegistrar> request) { | 110 mojo::InterfaceRequest<::mus::mojom::AcceleratorRegistrar> request) { |
114 if (!window_manager_->window_manager_client()) | 111 if (!window_manager_->window_manager_client()) |
115 return; // Can happen during shutdown. | 112 return; // Can happen during shutdown. |
116 | 113 |
117 static int accelerator_registrar_count = 0; | 114 static int accelerator_registrar_count = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
142 // be owned by WindowManager and/or RootWindowController. But this code is | 139 // be owned by WindowManager and/or RootWindowController. But this code is |
143 // temporary while migrating away from sysui. | 140 // temporary while migrating away from sysui. |
144 | 141 |
145 shelf_layout_.reset(new ShelfLayoutImpl); | 142 shelf_layout_.reset(new ShelfLayoutImpl); |
146 user_window_controller_.reset(new UserWindowControllerImpl()); | 143 user_window_controller_.reset(new UserWindowControllerImpl()); |
147 | 144 |
148 // TODO(msw): figure out if this should be per display, or global. | 145 // TODO(msw): figure out if this should be per display, or global. |
149 user_window_controller_->Initialize(controller); | 146 user_window_controller_->Initialize(controller); |
150 for (auto& request : user_window_controller_requests_) | 147 for (auto& request : user_window_controller_requests_) |
151 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), | 148 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
152 std::move(*request)); | 149 std::move(request)); |
153 user_window_controller_requests_.clear(); | 150 user_window_controller_requests_.clear(); |
154 | 151 |
155 // TODO(msw): figure out if this should be per display, or global. | 152 // TODO(msw): figure out if this should be per display, or global. |
156 shelf_layout_->Initialize(controller); | 153 shelf_layout_->Initialize(controller); |
157 for (auto& request : shelf_layout_requests_) | 154 for (auto& request : shelf_layout_requests_) |
158 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(*request)); | 155 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request)); |
159 shelf_layout_requests_.clear(); | 156 shelf_layout_requests_.clear(); |
160 } | 157 } |
161 | 158 |
162 void WindowManagerApplication::OnWillDestroyRootWindowController( | 159 void WindowManagerApplication::OnWillDestroyRootWindowController( |
163 RootWindowController* controller) { | 160 RootWindowController* controller) { |
164 // TODO(msw): this isn't right, ownership should belong in WindowManager | 161 // TODO(msw): this isn't right, ownership should belong in WindowManager |
165 // and/or RootWindowController. But this is temporary until we get rid of | 162 // and/or RootWindowController. But this is temporary until we get rid of |
166 // sysui. | 163 // sysui. |
167 shelf_layout_.reset(); | 164 shelf_layout_.reset(); |
168 user_window_controller_.reset(); | 165 user_window_controller_.reset(); |
169 } | 166 } |
170 | 167 |
171 } // namespace mus | 168 } // namespace mus |
172 } // namespace ash | 169 } // namespace ash |
OLD | NEW |