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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/ws/window_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 // Have the owner of the tree service the actual delete. 350 // Have the owner of the tree service the actual delete.
351 WindowTree* tree = window_server_->GetTreeWithId(window->id().client_id); 351 WindowTree* tree = window_server_->GetTreeWithId(window->id().client_id);
352 return tree && tree->DeleteWindowImpl(this, window); 352 return tree && tree->DeleteWindowImpl(this, window);
353 } 353 }
354 354
355 bool WindowTree::SetModalType(const ClientWindowId& window_id, 355 bool WindowTree::SetModalType(const ClientWindowId& window_id,
356 ModalType modal_type) { 356 ModalType modal_type) {
357 ServerWindow* window = GetWindowByClientId(window_id); 357 ServerWindow* window = GetWindowByClientId(window_id);
358 if (!window || !access_policy_->CanSetModal(window)) 358 if (!window) {
359 DVLOG(1) << "SetModalType failed (invalid id)";
359 return false; 360 return false;
361 }
362
363 if (ShouldRouteToWindowManager(window)) {
364 WindowTree* wm_tree = GetWindowManagerDisplayRoot(window)
365 ->window_manager_state()
366 ->window_tree();
367 wm_tree->window_manager_internal_->WmSetModalType(
368 wm_tree->ClientWindowIdForWindow(window).id, modal_type);
369 return true;
370 }
371
372 if (!access_policy_->CanSetModal(window)) {
373 DVLOG(1) << "SetModalType failed (access denied)";
374 return false;
375 }
360 376
361 if (window->modal_type() == modal_type) 377 if (window->modal_type() == modal_type)
362 return true; 378 return true;
363 379
364 // TODO(moshayedi): crbug.com/697176. When modality of a window that used to 380 // TODO(moshayedi): crbug.com/697176. When modality of a window that used to
365 // be a system modal changes, notify window manager state. 381 // be a system modal changes, notify window manager state.
366 auto* display_root = GetWindowManagerDisplayRoot(window); 382 auto* display_root = GetWindowManagerDisplayRoot(window);
367 switch (modal_type) { 383 switch (modal_type) {
368 case MODAL_TYPE_SYSTEM: 384 case MODAL_TYPE_SYSTEM:
369 if (user_id_ == InvalidUserId() || !display_root) 385 if (user_id_ == InvalidUserId()) {
386 DVLOG(1) << "SetModalType failed (invalid user id)";
370 return false; 387 return false;
388 }
389 if (!display_root) {
390 DVLOG(1) << "SetModalType failed (no display root)";
391 return false;
392 }
371 window->SetModalType(modal_type); 393 window->SetModalType(modal_type);
372 display_root->window_manager_state()->AddSystemModalWindow(window); 394 display_root->window_manager_state()->AddSystemModalWindow(window);
373 break; 395 break;
374 case MODAL_TYPE_NONE: 396 case MODAL_TYPE_NONE:
375 case MODAL_TYPE_WINDOW: 397 case MODAL_TYPE_WINDOW:
376 case MODAL_TYPE_CHILD: 398 case MODAL_TYPE_CHILD:
377 window->SetModalType(modal_type); 399 window->SetModalType(modal_type);
378 break; 400 break;
379 } 401 }
380 if (display_root && modal_type != MODAL_TYPE_NONE) { 402 if (display_root && modal_type != MODAL_TYPE_NONE) {
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 2206 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
2185 effect_bitmask, callback); 2207 effect_bitmask, callback);
2186 } 2208 }
2187 2209
2188 void WindowTree::PerformOnDragDropDone() { 2210 void WindowTree::PerformOnDragDropDone() {
2189 client()->OnDragDropDone(); 2211 client()->OnDragDropDone();
2190 } 2212 }
2191 2213
2192 } // namespace ws 2214 } // namespace ws
2193 } // namespace ui 2215 } // namespace ui
OLDNEW
« 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