Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothUUIDTraits.h |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothUUIDTraits.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothUUIDTraits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c670ebfbb1f2925dc967788c259b9fdc33de9563 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothUUIDTraits.h |
| @@ -0,0 +1,29 @@ |
| +// 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. |
| + |
| +#ifndef BluetoothUUIDTraits_h |
| +#define BluetoothUUIDTraits_h |
| + |
| +#include "device/bluetooth/public/interfaces/uuid.mojom-blink.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct StructTraits<bluetooth::mojom::blink::UUID::DataView, WTF::String> { |
| + static const WTF::String& uuid(const WTF::String& input) { return input; } |
| + |
| + static bool Read(bluetooth::mojom::blink::UUID::DataView data, |
| + WTF::String* output) { |
| + StringDataView view; |
| + data.GetUuidDataView(&view); |
| + *output = WTF::String(reinterpret_cast<const UChar*>(view.storage()), |
|
dcheng
2016/12/29 08:58:06
Can this just be:
return data.ReadUuid(output);
juncai
2016/12/29 22:22:59
Done.
|
| + view.size()); |
| + return true; |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // BluetoothUUIDTraits_h |