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

Unified Diff: components/mus/public/cpp/lib/window_tree_client_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/public/cpp/lib/window_tree_client_impl.cc
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc
index 9c6b6257b7f004dc4cb273f444b585052913eca9..18f57f17fa856099cabd82ace9b270b659ee7b9a 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -207,6 +207,24 @@ void WindowTreeClientImpl::SetBounds(Window* window,
tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds));
}
+void WindowTreeClientImpl::SetCapture(Window* window) {
+ // In order for us to get here we had to have exposed a window, which implies
+ // we got a connection.
+ DCHECK(tree_);
+ const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
+ new CrashInFlightChange(window, ChangeType::SET_CAPTURE)));
+ tree_->SetCapture(change_id, window->id());
+}
+
+void WindowTreeClientImpl::ReleaseCapture(Window* window) {
+ // In order for us to get here we had to have exposed a window, which implies
+ // we got a connection.
+ DCHECK(tree_);
+ const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
+ new CrashInFlightChange(window, ChangeType::RELEASE_CAPTURE)));
+ tree_->ReleaseCapture(change_id, window->id());
+}
+
void WindowTreeClientImpl::SetClientArea(Id window_id,
const gfx::Insets& client_area) {
DCHECK(tree_);
@@ -434,6 +452,14 @@ void WindowTreeClientImpl::OnUnembed() {
delete this;
}
+void WindowTreeClientImpl::OnLostCapture(Id window_id) {
+ Window* window = GetWindowById(window_id);
+ if (window) {
+ FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
+ OnWindowLostCapture(window));
+ }
+}
+
void WindowTreeClientImpl::OnWindowBoundsChanged(Id window_id,
mojo::RectPtr old_bounds,
mojo::RectPtr new_bounds) {

Powered by Google App Engine
This is Rietveld 408576698