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

Unified Diff: mojo/services/view_manager/type_converters.cc

Issue 288313002: Tweaks to ViewManager: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 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 | « mojo/services/view_manager/type_converters.h ('k') | mojo/services/view_manager/view_manager_connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/type_converters.cc
diff --git a/mojo/services/view_manager/type_converters.cc b/mojo/services/view_manager/type_converters.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9a9b4a749e22fee425b128a4e1a7b81960eefc85
--- /dev/null
+++ b/mojo/services/view_manager/type_converters.cc
@@ -0,0 +1,34 @@
+// Copyright 2014 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 "mojo/services/view_manager/type_converters.h"
+
+#include "mojo/public/cpp/bindings/buffer.h"
+#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
+#include "mojo/services/view_manager/ids.h"
+#include "mojo/services/view_manager/node.h"
+#include "mojo/services/view_manager/view.h"
+
+using mojo::view_manager::INode;
+using mojo::view_manager::service::Node;
+using mojo::view_manager::service::NodeId;
+using mojo::view_manager::service::ViewId;
+
+namespace mojo {
+
+// static
+INode TypeConverter<INode, Node*>::ConvertFrom(const Node* node,
+ Buffer* buf) {
+ DCHECK(node);
+
+ INode::Builder builder(buf);
+ const Node* parent = node->GetParent();
+ builder.set_parent_id(NodeIdToTransportId(parent ? parent->id() : NodeId()));
+ builder.set_node_id(NodeIdToTransportId(node->id()));
+ builder.set_view_id(ViewIdToTransportId(
+ node->view() ? node->view()->id() : ViewId()));
+ return builder.Finish();
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/type_converters.h ('k') | mojo/services/view_manager/view_manager_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698