| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/aura/wm_root_window_controller_aura.h" | |
| 6 | |
| 7 #include "ash/aura/wm_window_aura.h" | |
| 8 #include "ash/common/shelf/shelf_widget.h" | |
| 9 #include "ash/common/shelf/wm_shelf.h" | |
| 10 #include "ash/display/window_tree_host_manager.h" | |
| 11 #include "ash/root_window_controller.h" | |
| 12 #include "ash/shell.h" | |
| 13 #include "ui/aura/env.h" | |
| 14 #include "ui/aura/window.h" | |
| 15 #include "ui/aura/window_property.h" | |
| 16 | |
| 17 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*); | |
| 18 | |
| 19 namespace ash { | |
| 20 | |
| 21 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. | |
| 22 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura, | |
| 23 kWmRootWindowControllerKey, | |
| 24 nullptr); | |
| 25 | |
| 26 WmRootWindowControllerAura::WmRootWindowControllerAura( | |
| 27 RootWindowController* root_window_controller) | |
| 28 : WmRootWindowController( | |
| 29 WmWindowAura::Get(root_window_controller->GetRootWindow())), | |
| 30 root_window_controller_(root_window_controller) { | |
| 31 root_window_controller_->GetRootWindow()->SetProperty( | |
| 32 kWmRootWindowControllerKey, this); | |
| 33 } | |
| 34 | |
| 35 WmRootWindowControllerAura::~WmRootWindowControllerAura() {} | |
| 36 | |
| 37 // static | |
| 38 const WmRootWindowControllerAura* WmRootWindowControllerAura::Get( | |
| 39 const aura::Window* window) { | |
| 40 if (!window) | |
| 41 return nullptr; | |
| 42 | |
| 43 RootWindowController* root_window_controller = | |
| 44 GetRootWindowController(window); | |
| 45 if (!root_window_controller) | |
| 46 return nullptr; | |
| 47 | |
| 48 WmRootWindowControllerAura* wm_root_window_controller = | |
| 49 root_window_controller->GetRootWindow()->GetProperty( | |
| 50 kWmRootWindowControllerKey); | |
| 51 if (wm_root_window_controller) | |
| 52 return wm_root_window_controller; | |
| 53 | |
| 54 DCHECK_EQ(aura::Env::Mode::LOCAL, aura::Env::GetInstance()->mode()); | |
| 55 // WmRootWindowControllerAura is owned by the RootWindowController's window. | |
| 56 return new WmRootWindowControllerAura(root_window_controller); | |
| 57 } | |
| 58 | |
| 59 bool WmRootWindowControllerAura::HasShelf() { | |
| 60 return root_window_controller_->wm_shelf()->shelf_widget() != nullptr; | |
| 61 } | |
| 62 | |
| 63 WmShelf* WmRootWindowControllerAura::GetShelf() { | |
| 64 return root_window_controller_->wm_shelf(); | |
| 65 } | |
| 66 | |
| 67 WmWindow* WmRootWindowControllerAura::GetWindow() { | |
| 68 return WmWindowAura::Get(root_window_controller_->GetRootWindow()); | |
| 69 } | |
| 70 | |
| 71 void WmRootWindowControllerAura::OnInitialWallpaperAnimationStarted() { | |
| 72 root_window_controller_->OnInitialWallpaperAnimationStarted(); | |
| 73 WmRootWindowController::OnInitialWallpaperAnimationStarted(); | |
| 74 } | |
| 75 | |
| 76 void WmRootWindowControllerAura::OnWallpaperAnimationFinished( | |
| 77 views::Widget* widget) { | |
| 78 root_window_controller_->OnWallpaperAnimationFinished(widget); | |
| 79 WmRootWindowController::OnWallpaperAnimationFinished(widget); | |
| 80 } | |
| 81 | |
| 82 bool WmRootWindowControllerAura::ShouldDestroyWindowInCloseChildWindows( | |
| 83 WmWindow* window) { | |
| 84 return WmWindowAura::GetAuraWindow(window)->owned_by_parent(); | |
| 85 } | |
| 86 | |
| 87 } // namespace ash | |
| OLD | NEW |