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

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

Issue 1352043005: mus: Implement Window Server Capture Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added capture unit tests Created 5 years, 1 month 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 d783982079ea319788602ebe4645527d9963ad93..d778a026d7bf63c8a60624e4aea76ba14b57c0c6 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree_impl.cc
@@ -403,6 +403,11 @@ bool WindowTreeImpl::ShouldRouteToWindowManager(
return true;
}
+void WindowTreeImpl::ProcessLostCapture(
+ const ServerWindow* old_capture_window) {
+ client()->OnLostCapture(WindowIdToTransportId(old_capture_window->id()));
+}
+
bool WindowTreeImpl::IsWindowKnown(const ServerWindow* window) const {
return known_windows_.count(WindowIdToTransportId(window->id())) > 0;
}
@@ -697,6 +702,30 @@ void WindowTreeImpl::GetWindowTree(
callback.Run(WindowsToWindowDatas(windows));
}
+void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id));
+ WindowTreeHostImpl* host = GetHost();
+ bool success = window && access_policy_->CanSetCapture(window) && host &&
+ access_policy_->CanSetCapture(host->GetCaptureWindow());
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::SET_CAPTURE);
+ host->SetCapture(window);
+ }
+ client_->OnChangeCompleted(change_id, success);
+}
+
+void WindowTreeImpl::ReleaseCapture(uint32_t change_id, Id window_id) {
+ ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id));
+ WindowTreeHostImpl* host = GetHost();
+ bool success =
+ window && host && access_policy_->CanSetCapture(host->GetCaptureWindow());
+ if (success) {
+ Operation op(this, connection_manager_, OperationType::RELEASE_CAPTURE);
+ host->SetCapture(nullptr);
+ }
+ 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