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

Unified Diff: services/ui/ws/window_tree.cc

Issue 2745143004: Inform window manager about modal windows in mus+ash. (Closed)
Patch Set: rebased. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/test_utils.cc ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 52b87604194b4ffeb96217bafd6a1f0d346dae4d..2e2f73bfdd471cbb3a3beebc78c98f00caf11dfb 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -355,8 +355,24 @@ bool WindowTree::DeleteWindow(const ClientWindowId& window_id) {
bool WindowTree::SetModalType(const ClientWindowId& window_id,
ModalType modal_type) {
ServerWindow* window = GetWindowByClientId(window_id);
- if (!window || !access_policy_->CanSetModal(window))
+ if (!window) {
+ DVLOG(1) << "SetModalType failed (invalid id)";
+ return false;
+ }
+
+ if (ShouldRouteToWindowManager(window)) {
+ WindowTree* wm_tree = GetWindowManagerDisplayRoot(window)
+ ->window_manager_state()
+ ->window_tree();
+ wm_tree->window_manager_internal_->WmSetModalType(
+ wm_tree->ClientWindowIdForWindow(window).id, modal_type);
+ return true;
+ }
+
+ if (!access_policy_->CanSetModal(window)) {
+ DVLOG(1) << "SetModalType failed (access denied)";
return false;
+ }
if (window->modal_type() == modal_type)
return true;
@@ -366,8 +382,14 @@ bool WindowTree::SetModalType(const ClientWindowId& window_id,
auto* display_root = GetWindowManagerDisplayRoot(window);
switch (modal_type) {
case MODAL_TYPE_SYSTEM:
- if (user_id_ == InvalidUserId() || !display_root)
+ if (user_id_ == InvalidUserId()) {
+ DVLOG(1) << "SetModalType failed (invalid user id)";
return false;
+ }
+ if (!display_root) {
+ DVLOG(1) << "SetModalType failed (no display root)";
+ return false;
+ }
window->SetModalType(modal_type);
display_root->window_manager_state()->AddSystemModalWindow(window);
break;
« no previous file with comments | « services/ui/ws/test_utils.cc ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698