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

Unified Diff: mojo/common/common_type_converters.h

Issue 562483002: mojo: Create a basic clipboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to the gn files. Created 6 years, 3 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/BUILD.gn ('k') | mojo/common/common_type_converters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/common_type_converters.h
diff --git a/mojo/common/common_type_converters.h b/mojo/common/common_type_converters.h
index 159325e025fc7dacd2baac066f3a56bd2e989a3b..7b0260adaf6dae491d3f6e4a79a02ea6073b0177 100644
--- a/mojo/common/common_type_converters.h
+++ b/mojo/common/common_type_converters.h
@@ -8,6 +8,7 @@
#include "base/strings/string16.h"
#include "base/strings/string_piece.h"
#include "mojo/common/mojo_common_export.h"
+#include "mojo/public/cpp/bindings/array.h"
#include "mojo/public/cpp/bindings/string.h"
#include "mojo/public/cpp/bindings/type_converter.h"
@@ -45,6 +46,20 @@ struct MOJO_COMMON_EXPORT TypeConverter<GURL, String> {
static GURL Convert(const String& input);
};
+// TODO(erg): In the very long term, we will want to remove conversion between
+// std::strings and arrays of unsigned bytes. However, there is too much code
+// across chrome which uses std::string as a bag of bytes that we probably
+// don't want to roll this function at each callsite.
+template <>
+struct MOJO_COMMON_EXPORT TypeConverter<std::string, Array<uint8_t> > {
+ static std::string Convert(const Array<uint8_t>& input);
+};
+
+template <>
+struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, std::string> {
+ static Array<uint8_t> Convert(const std::string& input);
+};
+
} // namespace mojo
#endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_
« no previous file with comments | « mojo/BUILD.gn ('k') | mojo/common/common_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698