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

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: Rebase 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 3cdb88cf19897663b2a7a29fb11b56b442147dfb..4057398b8e947b7109aa07044f3b5492a137b3ab 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree_impl.cc
@@ -590,6 +590,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());
@@ -978,6 +989,36 @@ void WindowTreeImpl::GetWindowTree(
callback.Run(WindowsToWindowDatas(windows));
}
+void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id));
sky 2016/01/29 20:47:00 Sorry, I've changed things around. You want: wind
jonross 2016/02/01 18:52:22 Done.
+ 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)) &&
sky 2016/01/29 20:47:00 Can the condition in () ever hit? Why do we need i
jonross 2016/02/01 18:52:22 Yes this can be hit. When a window tree has been
+ 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 = GetWindow(WindowIdFromTransportId(window_id));
sky 2016/01/29 20:47:00 Same comment about ids.
jonross 2016/02/01 18:52:22 Done.
+ WindowTreeHostImpl* host = GetHost(window);
+ ServerWindow* capture_window = host ? host->GetCaptureWindow() : nullptr;
+ bool success = window && host &&
+ access_policy_->CanSetCapture(capture_window) &&
+ window == 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) {
@@ -1084,7 +1125,6 @@ void WindowTreeImpl::OnWindowInputEventAck(uint32_t event_id) {
NOTIMPLEMENTED() << "Wrong event acked.";
}
event_ack_id_ = 0;
-
WindowTreeHostImpl* event_source_host = event_source_host_;
event_source_host_ = nullptr;
if (event_source_host)

Powered by Google App Engine
This is Rietveld 408576698