| 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 "mash/wm/bridge/wm_globals_mus.h" | 5 #include "mash/wm/bridge/wm_globals_mus.h" |
| 6 | 6 |
| 7 #include "ash/wm/common/window_resizer.h" | 7 #include "ash/wm/common/window_resizer.h" |
| 8 #include "ash/wm/common/wm_activation_observer.h" | 8 #include "ash/wm/common/wm_activation_observer.h" |
| 9 #include "ash/wm/common/wm_shell_window_ids.h" | 9 #include "ash/wm/common/wm_shell_window_ids.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 ash::wm::WmWindow* WmGlobalsMus::GetFocusedWindow() { | 74 ash::wm::WmWindow* WmGlobalsMus::GetFocusedWindow() { |
| 75 return WmWindowMus::Get(connection_->GetFocusedWindow()); | 75 return WmWindowMus::Get(connection_->GetFocusedWindow()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 ash::wm::WmWindow* WmGlobalsMus::GetActiveWindow() { | 78 ash::wm::WmWindow* WmGlobalsMus::GetActiveWindow() { |
| 79 return GetToplevelAncestor(connection_->GetFocusedWindow()); | 79 return GetToplevelAncestor(connection_->GetFocusedWindow()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ash::wm::WmWindow* WmGlobalsMus::GetPrimaryRootWindow() { |
| 83 return root_window_controllers_[0]->GetWindow(); |
| 84 } |
| 85 |
| 82 ash::wm::WmWindow* WmGlobalsMus::GetRootWindowForDisplayId(int64_t display_id) { | 86 ash::wm::WmWindow* WmGlobalsMus::GetRootWindowForDisplayId(int64_t display_id) { |
| 83 return GetRootWindowControllerWithDisplayId(display_id)->GetWindow(); | 87 return GetRootWindowControllerWithDisplayId(display_id)->GetWindow(); |
| 84 } | 88 } |
| 85 | 89 |
| 86 ash::wm::WmWindow* WmGlobalsMus::GetRootWindowForNewWindows() { | 90 ash::wm::WmWindow* WmGlobalsMus::GetRootWindowForNewWindows() { |
| 87 NOTIMPLEMENTED(); | 91 NOTIMPLEMENTED(); |
| 88 return root_window_controllers_[0]->GetWindow(); | 92 return root_window_controllers_[0]->GetWindow(); |
| 89 } | 93 } |
| 90 | 94 |
| 95 std::vector<ash::wm::WmWindow*> WmGlobalsMus::GetMruWindowList() { |
| 96 NOTIMPLEMENTED(); |
| 97 return std::vector<ash::wm::WmWindow*>(); |
| 98 } |
| 99 |
| 91 std::vector<ash::wm::WmWindow*> WmGlobalsMus::GetMruWindowListIgnoreModals() { | 100 std::vector<ash::wm::WmWindow*> WmGlobalsMus::GetMruWindowListIgnoreModals() { |
| 92 NOTIMPLEMENTED(); | 101 NOTIMPLEMENTED(); |
| 93 return std::vector<ash::wm::WmWindow*>(); | 102 return std::vector<ash::wm::WmWindow*>(); |
| 94 } | 103 } |
| 95 | 104 |
| 96 bool WmGlobalsMus::IsForceMaximizeOnFirstRun() { | 105 bool WmGlobalsMus::IsForceMaximizeOnFirstRun() { |
| 97 NOTIMPLEMENTED(); | 106 NOTIMPLEMENTED(); |
| 98 return false; | 107 return false; |
| 99 } | 108 } |
| 100 | 109 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 195 } |
| 187 | 196 |
| 188 void WmGlobalsMus::RemoveConnectionObserver() { | 197 void WmGlobalsMus::RemoveConnectionObserver() { |
| 189 if (!connection_) | 198 if (!connection_) |
| 190 return; | 199 return; |
| 191 | 200 |
| 192 connection_->RemoveObserver(this); | 201 connection_->RemoveObserver(this); |
| 193 connection_ = nullptr; | 202 connection_ = nullptr; |
| 194 } | 203 } |
| 195 | 204 |
| 205 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. |
| 196 void WmGlobalsMus::OnWindowTreeFocusChanged(mus::Window* gained_focus, | 206 void WmGlobalsMus::OnWindowTreeFocusChanged(mus::Window* gained_focus, |
| 197 mus::Window* lost_focus) { | 207 mus::Window* lost_focus) { |
| 198 WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); | 208 WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); |
| 199 WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); | 209 WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); |
| 200 if (gained_active == lost_active) | 210 if (gained_active == lost_active) |
| 201 return; | 211 return; |
| 202 | 212 |
| 203 FOR_EACH_OBSERVER(ash::wm::WmActivationObserver, activation_observers_, | 213 FOR_EACH_OBSERVER(ash::wm::WmActivationObserver, activation_observers_, |
| 204 OnWindowActivated(gained_active, lost_active)); | 214 OnWindowActivated(gained_active, lost_active)); |
| 205 } | 215 } |
| 206 | 216 |
| 207 void WmGlobalsMus::OnWillDestroyConnection( | 217 void WmGlobalsMus::OnWillDestroyConnection( |
| 208 mus::WindowTreeConnection* connection) { | 218 mus::WindowTreeConnection* connection) { |
| 209 DCHECK_EQ(connection, connection_); | 219 DCHECK_EQ(connection, connection_); |
| 210 RemoveConnectionObserver(); | 220 RemoveConnectionObserver(); |
| 211 } | 221 } |
| 212 | 222 |
| 213 } // namespace wm | 223 } // namespace wm |
| 214 } // namespace mash | 224 } // namespace mash |
| OLD | NEW |