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

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

Issue 2323063003: mash: Port sysui's WallpaperDelegateMus to mojo:ash. (Closed)
Patch Set: Alternative display info workaround. Created 4 years, 3 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
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/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
11 #include "ash/mus/accelerators/accelerator_registrar_impl.h" 11 #include "ash/mus/accelerators/accelerator_registrar_impl.h"
12 #include "ash/mus/native_widget_factory_mus.h" 12 #include "ash/mus/native_widget_factory_mus.h"
13 #include "ash/mus/shelf_delegate_mus.h" 13 #include "ash/mus/shelf_delegate_mus.h"
14 #include "ash/mus/wallpaper_delegate_mus.h"
14 #include "ash/mus/window_manager.h" 15 #include "ash/mus/window_manager.h"
15 #include "base/bind.h" 16 #include "base/bind.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "services/shell/public/cpp/connection.h" 18 #include "services/shell/public/cpp/connection.h"
18 #include "services/shell/public/cpp/connector.h" 19 #include "services/shell/public/cpp/connector.h"
19 #include "services/tracing/public/cpp/provider.h" 20 #include "services/tracing/public/cpp/provider.h"
20 #include "services/ui/common/event_matcher_util.h" 21 #include "services/ui/common/event_matcher_util.h"
21 #include "services/ui/public/cpp/gpu_service.h" 22 #include "services/ui/public/cpp/gpu_service.h"
22 #include "services/ui/public/cpp/window.h" 23 #include "services/ui/public/cpp/window.h"
23 #include "services/ui/public/cpp/window_tree_client.h" 24 #include "services/ui/public/cpp/window_tree_client.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const size_t kMaxNumberThreads = 3u; // Matches that of content. 146 const size_t kMaxNumberThreads = 3u; // Matches that of content.
146 const char kThreadNamePrefix[] = "MashBlocking"; 147 const char kThreadNamePrefix[] = "MashBlocking";
147 blocking_pool_ = new base::SequencedWorkerPool( 148 blocking_pool_ = new base::SequencedWorkerPool(
148 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); 149 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE);
149 InitWindowManager(std::move(window_tree_client), blocking_pool_); 150 InitWindowManager(std::move(window_tree_client), blocking_pool_);
150 } 151 }
151 152
152 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, 153 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
153 shell::InterfaceRegistry* registry) { 154 shell::InterfaceRegistry* registry) {
154 registry->AddInterface<ash::mojom::ShelfController>(this); 155 registry->AddInterface<ash::mojom::ShelfController>(this);
156 registry->AddInterface<ash::mojom::WallpaperController>(this);
155 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); 157 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this);
156 if (remote_identity.name() == "mojo:mash_session") { 158 if (remote_identity.name() == "mojo:mash_session") {
157 connector()->ConnectToInterface(remote_identity, &session_); 159 connector()->ConnectToInterface(remote_identity, &session_);
158 session_->AddScreenlockStateListener( 160 session_->AddScreenlockStateListener(
159 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); 161 screenlock_state_listener_binding_.CreateInterfacePtrAndBind());
160 } 162 }
161 return true; 163 return true;
162 } 164 }
163 165
164 void WindowManagerApplication::Create( 166 void WindowManagerApplication::Create(
165 const shell::Identity& remote_identity, 167 const shell::Identity& remote_identity,
166 ash::mojom::ShelfControllerRequest request) { 168 ash::mojom::ShelfControllerRequest request) {
167 ash::mojom::ShelfController* shelf_controller = 169 ash::mojom::ShelfController* shelf_controller =
168 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); 170 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate());
169 DCHECK(shelf_controller); 171 DCHECK(shelf_controller);
170 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); 172 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request));
171 } 173 }
172 174
173 void WindowManagerApplication::Create( 175 void WindowManagerApplication::Create(
176 const ::shell::Identity& remote_identity,
177 ash::mojom::WallpaperControllerRequest request) {
178 ash::mojom::WallpaperController* wallpaper_controller =
179 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate());
180 DCHECK(wallpaper_controller);
181 wallpaper_controller_bindings_.AddBinding(wallpaper_controller,
182 std::move(request));
183 }
184
185 void WindowManagerApplication::Create(
174 const shell::Identity& remote_identity, 186 const shell::Identity& remote_identity,
175 ui::mojom::AcceleratorRegistrarRequest request) { 187 ui::mojom::AcceleratorRegistrarRequest request) {
176 if (!window_manager_->window_manager_client()) 188 if (!window_manager_->window_manager_client())
177 return; // Can happen during shutdown. 189 return; // Can happen during shutdown.
178 190
179 uint16_t accelerator_namespace_id; 191 uint16_t accelerator_namespace_id;
180 if (!window_manager_->GetNextAcceleratorNamespaceId( 192 if (!window_manager_->GetNextAcceleratorNamespaceId(
181 &accelerator_namespace_id)) { 193 &accelerator_namespace_id)) {
182 DVLOG(1) << "Max number of accelerators registered, ignoring request."; 194 DVLOG(1) << "Max number of accelerators registered, ignoring request.";
183 // All ids are used. Normally shouldn't happen, so we close the connection. 195 // All ids are used. Normally shouldn't happen, so we close the connection.
184 return; 196 return;
185 } 197 }
186 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( 198 accelerator_registrars_.insert(new AcceleratorRegistrarImpl(
187 window_manager_.get(), accelerator_namespace_id, std::move(request), 199 window_manager_.get(), accelerator_namespace_id, std::move(request),
188 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, 200 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
189 base::Unretained(this)))); 201 base::Unretained(this))));
190 } 202 }
191 203
192 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { 204 void WindowManagerApplication::ScreenlockStateChanged(bool locked) {
193 window_manager_->SetScreenLocked(locked); 205 window_manager_->SetScreenLocked(locked);
194 } 206 }
195 207
196 } // namespace mus 208 } // namespace mus
197 } // namespace ash 209 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698