| 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/disconnected_app_handler.h" |   5 #include "ash/mus/disconnected_app_handler.h" | 
|   6  |   6  | 
|   7 #include "ash/aura/wm_window_aura.h" |   7 #include "ash/common/wm_window.h" | 
|   8 #include "ash/public/cpp/shell_window_ids.h" |   8 #include "ash/public/cpp/shell_window_ids.h" | 
|   9 #include "ui/aura/window.h" |   9 #include "ui/aura/window.h" | 
|  10  |  10  | 
|  11 namespace ash { |  11 namespace ash { | 
|  12 namespace mus { |  12 namespace mus { | 
|  13 namespace { |  13 namespace { | 
|  14  |  14  | 
|  15 bool IsContainer(aura::Window* window) { |  15 bool IsContainer(aura::Window* window) { | 
|  16   return WmWindowAura::Get(window)->GetShellWindowId() != |  16   return WmWindow::Get(window)->GetShellWindowId() != kShellWindowId_Invalid; | 
|  17          kShellWindowId_Invalid; |  | 
|  18 } |  17 } | 
|  19  |  18  | 
|  20 }  // namespace |  19 }  // namespace | 
|  21  |  20  | 
|  22 DisconnectedAppHandler::DisconnectedAppHandler(aura::Window* root_window) { |  21 DisconnectedAppHandler::DisconnectedAppHandler(aura::Window* root_window) { | 
|  23   ash::WmWindowAura* root = ash::WmWindowAura::Get(root_window); |  22   WmWindow* root = WmWindow::Get(root_window); | 
|  24   for (int shell_window_id = kShellWindowId_Min; |  23   for (int shell_window_id = kShellWindowId_Min; | 
|  25        shell_window_id < kShellWindowId_Max; ++shell_window_id) { |  24        shell_window_id < kShellWindowId_Max; ++shell_window_id) { | 
|  26     // kShellWindowId_VirtualKeyboardContainer is lazily created. |  25     // kShellWindowId_VirtualKeyboardContainer is lazily created. | 
|  27     // TODO(sky): http://crbug.com/616909 . |  26     // TODO(sky): http://crbug.com/616909 . | 
|  28     // kShellWindowId_PhantomWindow is not a container, but a window. |  27     // kShellWindowId_PhantomWindow is not a container, but a window. | 
|  29     if (shell_window_id == kShellWindowId_VirtualKeyboardContainer || |  28     if (shell_window_id == kShellWindowId_VirtualKeyboardContainer || | 
|  30         shell_window_id == kShellWindowId_PhantomWindow) |  29         shell_window_id == kShellWindowId_PhantomWindow) | 
|  31       continue; |  30       continue; | 
|  32  |  31  | 
|  33 // kShellWindowId_MouseCursorContainer is chromeos specific. |  32 // kShellWindowId_MouseCursorContainer is chromeos specific. | 
|  34 #if !defined(OS_CHROMEOS) |  33 #if !defined(OS_CHROMEOS) | 
|  35     if (shell_window_id == kShellWindowId_MouseCursorContainer) |  34     if (shell_window_id == kShellWindowId_MouseCursorContainer) | 
|  36       continue; |  35       continue; | 
|  37 #endif |  36 #endif | 
|  38  |  37  | 
|  39     ash::WmWindowAura* container = static_cast<ash::WmWindowAura*>( |  38     WmWindow* container = root->GetChildByShellWindowId(shell_window_id); | 
|  40         root->GetChildByShellWindowId(shell_window_id)); |  | 
|  41     Add(container->aura_window()); |  39     Add(container->aura_window()); | 
|  42  |  40  | 
|  43     // Add any pre-existing windows in the container to |  41     // Add any pre-existing windows in the container to | 
|  44     // |disconnected_app_handler_|. |  42     // |disconnected_app_handler_|. | 
|  45     for (aura::Window* child : container->aura_window()->children()) { |  43     for (aura::Window* child : container->aura_window()->children()) { | 
|  46       if (!IsContainer(child)) |  44       if (!IsContainer(child)) | 
|  47         Add(child); |  45         Add(child); | 
|  48     } |  46     } | 
|  49   } |  47   } | 
|  50 } |  48 } | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  62     Remove(params.target); |  60     Remove(params.target); | 
|  63  |  61  | 
|  64   if (params.new_parent == params.receiver && IsContainer(params.new_parent)) |  62   if (params.new_parent == params.receiver && IsContainer(params.new_parent)) | 
|  65     Add(params.target); |  63     Add(params.target); | 
|  66  |  64  | 
|  67   aura::WindowTracker::OnWindowHierarchyChanging(params); |  65   aura::WindowTracker::OnWindowHierarchyChanging(params); | 
|  68 } |  66 } | 
|  69  |  67  | 
|  70 }  // namespace mus |  68 }  // namespace mus | 
|  71 }  // namespace ash |  69 }  // namespace ash | 
| OLD | NEW |