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

Unified Diff: components/mus/ws/window_tree.cc

Issue 1759523002: mus: Server-side implementation of modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 4 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
Index: components/mus/ws/window_tree.cc
diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc
index 7782e8b30fecbc69df847ec8797d0ca23621d9b2..fe82ecc8d3f91b9981a3789ca8877e8b2de395d5 100644
--- a/components/mus/ws/window_tree.cc
+++ b/components/mus/ws/window_tree.cc
@@ -223,6 +223,18 @@ bool WindowTree::AddTransientWindow(const ClientWindowId& window_id,
return false;
}
+bool WindowTree::SetAsModal(const ClientWindowId& window_id) {
+ ServerWindow* window = GetWindowByClientId(window_id);
+ if (window && access_policy_->CanSetAsModal(window)) {
+ window->SetAsModal();
+ Display* display = GetDisplay(window);
+ if (display)
+ display->ReleaseCaptureForModalWindow(window);
+ return true;
+ }
+ return false;
+}
+
std::vector<const ServerWindow*> WindowTree::GetWindowTree(
const ClientWindowId& window_id) const {
const ServerWindow* window = GetWindowByClientId(window_id);
@@ -984,6 +996,10 @@ void WindowTree::RemoveTransientWindowFromParent(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
+void WindowTree::SetAsModal(uint32_t change_id, Id window_id) {
+ client()->OnChangeCompleted(change_id, SetAsModal(ClientWindowId(window_id)));
+}
+
void WindowTree::ReorderWindow(uint32_t change_id,
Id window_id,
Id relative_window_id,
@@ -1021,7 +1037,7 @@ void WindowTree::SetCapture(uint32_t change_id, Id window_id) {
event_ack_id_;
if (success) {
Operation op(this, connection_manager_, OperationType::SET_CAPTURE);
- display->SetCapture(window, !HasRoot(window));
+ success = display->SetCapture(window, !HasRoot(window));
}
client()->OnChangeCompleted(change_id, success);
}
@@ -1037,7 +1053,7 @@ void WindowTree::ReleaseCapture(uint32_t change_id, Id window_id) {
window == current_capture_window;
if (success) {
Operation op(this, connection_manager_, OperationType::RELEASE_CAPTURE);
- display->SetCapture(nullptr, false);
+ success = display->SetCapture(nullptr, false);
}
client()->OnChangeCompleted(change_id, success);
}

Powered by Google App Engine
This is Rietveld 408576698