| OLD | NEW |
| 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/aura/wm_shell_aura.h" | 5 #include "ash/aura/wm_shell_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm/mru_window_tracker.h" | 9 #include "ash/common/wm/mru_window_tracker.h" |
| 10 #include "ash/common/wm_activation_observer.h" | 10 #include "ash/common/wm_activation_observer.h" |
| 11 #include "ash/common/wm_display_observer.h" | 11 #include "ash/common/wm_display_observer.h" |
| 12 #include "ash/common/wm_overview_mode_observer.h" | 12 #include "ash/common/wm_overview_mode_observer.h" |
| 13 #include "ash/common/wm_shell_common.h" |
| 13 #include "ash/display/window_tree_host_manager.h" | 14 #include "ash/display/window_tree_host_manager.h" |
| 14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 15 #include "ash/shell_delegate.h" | 16 #include "ash/shell_delegate.h" |
| 16 #include "ash/wm/drag_window_resizer.h" | 17 #include "ash/wm/drag_window_resizer.h" |
| 17 #include "ash/wm/overview/window_selector_controller.h" | 18 #include "ash/wm/overview/window_selector_controller.h" |
| 18 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 20 #include "ui/aura/client/focus_client.h" | 21 #include "ui/aura/client/focus_client.h" |
| 21 #include "ui/wm/public/activation_client.h" | 22 #include "ui/wm/public/activation_client.h" |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 | 25 |
| 25 WmShellAura::WmShellAura() { | 26 WmShellAura::WmShellAura(WmShellCommon* wm_shell_common) |
| 27 : wm_shell_common_(wm_shell_common) { |
| 26 WmShell::Set(this); | 28 WmShell::Set(this); |
| 27 Shell::GetInstance()->AddShellObserver(this); | 29 Shell::GetInstance()->AddShellObserver(this); |
| 28 } | 30 } |
| 29 | 31 |
| 30 WmShellAura::~WmShellAura() { | 32 WmShellAura::~WmShellAura() { |
| 31 WmShell::Set(nullptr); | 33 WmShell::Set(nullptr); |
| 32 | 34 |
| 33 if (added_activation_observer_) | 35 if (added_activation_observer_) |
| 34 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 36 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 35 | 37 |
| 36 if (added_display_observer_) | 38 if (added_display_observer_) |
| 37 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 39 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| 38 | 40 |
| 39 Shell::GetInstance()->RemoveShellObserver(this); | 41 Shell::GetInstance()->RemoveShellObserver(this); |
| 40 } | 42 } |
| 41 | 43 |
| 44 MruWindowTracker* WmShellAura::GetMruWindowTracker() { |
| 45 return wm_shell_common_->mru_window_tracker(); |
| 46 } |
| 47 |
| 42 WmWindow* WmShellAura::NewContainerWindow() { | 48 WmWindow* WmShellAura::NewContainerWindow() { |
| 43 aura::Window* aura_window = new aura::Window(nullptr); | 49 aura::Window* aura_window = new aura::Window(nullptr); |
| 44 aura_window->Init(ui::LAYER_NOT_DRAWN); | 50 aura_window->Init(ui::LAYER_NOT_DRAWN); |
| 45 return WmWindowAura::Get(aura_window); | 51 return WmWindowAura::Get(aura_window); |
| 46 } | 52 } |
| 47 | 53 |
| 48 WmWindow* WmShellAura::GetFocusedWindow() { | 54 WmWindow* WmShellAura::GetFocusedWindow() { |
| 49 return WmWindowAura::Get( | 55 return WmWindowAura::Get( |
| 50 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) | 56 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 51 ->GetFocusedWindow()); | 57 ->GetFocusedWindow()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) { | 68 WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) { |
| 63 return WmWindowAura::Get(Shell::GetInstance() | 69 return WmWindowAura::Get(Shell::GetInstance() |
| 64 ->window_tree_host_manager() | 70 ->window_tree_host_manager() |
| 65 ->GetRootWindowForDisplayId(display_id)); | 71 ->GetRootWindowForDisplayId(display_id)); |
| 66 } | 72 } |
| 67 | 73 |
| 68 WmWindow* WmShellAura::GetRootWindowForNewWindows() { | 74 WmWindow* WmShellAura::GetRootWindowForNewWindows() { |
| 69 return WmWindowAura::Get(Shell::GetTargetRootWindow()); | 75 return WmWindowAura::Get(Shell::GetTargetRootWindow()); |
| 70 } | 76 } |
| 71 | 77 |
| 72 std::vector<WmWindow*> WmShellAura::GetMruWindowList() { | |
| 73 // TODO(sky): remove this and provide accessor for MruWindowTracker. | |
| 74 // http://crbug.com/617789. | |
| 75 return Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); | |
| 76 } | |
| 77 | |
| 78 std::vector<WmWindow*> WmShellAura::GetMruWindowListIgnoreModals() { | |
| 79 // TODO(sky): remove this and provide accessor for MruWindowTracker. | |
| 80 // http://crbug.com/617789. | |
| 81 return Shell::GetInstance() | |
| 82 ->mru_window_tracker() | |
| 83 ->BuildWindowListIgnoreModal(); | |
| 84 } | |
| 85 | 78 |
| 86 bool WmShellAura::IsForceMaximizeOnFirstRun() { | 79 bool WmShellAura::IsForceMaximizeOnFirstRun() { |
| 87 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); | 80 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); |
| 88 } | 81 } |
| 89 | 82 |
| 90 bool WmShellAura::CanShowWindowForUser(WmWindow* window) { | 83 bool WmShellAura::CanShowWindowForUser(WmWindow* window) { |
| 91 return Shell::GetInstance()->delegate()->CanShowWindowForUser( | 84 return Shell::GetInstance()->delegate()->CanShowWindowForUser( |
| 92 WmWindowAura::GetAuraWindow(window)); | 85 WmWindowAura::GetAuraWindow(window)); |
| 93 } | 86 } |
| 94 | 87 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 188 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 196 OnDisplayConfigurationChanged()); | 189 OnDisplayConfigurationChanged()); |
| 197 } | 190 } |
| 198 | 191 |
| 199 void WmShellAura::OnOverviewModeEnded() { | 192 void WmShellAura::OnOverviewModeEnded() { |
| 200 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, | 193 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, |
| 201 OnOverviewModeEnded()); | 194 OnOverviewModeEnded()); |
| 202 } | 195 } |
| 203 | 196 |
| 204 } // namespace ash | 197 } // namespace ash |
| OLD | NEW |