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

Unified Diff: components/suggestions/image_encoder.h

Issue 630073002: [Suggestions] Create ImageEncoder, to abstract away image encode/decode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn fix Created 6 years, 2 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: components/suggestions/image_encoder.h
diff --git a/components/suggestions/image_encoder.h b/components/suggestions/image_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..14e511eeda0039fe01d57dfd9160dbab14dc18f5
--- /dev/null
+++ b/components/suggestions/image_encoder.h
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SUGGESTIONS_IMAGE_ENCODER_H_
+#define COMPONENTS_SUGGESTIONS_IMAGE_ENCODER_H_
+
+#include <vector>
+
+#include "base/macros.h"
+
+class SkBitmap;
+
+namespace suggestions {
+
+// A interface to encode/decode images.
+class ImageEncoder {
+ public:
+ ImageEncoder() {}
+ virtual ~ImageEncoder() {}
+
+ // From encoded bytes to SkBitmap. Caller owns the returned pointer.
+ virtual SkBitmap* DecodeImage(
+ const std::vector<unsigned char>& encoded_data) = 0;
+
+ // From SkBitmap to the vector of encoded bytes, |dst|.
+ virtual bool EncodeImage(
+ const SkBitmap& bitmap, std::vector<unsigned char>* dest) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ImageEncoder);
+};
+
+} // namespace suggestions
+
+#endif // COMPONENTS_SUGGESTIONS_IMAGE_ENCODER_H_

Powered by Google App Engine
This is Rietveld 408576698