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

Side by Side Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2629643002: chromeos: Renames WmWindowAura to WmWindow (Closed)
Patch Set: feedback Created 3 years, 11 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/bridge/wm_lookup_mus.cc ('k') | ash/mus/disconnected_app_handler.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bridge/wm_shell_mus.h" 5 #include "ash/mus/bridge/wm_shell_mus.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
11 #include "ash/common/key_event_watcher.h" 10 #include "ash/common/key_event_watcher.h"
12 #include "ash/common/session/session_state_delegate.h" 11 #include "ash/common/session/session_state_delegate.h"
13 #include "ash/common/shell_delegate.h" 12 #include "ash/common/shell_delegate.h"
14 #include "ash/common/shell_observer.h" 13 #include "ash/common/shell_observer.h"
15 #include "ash/common/system/tray/system_tray_delegate.h" 14 #include "ash/common/system/tray/system_tray_delegate.h"
16 #include "ash/common/wallpaper/wallpaper_delegate.h" 15 #include "ash/common/wallpaper/wallpaper_delegate.h"
17 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" 16 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h"
18 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h" 17 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h"
19 #include "ash/common/wm/mru_window_tracker.h" 18 #include "ash/common/wm/mru_window_tracker.h"
20 #include "ash/common/wm/window_cycle_event_filter.h" 19 #include "ash/common/wm/window_cycle_event_filter.h"
21 #include "ash/common/wm/window_resizer.h" 20 #include "ash/common/wm/window_resizer.h"
22 #include "ash/common/wm_activation_observer.h" 21 #include "ash/common/wm_activation_observer.h"
22 #include "ash/common/wm_window.h"
23 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" 23 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h"
24 #include "ash/mus/accelerators/accelerator_controller_registrar.h" 24 #include "ash/mus/accelerators/accelerator_controller_registrar.h"
25 #include "ash/mus/bridge/immersive_handler_factory_mus.h" 25 #include "ash/mus/bridge/immersive_handler_factory_mus.h"
26 #include "ash/mus/bridge/workspace_event_handler_mus.h" 26 #include "ash/mus/bridge/workspace_event_handler_mus.h"
27 #include "ash/mus/drag_window_resizer.h" 27 #include "ash/mus/drag_window_resizer.h"
28 #include "ash/mus/keyboard_ui_mus.h" 28 #include "ash/mus/keyboard_ui_mus.h"
29 #include "ash/mus/root_window_controller.h" 29 #include "ash/mus/root_window_controller.h"
30 #include "ash/mus/window_manager.h" 30 #include "ash/mus/window_manager.h"
31 #include "ash/shared/immersive_fullscreen_controller.h" 31 #include "ash/shared/immersive_fullscreen_controller.h"
32 #include "base/memory/ptr_util.h" 32 #include "base/memory/ptr_util.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // static 162 // static
163 WmShellMus* WmShellMus::Get() { 163 WmShellMus* WmShellMus::Get() {
164 return static_cast<WmShellMus*>(WmShell::Get()); 164 return static_cast<WmShellMus*>(WmShell::Get());
165 } 165 }
166 166
167 void WmShellMus::AddRootWindowController(RootWindowController* controller) { 167 void WmShellMus::AddRootWindowController(RootWindowController* controller) {
168 root_window_controllers_.push_back(controller); 168 root_window_controllers_.push_back(controller);
169 // The first root window will be the initial root for new windows. 169 // The first root window will be the initial root for new windows.
170 if (!GetRootWindowForNewWindows()) 170 if (!GetRootWindowForNewWindows())
171 set_root_window_for_new_windows(ash::WmWindowAura::Get(controller->root())); 171 set_root_window_for_new_windows(WmWindow::Get(controller->root()));
172 } 172 }
173 173
174 void WmShellMus::RemoveRootWindowController(RootWindowController* controller) { 174 void WmShellMus::RemoveRootWindowController(RootWindowController* controller) {
175 auto iter = std::find(root_window_controllers_.begin(), 175 auto iter = std::find(root_window_controllers_.begin(),
176 root_window_controllers_.end(), controller); 176 root_window_controllers_.end(), controller);
177 DCHECK(iter != root_window_controllers_.end()); 177 DCHECK(iter != root_window_controllers_.end());
178 root_window_controllers_.erase(iter); 178 root_window_controllers_.erase(iter);
179 } 179 }
180 180
181 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( 181 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId(
(...skipping 13 matching lines...) Expand all
195 195
196 bool WmShellMus::IsRunningInMash() const { 196 bool WmShellMus::IsRunningInMash() const {
197 return true; 197 return true;
198 } 198 }
199 199
200 WmWindow* WmShellMus::NewWindow(ui::wm::WindowType window_type, 200 WmWindow* WmShellMus::NewWindow(ui::wm::WindowType window_type,
201 ui::LayerType layer_type) { 201 ui::LayerType layer_type) {
202 aura::Window* window = new aura::Window(nullptr); 202 aura::Window* window = new aura::Window(nullptr);
203 window->SetType(window_type); 203 window->SetType(window_type);
204 window->Init(layer_type); 204 window->Init(layer_type);
205 return ash::WmWindowAura::Get(window); 205 return WmWindow::Get(window);
206 } 206 }
207 207
208 WmWindow* WmShellMus::GetFocusedWindow() { 208 WmWindow* WmShellMus::GetFocusedWindow() {
209 // TODO: remove as both WmShells use same implementation. 209 // TODO: remove as both WmShells use same implementation.
210 return ash::WmWindowAura::Get(static_cast<aura::client::FocusClient*>( 210 return WmWindow::Get(static_cast<aura::client::FocusClient*>(
211 window_manager_->focus_controller()) 211 window_manager_->focus_controller())
212 ->GetFocusedWindow()); 212 ->GetFocusedWindow());
213 } 213 }
214 214
215 WmWindow* WmShellMus::GetActiveWindow() { 215 WmWindow* WmShellMus::GetActiveWindow() {
216 // TODO: remove as both WmShells use same implementation. 216 // TODO: remove as both WmShells use same implementation.
217 return ash::WmWindowAura::Get(static_cast<aura::client::ActivationClient*>( 217 return WmWindow::Get(static_cast<aura::client::ActivationClient*>(
218 window_manager_->focus_controller()) 218 window_manager_->focus_controller())
219 ->GetActiveWindow()); 219 ->GetActiveWindow());
220 } 220 }
221 221
222 WmWindow* WmShellMus::GetCaptureWindow() { 222 WmWindow* WmShellMus::GetCaptureWindow() {
223 // TODO: remove as both WmShells use same implementation. 223 // TODO: remove as both WmShells use same implementation.
224 return ash::WmWindowAura::Get( 224 return WmWindow::Get(::wm::CaptureController::Get()->GetCaptureWindow());
225 ::wm::CaptureController::Get()->GetCaptureWindow());
226 } 225 }
227 226
228 WmWindow* WmShellMus::GetPrimaryRootWindow() { 227 WmWindow* WmShellMus::GetPrimaryRootWindow() {
229 return ash::WmWindowAura::Get(root_window_controllers_[0]->root()); 228 return WmWindow::Get(root_window_controllers_[0]->root());
230 } 229 }
231 230
232 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { 231 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) {
233 return ash::WmWindowAura::Get( 232 return WmWindow::Get(
234 GetRootWindowControllerWithDisplayId(display_id)->root()); 233 GetRootWindowControllerWithDisplayId(display_id)->root());
235 } 234 }
236 235
237 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( 236 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo(
238 int64_t display_id) const { 237 int64_t display_id) const {
239 // TODO(mash): implement http://crbug.com/622480. 238 // TODO(mash): implement http://crbug.com/622480.
240 NOTIMPLEMENTED(); 239 NOTIMPLEMENTED();
241 static display::ManagedDisplayInfo fake_info; 240 static display::ManagedDisplayInfo fake_info;
242 return fake_info; 241 return fake_info;
243 } 242 }
(...skipping 23 matching lines...) Expand all
267 } 266 }
268 267
269 bool WmShellMus::IsForceMaximizeOnFirstRun() { 268 bool WmShellMus::IsForceMaximizeOnFirstRun() {
270 NOTIMPLEMENTED(); 269 NOTIMPLEMENTED();
271 return false; 270 return false;
272 } 271 }
273 272
274 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, 273 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window,
275 const gfx::Insets& insets) { 274 const gfx::Insets& insets) {
276 RootWindowController* root_window_controller = 275 RootWindowController* root_window_controller =
277 RootWindowController::ForWindow( 276 RootWindowController::ForWindow(window->aura_window());
278 static_cast<ash::WmWindowAura*>(window)->aura_window());
279 root_window_controller->SetWorkAreaInests(insets); 277 root_window_controller->SetWorkAreaInests(insets);
280 } 278 }
281 279
282 bool WmShellMus::IsPinned() { 280 bool WmShellMus::IsPinned() {
283 NOTIMPLEMENTED(); 281 NOTIMPLEMENTED();
284 return false; 282 return false;
285 } 283 }
286 284
287 void WmShellMus::SetPinnedWindow(WmWindow* window) { 285 void WmShellMus::SetPinnedWindow(WmWindow* window) {
288 NOTIMPLEMENTED(); 286 NOTIMPLEMENTED();
(...skipping 11 matching lines...) Expand all
300 298
301 bool WmShellMus::IsMouseEventsEnabled() { 299 bool WmShellMus::IsMouseEventsEnabled() {
302 // TODO: http::/crbug.com/637853 300 // TODO: http::/crbug.com/637853
303 NOTIMPLEMENTED(); 301 NOTIMPLEMENTED();
304 return true; 302 return true;
305 } 303 }
306 304
307 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { 305 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() {
308 std::vector<WmWindow*> wm_windows(root_window_controllers_.size()); 306 std::vector<WmWindow*> wm_windows(root_window_controllers_.size());
309 for (size_t i = 0; i < root_window_controllers_.size(); ++i) 307 for (size_t i = 0; i < root_window_controllers_.size(); ++i)
310 wm_windows[i] = ash::WmWindowAura::Get(root_window_controllers_[i]->root()); 308 wm_windows[i] = WmWindow::Get(root_window_controllers_[i]->root());
311 return wm_windows; 309 return wm_windows;
312 } 310 }
313 311
314 void WmShellMus::RecordGestureAction(GestureActionType action) { 312 void WmShellMus::RecordGestureAction(GestureActionType action) {
315 // TODO: http://crbug.com/616581. 313 // TODO: http://crbug.com/616581.
316 NOTIMPLEMENTED(); 314 NOTIMPLEMENTED();
317 } 315 }
318 316
319 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { 317 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) {
320 // TODO: http://crbug.com/616581. 318 // TODO: http://crbug.com/616581.
(...skipping 29 matching lines...) Expand all
350 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> 348 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard>
351 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { 349 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() {
352 // TODO: needs implementation for mus, http://crbug.com/624967. 350 // TODO: needs implementation for mus, http://crbug.com/624967.
353 NOTIMPLEMENTED(); 351 NOTIMPLEMENTED();
354 return nullptr; 352 return nullptr;
355 } 353 }
356 354
357 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( 355 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler(
358 WmWindow* workspace_window) { 356 WmWindow* workspace_window) {
359 return base::MakeUnique<WorkspaceEventHandlerMus>( 357 return base::MakeUnique<WorkspaceEventHandlerMus>(
360 ash::WmWindowAura::GetAuraWindow(workspace_window)); 358 WmWindow::GetAuraWindow(workspace_window));
361 } 359 }
362 360
363 std::unique_ptr<ImmersiveFullscreenController> 361 std::unique_ptr<ImmersiveFullscreenController>
364 WmShellMus::CreateImmersiveFullscreenController() { 362 WmShellMus::CreateImmersiveFullscreenController() {
365 return base::MakeUnique<ImmersiveFullscreenController>(); 363 return base::MakeUnique<ImmersiveFullscreenController>();
366 } 364 }
367 365
368 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { 366 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() {
369 // TODO: needs implementation for mus, http://crbug.com/649600. 367 // TODO: needs implementation for mus, http://crbug.com/649600.
370 NOTIMPLEMENTED(); 368 NOTIMPLEMENTED();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 427
430 void WmShellMus::SetLaserPointerEnabled(bool enabled) { 428 void WmShellMus::SetLaserPointerEnabled(bool enabled) {
431 NOTIMPLEMENTED(); 429 NOTIMPLEMENTED();
432 } 430 }
433 431
434 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. 432 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114.
435 // TODO: Nuke and let client code use ActivationChangeObserver directly. 433 // TODO: Nuke and let client code use ActivationChangeObserver directly.
436 void WmShellMus::OnWindowActivated(ActivationReason reason, 434 void WmShellMus::OnWindowActivated(ActivationReason reason,
437 aura::Window* gained_active, 435 aura::Window* gained_active,
438 aura::Window* lost_active) { 436 aura::Window* lost_active) {
439 WmWindow* gained_active_wm = ash::WmWindowAura::Get(gained_active); 437 WmWindow* gained_active_wm = WmWindow::Get(gained_active);
440 if (gained_active_wm) 438 if (gained_active_wm)
441 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); 439 set_root_window_for_new_windows(gained_active_wm->GetRootWindow());
442 WmWindow* lost_active_wm = ash::WmWindowAura::Get(lost_active); 440 WmWindow* lost_active_wm = WmWindow::Get(lost_active);
443 for (auto& observer : activation_observers_) 441 for (auto& observer : activation_observers_)
444 observer.OnWindowActivated(gained_active_wm, lost_active_wm); 442 observer.OnWindowActivated(gained_active_wm, lost_active_wm);
445 } 443 }
446 444
447 } // namespace mus 445 } // namespace mus
448 } // namespace ash 446 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_lookup_mus.cc ('k') | ash/mus/disconnected_app_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698