| 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_globals_aura.h" |
| 6 |
| 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/wm/aura/wm_window_aura.h" |
| 11 #include "ash/wm/mru_window_tracker.h" |
| 12 #include "ash/wm/window_util.h" |
| 13 #include "ui/wm/public/activation_client.h" |
| 14 |
| 15 namespace ash { |
| 16 namespace wm { |
| 17 namespace { |
| 18 |
| 19 WmGlobalsAura* instance_ = nullptr; |
| 20 |
| 21 } // namespace |
| 22 |
| 23 // static |
| 24 WmGlobals* WmGlobals::Get() { |
| 25 return instance_; |
| 26 } |
| 27 |
| 28 WmGlobalsAura::WmGlobalsAura() { |
| 29 DCHECK(!instance_); |
| 30 instance_ = this; |
| 31 } |
| 32 |
| 33 WmGlobalsAura::~WmGlobalsAura() { |
| 34 instance_ = nullptr; |
| 35 } |
| 36 |
| 37 // static |
| 38 WmGlobalsAura* WmGlobalsAura::Get() { |
| 39 if (!instance_) |
| 40 new WmGlobalsAura; |
| 41 return instance_; |
| 42 } |
| 43 |
| 44 WmWindow* WmGlobalsAura::GetActiveWindow() { |
| 45 return WmWindowAura::Get(wm::GetActiveWindow()); |
| 46 } |
| 47 |
| 48 WmWindow* WmGlobalsAura::GetRootWindowForNewWindows() { |
| 49 return WmWindowAura::Get(Shell::GetTargetRootWindow()); |
| 50 } |
| 51 |
| 52 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowListIgnoreModals() { |
| 53 const std::vector<aura::Window*> windows = ash::Shell::GetInstance() |
| 54 ->mru_window_tracker() |
| 55 ->BuildWindowListIgnoreModal(); |
| 56 std::vector<WmWindow*> wm_windows(windows.size()); |
| 57 for (size_t i = 0; i < windows.size(); ++i) |
| 58 wm_windows[i] = WmWindowAura::Get(windows[i]); |
| 59 return wm_windows; |
| 60 } |
| 61 |
| 62 bool WmGlobalsAura::IsForceMaximizeOnFirstRun() { |
| 63 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); |
| 64 } |
| 65 |
| 66 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { |
| 67 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 68 std::vector<WmWindow*> wm_windows(root_windows.size()); |
| 69 for (size_t i = 0; i < root_windows.size(); ++i) |
| 70 wm_windows[i] = WmWindowAura::Get(root_windows[i]); |
| 71 return wm_windows; |
| 72 } |
| 73 |
| 74 } // namespace wm |
| 75 } // namespace ash |
| OLD | NEW |