Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: ash/mus/window_manager_application.cc

Issue 2235493002: mash: Disable ash_sysui; begin removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Connect to chrome on mash session launch; add missing gn dep. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/mus/window_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ash/mus/root_window_controller.h"
12 #include "ash/mus/shelf_layout_impl.h"
13 #include "ash/mus/user_window_controller_impl.h"
14 #include "ash/mus/window_manager.h" 11 #include "ash/mus/window_manager.h"
15 #include "base/bind.h" 12 #include "base/bind.h"
16 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
17 #include "services/shell/public/cpp/connection.h" 14 #include "services/shell/public/cpp/connection.h"
18 #include "services/shell/public/cpp/connector.h" 15 #include "services/shell/public/cpp/connector.h"
19 #include "services/tracing/public/cpp/provider.h" 16 #include "services/tracing/public/cpp/provider.h"
20 #include "services/ui/common/event_matcher_util.h" 17 #include "services/ui/common/event_matcher_util.h"
21 #include "services/ui/common/gpu_service.h" 18 #include "services/ui/common/gpu_service.h"
22 #include "services/ui/public/cpp/window.h" 19 #include "services/ui/public/cpp/window.h"
23 #include "services/ui/public/cpp/window_tree_client.h" 20 #include "services/ui/public/cpp/window_tree_client.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( 82 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed(
86 AcceleratorRegistrarImpl* registrar) { 83 AcceleratorRegistrarImpl* registrar) {
87 accelerator_registrars_.erase(registrar); 84 accelerator_registrars_.erase(registrar);
88 } 85 }
89 86
90 void WindowManagerApplication::InitWindowManager( 87 void WindowManagerApplication::InitWindowManager(
91 ui::WindowTreeClient* window_tree_client) { 88 ui::WindowTreeClient* window_tree_client) {
92 InitializeComponents(); 89 InitializeComponents();
93 90
94 window_manager_->Init(window_tree_client); 91 window_manager_->Init(window_tree_client);
95 window_manager_->AddObserver(this);
96 } 92 }
97 93
98 void WindowManagerApplication::OnStart(const shell::Identity& identity) { 94 void WindowManagerApplication::OnStart(const shell::Identity& identity) {
99 gpu_service_ = ui::GpuService::Initialize(connector()); 95 gpu_service_ = ui::GpuService::Initialize(connector());
100 window_manager_.reset(new WindowManager(connector())); 96 window_manager_.reset(new WindowManager(connector()));
101 97
102 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); 98 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak"));
103 MaterialDesignController::Initialize(); 99 MaterialDesignController::Initialize();
104 100
105 tracing_.Initialize(connector(), identity.name()); 101 tracing_.Initialize(connector(), identity.name());
106 102
107 ui::WindowTreeClient* window_tree_client = new ui::WindowTreeClient( 103 ui::WindowTreeClient* window_tree_client = new ui::WindowTreeClient(
108 window_manager_.get(), window_manager_.get(), nullptr); 104 window_manager_.get(), window_manager_.get(), nullptr);
109 window_tree_client->ConnectAsWindowManager(connector()); 105 window_tree_client->ConnectAsWindowManager(connector());
110 106
111 InitWindowManager(window_tree_client); 107 InitWindowManager(window_tree_client);
112 } 108 }
113 109
114 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, 110 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
115 shell::InterfaceRegistry* registry) { 111 shell::InterfaceRegistry* registry) {
116 registry->AddInterface<mojom::ShelfLayout>(this);
117 registry->AddInterface<mojom::UserWindowController>(this);
118 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); 112 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this);
119 if (remote_identity.name() == "mojo:mash_session") { 113 if (remote_identity.name() == "mojo:mash_session") {
120 connector()->ConnectToInterface(remote_identity, &session_); 114 connector()->ConnectToInterface(remote_identity, &session_);
121 session_->AddScreenlockStateListener( 115 session_->AddScreenlockStateListener(
122 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); 116 screenlock_state_listener_binding_.CreateInterfacePtrAndBind());
123 } 117 }
124 return true; 118 return true;
125 } 119 }
126 120
127 void WindowManagerApplication::Create( 121 void WindowManagerApplication::Create(
128 const shell::Identity& remote_identity, 122 const shell::Identity& remote_identity,
129 mojo::InterfaceRequest<mojom::ShelfLayout> request) {
130 // TODO(msw): Handle multiple shelves (one per display).
131 if (!window_manager_->GetRootWindowControllers().empty()) {
132 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request));
133 } else {
134 shelf_layout_requests_.push_back(std::move(request));
135 }
136 }
137
138 void WindowManagerApplication::Create(
139 const shell::Identity& remote_identity,
140 mojo::InterfaceRequest<mojom::UserWindowController> request) {
141 if (!window_manager_->GetRootWindowControllers().empty()) {
142 user_window_controller_bindings_.AddBinding(user_window_controller_.get(),
143 std::move(request));
144 } else {
145 user_window_controller_requests_.push_back(std::move(request));
146 }
147 }
148
149 void WindowManagerApplication::Create(
150 const shell::Identity& remote_identity,
151 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) { 123 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) {
152 if (!window_manager_->window_manager_client()) 124 if (!window_manager_->window_manager_client())
153 return; // Can happen during shutdown. 125 return; // Can happen during shutdown.
154 126
155 uint16_t accelerator_namespace_id; 127 uint16_t accelerator_namespace_id;
156 if (!window_manager_->GetNextAcceleratorNamespaceId( 128 if (!window_manager_->GetNextAcceleratorNamespaceId(
157 &accelerator_namespace_id)) { 129 &accelerator_namespace_id)) {
158 DVLOG(1) << "Max number of accelerators registered, ignoring request."; 130 DVLOG(1) << "Max number of accelerators registered, ignoring request.";
159 // All ids are used. Normally shouldn't happen, so we close the connection. 131 // All ids are used. Normally shouldn't happen, so we close the connection.
160 return; 132 return;
161 } 133 }
162 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( 134 accelerator_registrars_.insert(new AcceleratorRegistrarImpl(
163 window_manager_.get(), accelerator_namespace_id, std::move(request), 135 window_manager_.get(), accelerator_namespace_id, std::move(request),
164 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, 136 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
165 base::Unretained(this)))); 137 base::Unretained(this))));
166 } 138 }
167 139
168 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { 140 void WindowManagerApplication::ScreenlockStateChanged(bool locked) {
169 window_manager_->SetScreenLocked(locked); 141 window_manager_->SetScreenLocked(locked);
170 } 142 }
171 143
172 void WindowManagerApplication::OnRootWindowControllerAdded(
173 RootWindowController* controller) {
174 if (user_window_controller_)
175 return;
176
177 // TODO(sky): |shelf_layout_| and |user_window_controller_| should really
178 // be owned by WindowManager and/or RootWindowController. But this code is
179 // temporary while migrating away from sysui.
180
181 shelf_layout_.reset(new ShelfLayoutImpl);
182 user_window_controller_.reset(new UserWindowControllerImpl());
183
184 // TODO(msw): figure out if this should be per display, or global.
185 user_window_controller_->Initialize(controller);
186 for (auto& request : user_window_controller_requests_)
187 user_window_controller_bindings_.AddBinding(user_window_controller_.get(),
188 std::move(request));
189 user_window_controller_requests_.clear();
190
191 // TODO(msw): figure out if this should be per display, or global.
192 shelf_layout_->Initialize(controller);
193 for (auto& request : shelf_layout_requests_)
194 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request));
195 shelf_layout_requests_.clear();
196 }
197
198 void WindowManagerApplication::OnWillDestroyRootWindowController(
199 RootWindowController* controller) {
200 // TODO(msw): this isn't right, ownership should belong in WindowManager
201 // and/or RootWindowController. But this is temporary until we get rid of
202 // sysui.
203 shelf_layout_.reset();
204 user_window_controller_.reset();
205 }
206
207 } // namespace mus 144 } // namespace mus
208 } // namespace ash 145 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/mus/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698