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

Unified Diff: mojo/services/public/cpp/view_manager/lib/view.cc

Issue 303163005: Embedding demo in View manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
Index: mojo/services/public/cpp/view_manager/lib/view.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/view.cc b/mojo/services/public/cpp/view_manager/lib/view.cc
index b11929c6b81b246f219c07876f279f5692ae33a5..be4397ba4740ff77534db358048c213143dfcada 100644
--- a/mojo/services/public/cpp/view_manager/lib/view.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view.cc
@@ -7,6 +7,7 @@
#include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h"
#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
+#include "ui/gfx/canvas.h"
namespace mojo {
namespace view_manager {
@@ -61,6 +62,12 @@ void View::SetContents(const SkBitmap& contents) {
ViewManagerPrivate(manager_).synchronizer()->SetViewContents(id_, contents);
}
+void View::SetColor(SkColor color) {
+ gfx::Canvas canvas(node_->bounds().size(), 1.0f, true);
+ canvas.DrawColor(color);
+ SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true));
+}
+
View::View(ViewManager* manager)
: id_(ViewManagerPrivate(manager).synchronizer()->CreateView()),
node_(NULL),
« no previous file with comments | « mojo/services/public/cpp/view_manager/DEPS ('k') | mojo/services/public/cpp/view_manager/lib/view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698