| 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/wm/aura/wm_root_window_controller_aura.h" |
| 6 |
| 7 #include "ash/root_window_controller.h" |
| 8 #include "ui/aura/window.h" |
| 9 #include "ui/aura/window_property.h" |
| 10 |
| 11 DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WmRootWindowControllerAura*); |
| 12 |
| 13 namespace ash { |
| 14 namespace wm { |
| 15 |
| 16 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. |
| 17 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::wm::WmRootWindowControllerAura, |
| 18 kWmRootWindowControllerKey, |
| 19 nullptr); |
| 20 |
| 21 WmRootWindowControllerAura::WmRootWindowControllerAura( |
| 22 RootWindowController* root_window_controller) |
| 23 : root_window_controller_(root_window_controller) { |
| 24 root_window_controller_->GetRootWindow()->SetProperty( |
| 25 kWmRootWindowControllerKey, this); |
| 26 } |
| 27 |
| 28 WmRootWindowControllerAura::~WmRootWindowControllerAura() {} |
| 29 |
| 30 // static |
| 31 const WmRootWindowControllerAura* WmRootWindowControllerAura::Get( |
| 32 const aura::Window* window) { |
| 33 if (!window) |
| 34 return nullptr; |
| 35 |
| 36 RootWindowController* root_window_controller = |
| 37 GetRootWindowController(window); |
| 38 if (!root_window_controller) |
| 39 return nullptr; |
| 40 |
| 41 WmRootWindowControllerAura* wm_root_window_controller = |
| 42 root_window_controller->GetRootWindow()->GetProperty( |
| 43 kWmRootWindowControllerKey); |
| 44 if (wm_root_window_controller) |
| 45 return wm_root_window_controller; |
| 46 |
| 47 // WmRootWindowControllerAura is owned by the RootWindowController's window. |
| 48 return new WmRootWindowControllerAura(root_window_controller); |
| 49 } |
| 50 |
| 51 bool WmRootWindowControllerAura::HasShelf() { |
| 52 return root_window_controller_->shelf() != nullptr; |
| 53 } |
| 54 |
| 55 } // namespace wm |
| 56 } // namespace ash |
| OLD | NEW |