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

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

Issue 2351893002: mash: Fix system tray clock 12/24 hour time setting (Closed)
Patch Set: tweak 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/system_tray_delegate_mus.h"
14 #include "ash/mus/wallpaper_delegate_mus.h" 15 #include "ash/mus/wallpaper_delegate_mus.h"
15 #include "ash/mus/window_manager.h" 16 #include "ash/mus/window_manager.h"
16 #include "base/bind.h" 17 #include "base/bind.h"
17 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
18 #include "services/shell/public/cpp/connection.h" 19 #include "services/shell/public/cpp/connection.h"
19 #include "services/shell/public/cpp/connector.h" 20 #include "services/shell/public/cpp/connector.h"
20 #include "services/tracing/public/cpp/provider.h" 21 #include "services/tracing/public/cpp/provider.h"
21 #include "services/ui/common/event_matcher_util.h" 22 #include "services/ui/common/event_matcher_util.h"
22 #include "services/ui/public/cpp/gpu_service.h" 23 #include "services/ui/public/cpp/gpu_service.h"
23 #include "services/ui/public/cpp/window.h" 24 #include "services/ui/public/cpp/window.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const size_t kMaxNumberThreads = 3u; // Matches that of content. 149 const size_t kMaxNumberThreads = 3u; // Matches that of content.
149 const char kThreadNamePrefix[] = "MashBlocking"; 150 const char kThreadNamePrefix[] = "MashBlocking";
150 blocking_pool_ = new base::SequencedWorkerPool( 151 blocking_pool_ = new base::SequencedWorkerPool(
151 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); 152 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE);
152 InitWindowManager(std::move(window_tree_client), blocking_pool_); 153 InitWindowManager(std::move(window_tree_client), blocking_pool_);
153 } 154 }
154 155
155 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, 156 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
156 shell::InterfaceRegistry* registry) { 157 shell::InterfaceRegistry* registry) {
157 registry->AddInterface<ash::mojom::ShelfController>(this); 158 registry->AddInterface<ash::mojom::ShelfController>(this);
159 registry->AddInterface<ash::mojom::SystemTray>(this);
158 registry->AddInterface<ash::mojom::WallpaperController>(this); 160 registry->AddInterface<ash::mojom::WallpaperController>(this);
159 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); 161 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this);
160 if (remote_identity.name() == "mojo:mash_session") { 162 if (remote_identity.name() == "mojo:mash_session") {
161 connector()->ConnectToInterface(remote_identity, &session_); 163 connector()->ConnectToInterface(remote_identity, &session_);
162 session_->AddScreenlockStateListener( 164 session_->AddScreenlockStateListener(
163 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); 165 screenlock_state_listener_binding_.CreateInterfacePtrAndBind());
164 } 166 }
165 return true; 167 return true;
166 } 168 }
167 169
168 void WindowManagerApplication::Create( 170 void WindowManagerApplication::Create(
169 const shell::Identity& remote_identity, 171 const shell::Identity& remote_identity,
170 ash::mojom::ShelfControllerRequest request) { 172 ash::mojom::ShelfControllerRequest request) {
171 ash::mojom::ShelfController* shelf_controller = 173 ash::mojom::ShelfController* shelf_controller =
172 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); 174 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate());
173 DCHECK(shelf_controller); 175 DCHECK(shelf_controller);
174 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); 176 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request));
175 } 177 }
176 178
179 void WindowManagerApplication::Create(const shell::Identity& remote_identity,
180 ash::mojom::SystemTrayRequest request) {
181 ash::mojom::SystemTray* system_tray = static_cast<SystemTrayDelegateMus*>(
sky 2016/09/19 23:47:52 This cast makes me nervous. Could you cache the Sy
James Cook 2016/09/20 01:52:11 How's this? I looked at caching the pointer, but i
182 WmShell::Get()->system_tray_delegate());
183 DCHECK(system_tray);
184 system_tray_bindings_.AddBinding(system_tray, std::move(request));
185 }
186
177 void WindowManagerApplication::Create( 187 void WindowManagerApplication::Create(
178 const ::shell::Identity& remote_identity, 188 const ::shell::Identity& remote_identity,
179 ash::mojom::WallpaperControllerRequest request) { 189 ash::mojom::WallpaperControllerRequest request) {
180 ash::mojom::WallpaperController* wallpaper_controller = 190 ash::mojom::WallpaperController* wallpaper_controller =
181 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); 191 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate());
182 DCHECK(wallpaper_controller); 192 DCHECK(wallpaper_controller);
183 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, 193 wallpaper_controller_bindings_.AddBinding(wallpaper_controller,
184 std::move(request)); 194 std::move(request));
185 } 195 }
186 196
(...skipping 15 matching lines...) Expand all
202 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, 212 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
203 base::Unretained(this)))); 213 base::Unretained(this))));
204 } 214 }
205 215
206 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { 216 void WindowManagerApplication::ScreenlockStateChanged(bool locked) {
207 window_manager_->SetScreenLocked(locked); 217 window_manager_->SetScreenLocked(locked);
208 } 218 }
209 219
210 } // namespace mus 220 } // namespace mus
211 } // namespace ash 221 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698