Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: ash/mus/disconnected_app_handler.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: merge Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mus/bridge/wm_window_mus.h" 7 #include "ash/mus/bridge/wm_window_mus.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 10
10 namespace ash { 11 namespace ash {
11 namespace mus { 12 namespace mus {
12 namespace { 13 namespace {
13 14
14 bool IsContainer(ui::Window* window) { 15 bool IsContainer(aura::Window* window) {
15 return WmWindowMus::Get(window)->IsContainer(); 16 return WmWindowMus::Get(window)->IsContainer();
16 } 17 }
17 18
18 } // namespace 19 } // namespace
19 20
20 DisconnectedAppHandler::DisconnectedAppHandler(ui::Window* root_window) { 21 DisconnectedAppHandler::DisconnectedAppHandler(aura::Window* root_window) {
21 WmWindowMus* root = WmWindowMus::Get(root_window); 22 WmWindowMus* root = WmWindowMus::Get(root_window);
22 for (int shell_window_id = kShellWindowId_Min; 23 for (int shell_window_id = kShellWindowId_Min;
23 shell_window_id < kShellWindowId_Max; ++shell_window_id) { 24 shell_window_id < kShellWindowId_Max; ++shell_window_id) {
24 // kShellWindowId_VirtualKeyboardContainer is lazily created. 25 // kShellWindowId_VirtualKeyboardContainer is lazily created.
25 // TODO(sky): http://crbug.com/616909 . 26 // TODO(sky): http://crbug.com/616909 .
26 // kShellWindowId_PhantomWindow is not a container, but a window. 27 // kShellWindowId_PhantomWindow is not a container, but a window.
27 if (shell_window_id == kShellWindowId_VirtualKeyboardContainer || 28 if (shell_window_id == kShellWindowId_VirtualKeyboardContainer ||
28 shell_window_id == kShellWindowId_PhantomWindow) 29 shell_window_id == kShellWindowId_PhantomWindow)
29 continue; 30 continue;
30 31
31 // kShellWindowId_MouseCursorContainer is chromeos specific. 32 // kShellWindowId_MouseCursorContainer is chromeos specific.
32 #if !defined(OS_CHROMEOS) 33 #if !defined(OS_CHROMEOS)
33 if (shell_window_id == kShellWindowId_MouseCursorContainer) 34 if (shell_window_id == kShellWindowId_MouseCursorContainer)
34 continue; 35 continue;
35 #endif 36 #endif
36 37
37 WmWindowMus* container = WmWindowMus::AsWmWindowMus( 38 WmWindowMus* container = WmWindowMus::AsWmWindowMus(
38 root->GetChildByShellWindowId(shell_window_id)); 39 root->GetChildByShellWindowId(shell_window_id));
39 Add(container->mus_window()); 40 Add(container->aura_window());
40 41
41 // Add any pre-existing windows in the container to 42 // Add any pre-existing windows in the container to
42 // |disconnected_app_handler_|. 43 // |disconnected_app_handler_|.
43 for (ui::Window* child : container->mus_window()->children()) { 44 for (aura::Window* child : container->aura_window()->children()) {
44 if (!IsContainer(child)) 45 if (!IsContainer(child))
45 Add(child); 46 Add(child);
46 } 47 }
47 } 48 }
48 } 49 }
49 50
50 DisconnectedAppHandler::~DisconnectedAppHandler() {} 51 DisconnectedAppHandler::~DisconnectedAppHandler() {}
51 52
52 void DisconnectedAppHandler::OnWindowEmbeddedAppDisconnected( 53 void DisconnectedAppHandler::OnEmbeddedAppDisconnected(aura::Window* window) {
53 ui::Window* window) {
54 if (!IsContainer(window)) 54 if (!IsContainer(window))
55 window->Destroy(); 55 delete window;
56 } 56 }
57 57
58 void DisconnectedAppHandler::OnTreeChanging(const TreeChangeParams& params) { 58 void DisconnectedAppHandler::OnWindowHierarchyChanging(
59 const HierarchyChangeParams& params) {
59 if (params.old_parent == params.receiver && IsContainer(params.old_parent)) 60 if (params.old_parent == params.receiver && IsContainer(params.old_parent))
60 Remove(params.target); 61 Remove(params.target);
61 62
62 if (params.new_parent == params.receiver && IsContainer(params.new_parent)) 63 if (params.new_parent == params.receiver && IsContainer(params.new_parent))
63 Add(params.target); 64 Add(params.target);
64 65
65 ui::WindowTracker::OnTreeChanging(params); 66 aura::WindowTracker::OnWindowHierarchyChanging(params);
66 } 67 }
67 68
68 } // namespace mus 69 } // namespace mus
69 } // namespace ash 70 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698