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

Side by Side Diff: ash/common/wm/container_finder.cc

Issue 2287583002: mash: Fix crash when closing system tray menu (Closed)
Patch Set: Created 4 years, 3 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
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/common/wm/container_finder.h" 5 #include "ash/common/wm/container_finder.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/always_on_top_controller.h" 9 #include "ash/common/wm/always_on_top_controller.h"
10 #include "ash/common/wm/root_window_finder.h" 10 #include "ash/common/wm/root_window_finder.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 WmWindow* GetContainerFromAlwaysOnTopController(WmWindow* root, 53 WmWindow* GetContainerFromAlwaysOnTopController(WmWindow* root,
54 WmWindow* window) { 54 WmWindow* window) {
55 return root->GetRootWindowController() 55 return root->GetRootWindowController()
56 ->GetAlwaysOnTopController() 56 ->GetAlwaysOnTopController()
57 ->GetContainer(window); 57 ->GetContainer(window);
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 WmWindow* GetContainerForWindow(WmWindow* window) { 62 WmWindow* GetContainerForWindow(WmWindow* window) {
63 WmWindow* container = window->GetParent(); 63 WmWindow* parent = window->GetParent();
64 while (container && container->GetType() != ui::wm::WINDOW_TYPE_UNKNOWN) 64 // The first parent with an explicit shell window ID is the container.
65 container = container->GetParent(); 65 while (parent && parent->GetShellWindowId() == kShellWindowId_Invalid)
66 return container; 66 parent = parent->GetParent();
67 return parent;
67 } 68 }
68 69
69 WmWindow* GetDefaultParent(WmWindow* context, 70 WmWindow* GetDefaultParent(WmWindow* context,
70 WmWindow* window, 71 WmWindow* window,
71 const gfx::Rect& bounds) { 72 const gfx::Rect& bounds) {
72 WmWindow* target_root = nullptr; 73 WmWindow* target_root = nullptr;
73 WmWindow* transient_parent = window->GetTransientParent(); 74 WmWindow* transient_parent = window->GetTransientParent();
74 if (transient_parent) { 75 if (transient_parent) {
75 // Transient window should use the same root as its transient parent. 76 // Transient window should use the same root as its transient parent.
76 target_root = transient_parent->GetRootWindow(); 77 target_root = transient_parent->GetRootWindow();
(...skipping 25 matching lines...) Expand all
102 default: 103 default:
103 NOTREACHED() << "Window " << window->GetShellWindowId() 104 NOTREACHED() << "Window " << window->GetShellWindowId()
104 << " has unhandled type " << window->GetType(); 105 << " has unhandled type " << window->GetType();
105 break; 106 break;
106 } 107 }
107 return nullptr; 108 return nullptr;
108 } 109 }
109 110
110 } // namespace wm 111 } // namespace wm
111 } // namespace ash 112 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698