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

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

Issue 267293004: Wires up view manager to an actual display (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/view_manager_connection.h ('k') | mojo/shell/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « mojo/services/view_manager/view_manager_connection.h ('k') | mojo/shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698