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

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

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include Created 4 years, 6 months 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
« no previous file with comments | « ash/mus/disconnected_app_handler.h ('k') | ash/mus/manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/shell_window_ids.h"
8 #include "ash/mus/bridge/wm_window_mus.h"
9
7 namespace ash { 10 namespace ash {
8 namespace mus { 11 namespace mus {
12 namespace {
9 13
10 DisconnectedAppHandler::DisconnectedAppHandler() {} 14 bool IsContainer(::mus::Window* window) {
15 return WmWindowMus::Get(window)->IsContainer();
16 }
17
18 } // namespace
19
20 DisconnectedAppHandler::DisconnectedAppHandler(::mus::Window* root_window) {
21 WmWindowMus* root = WmWindowMus::Get(root_window);
22 for (int shell_window_id = kShellWindowId_Min;
23 shell_window_id < kShellWindowId_Max; ++shell_window_id) {
24 // kShellWindowId_VirtualKeyboardContainer is lazily created.
25 // TODO(sky): http://crbug.com/616909 .
26 // kShellWindowId_PhantomWindow is not a container, but a window.
27 if (shell_window_id == kShellWindowId_VirtualKeyboardContainer ||
28 shell_window_id == kShellWindowId_PhantomWindow)
29 continue;
30
31 // kShellWindowId_MouseCursorContainer is chromeos specific.
32 #if !defined(OS_CHROMEOS)
33 if (shell_window_id == kShellWindowId_MouseCursorContainer)
34 continue;
35 #endif
36
37 WmWindowMus* container = WmWindowMus::AsWmWindowMus(
38 root->GetChildByShellWindowId(shell_window_id));
39 Add(container->mus_window());
40
41 // Add any pre-existing windows in the container to
42 // |disconnected_app_handler_|.
43 for (::mus::Window* child : container->mus_window()->children()) {
44 if (!IsContainer(child))
45 Add(child);
46 }
47 }
48 }
11 49
12 DisconnectedAppHandler::~DisconnectedAppHandler() {} 50 DisconnectedAppHandler::~DisconnectedAppHandler() {}
13 51
14 void DisconnectedAppHandler::OnWindowEmbeddedAppDisconnected( 52 void DisconnectedAppHandler::OnWindowEmbeddedAppDisconnected(
15 ::mus::Window* window) { 53 ::mus::Window* window) {
16 window->Destroy(); 54 if (!IsContainer(window))
55 window->Destroy();
56 }
57
58 void DisconnectedAppHandler::OnTreeChanging(const TreeChangeParams& params) {
59 if (params.old_parent == params.receiver && IsContainer(params.old_parent))
60 Remove(params.target);
61
62 if (params.new_parent == params.receiver && IsContainer(params.new_parent))
63 Add(params.target);
64
65 ::mus::WindowTracker::OnTreeChanging(params);
17 } 66 }
18 67
19 } // namespace mus 68 } // namespace mus
20 } // namespace ash 69 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/disconnected_app_handler.h ('k') | ash/mus/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698