Index: mojo/services/view_manager/view_manager_connection.cc |
diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc |
index 37e5f059fa375bb531e60851cc9f593651b047a1..b11badd4162ddb0ac55d74ed41cf510c33aea744 100644 |
--- a/mojo/services/view_manager/view_manager_connection.cc |
+++ b/mojo/services/view_manager/view_manager_connection.cc |
@@ -9,6 +9,8 @@ |
#include "mojo/services/view_manager/node.h" |
#include "mojo/services/view_manager/root_node_manager.h" |
#include "mojo/services/view_manager/view.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/gfx/codec/png_codec.h" |
namespace mojo { |
namespace services { |
@@ -271,6 +273,25 @@ void ViewManagerConnection::SetView( |
change_id)); |
} |
+void ViewManagerConnection::SetViewContents( |
+ TransportViewId view_id, |
+ ScopedSharedBufferHandle buffer, |
+ uint32_t buffer_size) { |
+ View* view = GetView(ViewIdFromTransportId(view_id)); |
+ if (!view) |
+ return; |
+ void* handle_data; |
+ if (MapBuffer(buffer.get(), 0, buffer_size, &handle_data, |
+ MOJO_MAP_BUFFER_FLAG_NONE) != MOJO_RESULT_OK) { |
+ return; |
+ } |
+ SkBitmap bitmap; |
+ gfx::PNGCodec::Decode(static_cast<const unsigned char*>(handle_data), |
+ buffer_size, &bitmap); |
+ view->SetBitmap(bitmap); |
+ UnmapBuffer(handle_data); |
+} |
+ |
void ViewManagerConnection::OnNodeHierarchyChanged(const NodeId& node, |
const NodeId& new_parent, |
const NodeId& old_parent) { |