Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / mojo / common / common_type_converters.h
bloba45f00b3ca45323ca94d58dff9322097714dd07c
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_
6 #define MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_
8 #include "base/strings/string16.h"
9 #include "base/strings/string_piece.h"
10 #include "mojo/common/mojo_common_export.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
15 namespace mojo {
17 template <>
18 struct MOJO_COMMON_EXPORT TypeConverter<String, base::StringPiece> {
19 static String Convert(const base::StringPiece& input);
22 template <>
23 struct MOJO_COMMON_EXPORT TypeConverter<base::StringPiece, String> {
24 static base::StringPiece Convert(const String& input);
27 template <>
28 struct MOJO_COMMON_EXPORT TypeConverter<String, base::string16> {
29 static String Convert(const base::string16& input);
32 template <>
33 struct MOJO_COMMON_EXPORT TypeConverter<base::string16, String> {
34 static base::string16 Convert(const String& input);
37 // TODO(erg): In the very long term, we will want to remove conversion between
38 // std::strings and arrays of unsigned bytes. However, there is too much code
39 // across chrome which uses std::string as a bag of bytes that we probably
40 // don't want to roll this function at each callsite.
41 template <>
42 struct MOJO_COMMON_EXPORT TypeConverter<std::string, Array<uint8_t> > {
43 static std::string Convert(const Array<uint8_t>& input);
46 template <>
47 struct MOJO_COMMON_EXPORT TypeConverter<Array<uint8_t>, std::string> {
48 static Array<uint8_t> Convert(const std::string& input);
51 } // namespace mojo
53 #endif // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_