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

Unified Diff: remoting/host/chromoting_param_traits.cc

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/chromoting_param_traits.h ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_param_traits.cc
diff --git a/remoting/host/chromoting_param_traits.cc b/remoting/host/chromoting_param_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d1c794c8c87b13c62aa01f336775287882a9ea12
--- /dev/null
+++ b/remoting/host/chromoting_param_traits.cc
@@ -0,0 +1,127 @@
+// 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/chromoting_param_traits.h"
+
+#include "base/stringprintf.h"
+
+namespace IPC {
+
+// static
+void ParamTraits<webrtc::DesktopVector>::Write(Message* m,
+ const webrtc::DesktopVector& p) {
+ m->WriteInt(p.x());
+ m->WriteInt(p.y());
+}
+
+// static
+bool ParamTraits<webrtc::DesktopVector>::Read(const Message* m,
+ PickleIterator* iter,
+ webrtc::DesktopVector* r) {
+ int x, y;
+ if (!m->ReadInt(iter, &x) || !m->ReadInt(iter, &y))
+ return false;
+ *r = webrtc::DesktopVector(x, y);
+ return true;
+}
+
+// static
+void ParamTraits<webrtc::DesktopVector>::Log(const webrtc::DesktopVector& p,
+ std::string* l) {
+ l->append(base::StringPrintf("webrtc::DesktopVector(%d, %d)",
+ p.x(), p.y()));
+}
+
+// static
+void ParamTraits<webrtc::DesktopSize>::Write(Message* m,
+ const webrtc::DesktopSize& p) {
+ m->WriteInt(p.width());
+ m->WriteInt(p.height());
+}
+
+// static
+bool ParamTraits<webrtc::DesktopSize>::Read(const Message* m,
+ PickleIterator* iter,
+ webrtc::DesktopSize* r) {
+ int width, height;
+ if (!m->ReadInt(iter, &width) || !m->ReadInt(iter, &height))
+ return false;
+ *r = webrtc::DesktopSize(width, height);
+ return true;
+}
+
+// static
+void ParamTraits<webrtc::DesktopSize>::Log(const webrtc::DesktopSize& p,
+ std::string* l) {
+ l->append(base::StringPrintf("webrtc::DesktopSize(%d, %d)",
+ p.width(), p.height()));
+}
+
+// static
+void ParamTraits<webrtc::DesktopRect>::Write(Message* m,
+ const webrtc::DesktopRect& p) {
+ m->WriteInt(p.left());
+ m->WriteInt(p.top());
+ m->WriteInt(p.right());
+ m->WriteInt(p.bottom());
+}
+
+// static
+bool ParamTraits<webrtc::DesktopRect>::Read(const Message* m,
+ PickleIterator* iter,
+ webrtc::DesktopRect* r) {
+ int left, right, top, bottom;
+ if (!m->ReadInt(iter, &left) || !m->ReadInt(iter, &top) ||
+ !m->ReadInt(iter, &right) || !m->ReadInt(iter, &bottom)) {
+ return false;
+ }
+ *r = webrtc::DesktopRect::MakeLTRB(left, top, right, bottom);
+ return true;
+}
+
+// static
+void ParamTraits<webrtc::DesktopRect>::Log(const webrtc::DesktopRect& p,
+ std::string* l) {
+ l->append(base::StringPrintf("webrtc::DesktopRect(%d, %d, %d, %d)",
+ p.left(), p.top(), p.right(), p.bottom()));
+}
+
+// static
+void ParamTraits<remoting::ScreenResolution>::Write(
+ Message* m,
+ const remoting::ScreenResolution& p) {
+ ParamTraits<webrtc::DesktopSize>::Write(m, p.dimensions());
+ ParamTraits<webrtc::DesktopVector>::Write(m, p.dpi());
+}
+
+// static
+bool ParamTraits<remoting::ScreenResolution>::Read(
+ const Message* m,
+ PickleIterator* iter,
+ remoting::ScreenResolution* r) {
+ webrtc::DesktopSize size;
+ webrtc::DesktopVector dpi;
+ if (!ParamTraits<webrtc::DesktopSize>::Read(m, iter, &size) ||
+ !ParamTraits<webrtc::DesktopVector>::Read(m, iter, &dpi)) {
+ return false;
+ }
+ if (size.width() < 0 || size.height() < 0 ||
+ dpi.x() < 0 || dpi.y() < 0) {
+ return false;
+ }
+ *r = remoting::ScreenResolution(size, dpi);
+ return true;
+}
+
+// static
+void ParamTraits<remoting::ScreenResolution>::Log(
+ const remoting::ScreenResolution& p,
+ std::string* l) {
+ l->append(base::StringPrintf("webrtc::ScreenResolution(%d, %d, %d, %d)",
+ p.dimensions().width(), p.dimensions().height(),
+ p.dpi().x(), p.dpi().y()));
+}
+
+} // namespace IPC
+
« no previous file with comments | « remoting/host/chromoting_param_traits.h ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698