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

Unified Diff: services/keyboard_native/key_layout.h

Issue 1149293002: Add the ability for keys to be drawn as an image. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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: services/keyboard_native/key_layout.h
diff --git a/services/keyboard_native/key_layout.h b/services/keyboard_native/key_layout.h
index cf579e7c191116137de016937a0be5916858ce6a..293ce9785ef604301cb4f6c983f7e3344db7b3f2 100644
--- a/services/keyboard_native/key_layout.h
+++ b/services/keyboard_native/key_layout.h
@@ -12,7 +12,10 @@
#include "base/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/callback.h"
#include "mojo/services/geometry/public/interfaces/geometry.mojom.h"
+#include "mojo/tools/embed/data.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkImageDecoder.h"
+#include "third_party/skia/include/core/SkStream.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
@@ -77,6 +80,21 @@ class KeyLayout {
DISALLOW_COPY_AND_ASSIGN(TextKey);
};
+ // An implementation of Key that draws itself as an image.
+ class ImageKey : public TextKey {
+ public:
+ ImageKey(const char* text,
+ base::Callback<void(const TextKey&)> touch_up_callback,
+ const mojo::embed::Data& data);
+ ~ImageKey() override;
+ void Draw(SkCanvas* canvas, SkPaint paint, const gfx::RectF& rect) override;
+
+ private:
+ SkBitmap bitmap_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImageKey);
+ };
+
// initializes the *_layout_ vectors.
void InitLayouts();

Powered by Google App Engine
This is Rietveld 408576698