diff options
author | rockot <rockot@chromium.org> | 2014-09-16 14:55:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-16 21:55:28 +0000 |
commit | ae48dc2800a7f37030952ddfee957513da558ab9 (patch) | |
tree | 9b53ea0efffd6d1f1504052bbd82ba4d0cd25f2d /mojo/common | |
parent | c3c0d91ae658c660f01705cd691b783e7f10d3f4 (diff) | |
download | chromium_src-ae48dc2800a7f37030952ddfee957513da558ab9.zip chromium_src-ae48dc2800a7f37030952ddfee957513da558ab9.tar.gz chromium_src-ae48dc2800a7f37030952ddfee957513da558ab9.tar.bz2 |
Revert of mojo: Create a basic clipboard. (patchset #29 id:540001 of https://codereview.chromium.org/562483002/)
Reason for revert:
Breaking GN builders.
http://build.chromium.org/p/chromium.linux/buildstatus?builder=Android%20GN&number=10604
http://build.chromium.org/p/chromium.linux/builders/Linux%20GN/builds/12120/steps/gn/logs/stdio
Original issue's description:
> mojo: Create a basic clipboard.
>
> This creates a basic clipboard interface and uses it from
> html_viewer. This is a minimal implementation and does not actually
> interact with the system clipboard.
>
> BUG=411039
>
> Committed: https://crrev.com/757286d8a2c778fe4622890140c9b9d2afd21063
> Cr-Commit-Position: refs/heads/master@{#295143}
TBR=dcheng@chromium.org,darin@chromium.org,sky@chromium.org,erg@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=411039
Review URL: https://codereview.chromium.org/579503003
Cr-Commit-Position: refs/heads/master@{#295152}
Diffstat (limited to 'mojo/common')
-rw-r--r-- | mojo/common/common_type_converters.cc | 16 | ||||
-rw-r--r-- | mojo/common/common_type_converters.h | 15 | ||||
-rw-r--r-- | mojo/common/common_type_converters_unittest.cc | 21 |
3 files changed, 0 insertions, 52 deletions
diff --git a/mojo/common/common_type_converters.cc b/mojo/common/common_type_converters.cc index 114b409..ffc1907 100644 --- a/mojo/common/common_type_converters.cc +++ b/mojo/common/common_type_converters.cc @@ -46,20 +46,4 @@ GURL TypeConverter<GURL, String>::Convert(const String& input) { return GURL(input.get()); } -std::string TypeConverter<std::string, Array<uint8_t> >::Convert( - const Array<uint8_t>& input) { - if (input.is_null()) - return std::string(); - - return std::string(reinterpret_cast<const char*>(&input.front()), - input.size()); -} - -Array<uint8_t> TypeConverter<Array<uint8_t>, std::string>::Convert( - const std::string& input) { - Array<uint8_t> result(input.size()); - memcpy(&result.front(), input.c_str(), input.size()); - return result.Pass(); -} - } // namespace mojo diff --git a/mojo/common/common_type_converters.h b/mojo/common/common_type_converters.h index 7b0260a..159325e 100644 --- a/mojo/common/common_type_converters.h +++ b/mojo/common/common_type_converters.h @@ -8,7 +8,6 @@ #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" @@ -46,20 +45,6 @@ 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_ diff --git a/mojo/common/common_type_converters_unittest.cc b/mojo/common/common_type_converters_unittest.cc index f97be0a..314f180 100644 --- a/mojo/common/common_type_converters_unittest.cc +++ b/mojo/common/common_type_converters_unittest.cc @@ -84,27 +84,6 @@ TEST(CommonTypeConvertersTest, URL) { ASSERT_EQ(0U, string_from_invalid.size()); } -TEST(CommonTypeConvertersTest, ArrayUint8ToStdString) { - Array<uint8_t> data(4); - data[0] = 'd'; - data[1] = 'a'; - data[2] = 't'; - data[3] = 'a'; - - EXPECT_EQ("data", data.To<std::string>()); -} - -TEST(CommonTypeConvertersTest, StdStringToArrayUint8) { - std::string input("data"); - Array<uint8_t> data = Array<uint8_t>::From(input); - - ASSERT_EQ(4ul, data.size()); - EXPECT_EQ('d', data[0]); - EXPECT_EQ('a', data[1]); - EXPECT_EQ('t', data[2]); - EXPECT_EQ('a', data[3]); -} - } // namespace test } // namespace common } // namespace mojo |