summaryrefslogtreecommitdiffstats
path: root/ui/views/widget/desktop_capture_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/widget/desktop_capture_client.cc')
-rw-r--r--ui/views/widget/desktop_capture_client.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/views/widget/desktop_capture_client.cc b/ui/views/widget/desktop_capture_client.cc
new file mode 100644
index 0000000..2c7cc6a
--- /dev/null
+++ b/ui/views/widget/desktop_capture_client.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/widget/desktop_capture_client.h"
+
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+
+namespace views {
+
+DesktopCaptureClient::DesktopCaptureClient() : capture_window_(NULL) {
+}
+
+DesktopCaptureClient::~DesktopCaptureClient() {
+}
+
+void DesktopCaptureClient::SetCapture(aura::Window* window) {
+ if (window) {
+ DCHECK(window->GetRootWindow());
+ if (capture_window_)
+ DCHECK_EQ(window->GetRootWindow(), capture_window_->GetRootWindow());
+ }
+
+ aura::Window* old_capture = capture_window_;
+ capture_window_ = window;
+
+ aura::RootWindow* root_window = window ? window->GetRootWindow() :
+ capture_window_ ? capture_window_->GetRootWindow() : NULL;
+ if (root_window)
+ root_window->UpdateCapture(old_capture, window);
+}
+
+void DesktopCaptureClient::ReleaseCapture(aura::Window* window) {
+ if (capture_window_ != window)
+ return;
+ SetCapture(NULL);
+}
+
+aura::Window* DesktopCaptureClient::GetCaptureWindow() {
+ return capture_window_;
+}
+
+} // namespace views