Index: components/ui_devtools/string_util.cc |
diff --git a/components/ui_devtools/string_util.cc b/components/ui_devtools/string_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..004d8022b9a6a7e58b79d16a9c94c5b7a8824ab6 |
--- /dev/null |
+++ b/components/ui_devtools/string_util.cc |
@@ -0,0 +1,23 @@ |
+// Copyright 2016 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. |
+ |
+#include "components/ui_devtools/string_util.h" |
+ |
+#include "base/strings/string_util.h" |
+#include "components/ui_devtools/Protocol.h" |
+ |
+namespace ui { |
+namespace devtools { |
+namespace protocol { |
+ |
+std::unique_ptr<Value> parseJSON(const String& string) { |
+ DCHECK(base::IsStringUTF8(string)); |
+ // TODO(mhashmi): 16-bit strings need to be handled |
dgozman
2016/10/20 20:45:58
If ui subsystem works with utf8-encoded std::strin
Sarmad Hashmi
2016/10/20 21:49:22
Will look into this, thanks!
|
+ return parseJSON(reinterpret_cast<const uint8_t*>(&string[0]), |
+ string.length()); |
+}; |
+ |
+} // namespace protocol |
+} // namespace ws |
+} // namespace ui |