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

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

Issue 1605773004: mus: Implement Window Server Capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create InFlightCaptureChange add tests Created 4 years, 11 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_impl.cc
diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree_impl.cc
index f9d145bfcbcde4ae756d28c4222967dc89842e70..29abe29c45bd37972fbeff53729e79df8c502abf 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree_impl.cc
@@ -600,6 +600,17 @@ bool WindowTreeImpl::ShouldRouteToWindowManager(
return is_wm ? false : true;
}
+void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window,
+ bool originated_change) {
+ if ((originated_change &&
+ connection_manager_->current_operation_type() ==
+ OperationType::RELEASE_CAPTURE) ||
+ !IsWindowKnown(old_capture_window)) {
+ return;
+ }
+ client()->OnLostCapture(WindowIdToTransportId(old_capture_window->id()));
+}
+
ClientWindowId WindowTreeImpl::ClientWindowIdForWindow(
const ServerWindow* window) const {
auto iter = window_id_to_client_id_map_.find(window->id());
@@ -988,6 +999,38 @@ void WindowTreeImpl::GetWindowTree(
callback.Run(WindowsToWindowDatas(windows));
}
+void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ WindowTreeHostImpl* host = GetHost(window);
+ ServerWindow* current_capture_window =
+ host ? host->GetCaptureWindow() : nullptr;
+ bool success = window && access_policy_->CanSetCapture(window) && host &&
+ (!current_capture_window ||
+ access_policy_->CanSetCapture(current_capture_window)) &&
+ event_ack_id_;
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::SET_CAPTURE);
+ host->SetCapture(window, !HasRoot(window));
+ }
+ client_->OnChangeCompleted(change_id, success);
+}
+
+void WindowTreeImpl::ReleaseCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
+ WindowTreeHostImpl* host = GetHost(window);
+ ServerWindow* current_capture_window =
+ host ? host->GetCaptureWindow() : nullptr;
+ bool success = window && host &&
+ (!current_capture_window ||
+ access_policy_->CanSetCapture(current_capture_window)) &&
+ window == current_capture_window;
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::RELEASE_CAPTURE);
+ host->SetCapture(nullptr, false);
+ }
+ client_->OnChangeCompleted(change_id, success);
+}
+
void WindowTreeImpl::SetWindowBounds(uint32_t change_id,
Id window_id,
mojo::RectPtr bounds) {

Powered by Google App Engine
This is Rietveld 408576698