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

Unified Diff: remoting/host/shaped_desktop_capturer.cc

Issue 455073004: Switch DesktopEnvironment to return a DesktopCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove ShapedDesktopCapturer::Create() Created 6 years, 4 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
« no previous file with comments | « remoting/host/shaped_desktop_capturer.h ('k') | remoting/host/shaped_desktop_capturer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/shaped_desktop_capturer.cc
diff --git a/remoting/host/shaped_desktop_capturer.cc b/remoting/host/shaped_desktop_capturer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9e3f862b867d4215af3e53778e4fffd2b0acf77
--- /dev/null
+++ b/remoting/host/shaped_desktop_capturer.cc
@@ -0,0 +1,42 @@
+// Copyright 2013 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 "remoting/host/shaped_desktop_capturer.h"
+
+#include "base/logging.h"
+#include "remoting/host/desktop_shape_tracker.h"
+#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
+
+namespace remoting {
+
+ShapedDesktopCapturer::ShapedDesktopCapturer(
+ scoped_ptr<webrtc::DesktopCapturer> desktop_capturer,
+ scoped_ptr<DesktopShapeTracker> shape_tracker)
+ : desktop_capturer_(desktop_capturer.Pass()),
+ shape_tracker_(shape_tracker.Pass()),
+ callback_(NULL) {
+}
+
+ShapedDesktopCapturer::~ShapedDesktopCapturer() {}
+
+void ShapedDesktopCapturer::Start(webrtc::DesktopCapturer::Callback* callback) {
+ callback_ = callback;
+ desktop_capturer_->Start(this);
+}
+
+void ShapedDesktopCapturer::Capture(const webrtc::DesktopRegion& region) {
+ desktop_capturer_->Capture(region);
+}
+
+webrtc::SharedMemory* ShapedDesktopCapturer::CreateSharedMemory(size_t size) {
+ return callback_->CreateSharedMemory(size);
+}
+
+void ShapedDesktopCapturer::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
+ shape_tracker_->RefreshDesktopShape();
+ frame->set_shape(new webrtc::DesktopRegion(shape_tracker_->desktop_shape()));
+ callback_->OnCaptureCompleted(frame);
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/shaped_desktop_capturer.h ('k') | remoting/host/shaped_desktop_capturer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698