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

Side by Side Diff: services/ui/ws/window_tree.cc

Issue 2710023007: Make WindowTree::SetModal() take the type. (Closed)
Patch Set: more code. 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
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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (!access_policy_->CanDeleteWindow(window) && 345 if (!access_policy_->CanDeleteWindow(window) &&
346 !ShouldRouteToWindowManager(window)) { 346 !ShouldRouteToWindowManager(window)) {
347 return false; 347 return false;
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::SetModal(const ClientWindowId& window_id) { 355 bool WindowTree::SetModal(const ClientWindowId& window_id,
356 ModalType modal_type) {
356 ServerWindow* window = GetWindowByClientId(window_id); 357 ServerWindow* window = GetWindowByClientId(window_id);
357 if (window && access_policy_->CanSetModal(window)) { 358 if (window && access_policy_->CanSetModal(window)) {
358 WindowManagerDisplayRoot* display_root = 359 WindowManagerDisplayRoot* display_root =
359 GetWindowManagerDisplayRoot(window); 360 GetWindowManagerDisplayRoot(window);
360 if (window->transient_parent()) { 361 switch (modal_type) {
361 window->SetModal(); 362 case MODAL_TYPE_NONE:
362 } else if (user_id_ != InvalidUserId()) { 363 window->SetModal(false);
sky 2017/02/24 20:18:53 I think SetModal should change to take the type.
Hadi 2017/02/28 20:29:07 Done.
363 if (display_root) 364 break;
364 display_root->window_manager_state()->AddSystemModalWindow(window); 365 case MODAL_TYPE_WINDOW:
365 } else { 366 window->SetModal(true);
366 return false; 367 break;
368 case MODAL_TYPE_SYSTEM:
369 if (user_id_ != InvalidUserId() && display_root)
370 display_root->window_manager_state()->AddSystemModalWindow(window);
371 break;
372 case MODAL_TYPE_CHILD:
373 NOTIMPLEMENTED();
374 return false;
367 } 375 }
368 if (display_root) 376 if (display_root)
369 display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow( 377 display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow(
370 window); 378 window);
371 return true; 379 return true;
372 } 380 }
373 return false; 381 return false;
374 } 382 }
375 383
376 std::vector<const ServerWindow*> WindowTree::GetWindowTree( 384 std::vector<const ServerWindow*> WindowTree::GetWindowTree(
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 access_policy_->CanRemoveTransientWindowFromParent(transient_window)) { 1279 access_policy_->CanRemoveTransientWindowFromParent(transient_window)) {
1272 success = true; 1280 success = true;
1273 Operation op(this, window_server_, 1281 Operation op(this, window_server_,
1274 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT); 1282 OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT);
1275 transient_window->transient_parent()->RemoveTransientWindow( 1283 transient_window->transient_parent()->RemoveTransientWindow(
1276 transient_window); 1284 transient_window);
1277 } 1285 }
1278 client()->OnChangeCompleted(change_id, success); 1286 client()->OnChangeCompleted(change_id, success);
1279 } 1287 }
1280 1288
1281 void WindowTree::SetModal(uint32_t change_id, Id window_id) { 1289 void WindowTree::SetModal(uint32_t change_id,
1282 client()->OnChangeCompleted(change_id, SetModal(ClientWindowId(window_id))); 1290 Id window_id,
1291 ModalType modal_type) {
1292 client()->OnChangeCompleted(change_id,
1293 SetModal(ClientWindowId(window_id), modal_type));
1283 } 1294 }
1284 1295
1285 void WindowTree::ReorderWindow(uint32_t change_id, 1296 void WindowTree::ReorderWindow(uint32_t change_id,
1286 Id window_id, 1297 Id window_id,
1287 Id relative_window_id, 1298 Id relative_window_id,
1288 mojom::OrderDirection direction) { 1299 mojom::OrderDirection direction) {
1289 // TODO(erg): This implementation allows reordering two windows that are 1300 // TODO(erg): This implementation allows reordering two windows that are
1290 // children of a parent window which the two implementations can't see. There 1301 // children of a parent window which the two implementations can't see. There
1291 // should be a security check to prevent this. 1302 // should be a security check to prevent this.
1292 bool success = false; 1303 bool success = false;
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 2167 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
2157 effect_bitmask, callback); 2168 effect_bitmask, callback);
2158 } 2169 }
2159 2170
2160 void WindowTree::PerformOnDragDropDone() { 2171 void WindowTree::PerformOnDragDropDone() {
2161 client()->OnDragDropDone(); 2172 client()->OnDragDropDone();
2162 } 2173 }
2163 2174
2164 } // namespace ws 2175 } // namespace ws
2165 } // namespace ui 2176 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698