| 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/mus/bridge/wm_shell_mus.h" | 5 #include "ash/mus/bridge/wm_shell_mus.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/display/display_info.h" | 10 #include "ash/common/display/display_info.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 void WmShellMus::RemoveRootWindowController( | 160 void WmShellMus::RemoveRootWindowController( |
| 161 WmRootWindowControllerMus* controller) { | 161 WmRootWindowControllerMus* controller) { |
| 162 auto iter = std::find(root_window_controllers_.begin(), | 162 auto iter = std::find(root_window_controllers_.begin(), |
| 163 root_window_controllers_.end(), controller); | 163 root_window_controllers_.end(), controller); |
| 164 DCHECK(iter != root_window_controllers_.end()); | 164 DCHECK(iter != root_window_controllers_.end()); |
| 165 root_window_controllers_.erase(iter); | 165 root_window_controllers_.erase(iter); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 WmWindowMus* WmShellMus::GetToplevelAncestor(::ui::Window* window) { | 169 WmWindowMus* WmShellMus::GetToplevelAncestor(ui::Window* window) { |
| 170 while (window) { | 170 while (window) { |
| 171 if (IsActivationParent(window->parent())) | 171 if (IsActivationParent(window->parent())) |
| 172 return WmWindowMus::Get(window); | 172 return WmWindowMus::Get(window); |
| 173 window = window->parent(); | 173 window = window->parent(); |
| 174 } | 174 } |
| 175 return nullptr; | 175 return nullptr; |
| 176 } | 176 } |
| 177 | 177 |
| 178 WmRootWindowControllerMus* WmShellMus::GetRootWindowControllerWithDisplayId( | 178 WmRootWindowControllerMus* WmShellMus::GetRootWindowControllerWithDisplayId( |
| 179 int64_t id) { | 179 int64_t id) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { | 332 void WmShellMus::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 333 NOTIMPLEMENTED(); | 333 NOTIMPLEMENTED(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 #if defined(OS_CHROMEOS) | 336 #if defined(OS_CHROMEOS) |
| 337 void WmShellMus::ToggleIgnoreExternalKeyboard() { | 337 void WmShellMus::ToggleIgnoreExternalKeyboard() { |
| 338 NOTIMPLEMENTED(); | 338 NOTIMPLEMENTED(); |
| 339 } | 339 } |
| 340 #endif // defined(OS_CHROMEOS) | 340 #endif // defined(OS_CHROMEOS) |
| 341 | 341 |
| 342 ::ui::WindowTreeClient* WmShellMus::window_tree_client() { | 342 ui::WindowTreeClient* WmShellMus::window_tree_client() { |
| 343 return window_manager_->window_tree_client(); | 343 return window_manager_->window_tree_client(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 // static | 346 // static |
| 347 bool WmShellMus::IsActivationParent(::ui::Window* window) { | 347 bool WmShellMus::IsActivationParent(ui::Window* window) { |
| 348 return window && IsActivatableShellWindowId( | 348 return window && IsActivatableShellWindowId( |
| 349 WmWindowMus::Get(window)->GetShellWindowId()); | 349 WmWindowMus::Get(window)->GetShellWindowId()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. | 352 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. |
| 353 void WmShellMus::OnWindowTreeFocusChanged(::ui::Window* gained_focus, | 353 void WmShellMus::OnWindowTreeFocusChanged(ui::Window* gained_focus, |
| 354 ::ui::Window* lost_focus) { | 354 ui::Window* lost_focus) { |
| 355 WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); | 355 WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); |
| 356 WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); | 356 WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); |
| 357 if (gained_active == lost_active) | 357 if (gained_active == lost_active) |
| 358 return; | 358 return; |
| 359 | 359 |
| 360 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, | 360 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, |
| 361 OnWindowActivated(gained_active, lost_active)); | 361 OnWindowActivated(gained_active, lost_active)); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void WmShellMus::OnDidDestroyClient(::ui::WindowTreeClient* client) { | 364 void WmShellMus::OnDidDestroyClient(ui::WindowTreeClient* client) { |
| 365 DCHECK_EQ(window_tree_client(), client); | 365 DCHECK_EQ(window_tree_client(), client); |
| 366 client->RemoveObserver(this); | 366 client->RemoveObserver(this); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace mus | 369 } // namespace mus |
| 370 } // namespace ash | 370 } // namespace ash |
| OLD | NEW |