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

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: Switch back to embedding with files downloading via gclient sync 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 d55e50f44c27b769ffcfa2d01f61c4f0c6f8107c..3ab5613a56f035f67c0a094f176810b60716212b 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"
@@ -80,6 +83,21 @@ class KeyLayout {
DISALLOW_COPY_AND_ASSIGN(TextKey);
};
+ // An implementation of Key that draws itself as an image.
+ class ImageKey : public TextKey {
jamesr 2015/05/27 23:30:31 why does this inherit from TextKey? inheriting fro
APW 2015/05/28 17:54:25 Done.
+ 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