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

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

Issue 2259153002: mash: Port ash_sysui ShelfDelegateMus impl to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. 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
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/public/interfaces/BUILD.gn » ('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/common/wm_shell.h"
10 #include "ash/mus/accelerators/accelerator_registrar_impl.h" 11 #include "ash/mus/accelerators/accelerator_registrar_impl.h"
11 #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"
12 #include "ash/mus/window_manager.h" 14 #include "ash/mus/window_manager.h"
13 #include "base/bind.h" 15 #include "base/bind.h"
14 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
15 #include "services/shell/public/cpp/connection.h" 17 #include "services/shell/public/cpp/connection.h"
16 #include "services/shell/public/cpp/connector.h" 18 #include "services/shell/public/cpp/connector.h"
17 #include "services/tracing/public/cpp/provider.h" 19 #include "services/tracing/public/cpp/provider.h"
18 #include "services/ui/common/event_matcher_util.h" 20 #include "services/ui/common/event_matcher_util.h"
19 #include "services/ui/public/cpp/gpu_service.h" 21 #include "services/ui/public/cpp/gpu_service.h"
20 #include "services/ui/public/cpp/window.h" 22 #include "services/ui/public/cpp/window.h"
21 #include "services/ui/public/cpp/window_tree_client.h" 23 #include "services/ui/public/cpp/window_tree_client.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 window_tree_client->ConnectAsWindowManager(connector()); 114 window_tree_client->ConnectAsWindowManager(connector());
113 115
114 native_widget_factory_mus_.reset( 116 native_widget_factory_mus_.reset(
115 new NativeWidgetFactoryMus(window_manager_.get())); 117 new NativeWidgetFactoryMus(window_manager_.get()));
116 118
117 InitWindowManager(window_tree_client); 119 InitWindowManager(window_tree_client);
118 } 120 }
119 121
120 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, 122 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
121 shell::InterfaceRegistry* registry) { 123 shell::InterfaceRegistry* registry) {
124 registry->AddInterface<ash::mojom::ShelfController>(this);
122 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); 125 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this);
123 if (remote_identity.name() == "mojo:mash_session") { 126 if (remote_identity.name() == "mojo:mash_session") {
124 connector()->ConnectToInterface(remote_identity, &session_); 127 connector()->ConnectToInterface(remote_identity, &session_);
125 session_->AddScreenlockStateListener( 128 session_->AddScreenlockStateListener(
126 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); 129 screenlock_state_listener_binding_.CreateInterfacePtrAndBind());
127 } 130 }
128 return true; 131 return true;
129 } 132 }
130 133
131 void WindowManagerApplication::Create( 134 void WindowManagerApplication::Create(
132 const shell::Identity& remote_identity, 135 const shell::Identity& remote_identity,
133 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) { 136 ash::mojom::ShelfControllerRequest request) {
137 ash::mojom::ShelfController* shelf_controller =
138 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate());
139 DCHECK(shelf_controller);
140 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request));
141 }
142
143 void WindowManagerApplication::Create(
144 const shell::Identity& remote_identity,
145 ui::mojom::AcceleratorRegistrarRequest request) {
134 if (!window_manager_->window_manager_client()) 146 if (!window_manager_->window_manager_client())
135 return; // Can happen during shutdown. 147 return; // Can happen during shutdown.
136 148
137 uint16_t accelerator_namespace_id; 149 uint16_t accelerator_namespace_id;
138 if (!window_manager_->GetNextAcceleratorNamespaceId( 150 if (!window_manager_->GetNextAcceleratorNamespaceId(
139 &accelerator_namespace_id)) { 151 &accelerator_namespace_id)) {
140 DVLOG(1) << "Max number of accelerators registered, ignoring request."; 152 DVLOG(1) << "Max number of accelerators registered, ignoring request.";
141 // All ids are used. Normally shouldn't happen, so we close the connection. 153 // All ids are used. Normally shouldn't happen, so we close the connection.
142 return; 154 return;
143 } 155 }
144 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( 156 accelerator_registrars_.insert(new AcceleratorRegistrarImpl(
145 window_manager_.get(), accelerator_namespace_id, std::move(request), 157 window_manager_.get(), accelerator_namespace_id, std::move(request),
146 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, 158 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
147 base::Unretained(this)))); 159 base::Unretained(this))));
148 } 160 }
149 161
150 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { 162 void WindowManagerApplication::ScreenlockStateChanged(bool locked) {
151 window_manager_->SetScreenLocked(locked); 163 window_manager_->SetScreenLocked(locked);
152 } 164 }
153 165
154 } // namespace mus 166 } // namespace mus
155 } // namespace ash 167 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698