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

Side by Side Diff: content/common/bluetooth/bluetooth_device_id_struct_traits.h

Issue 2019853002: bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Address jyasskin's comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
6 #define CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "base/strings/string_piece.h"
11 #include "content/common/bluetooth/bluetooth_device_id.h"
12 #include "content/common/bluetooth/bluetooth_device_id.mojom.h"
13
14 namespace mojo {
15
16 template <>
17 struct StructTraits<content::mojom::BluetoothDeviceId,
18 content::BluetoothDeviceId> {
19 static const std::string& device_id(
20 const content::BluetoothDeviceId& device_id) {
21 return device_id.str();
22 }
23
24 static bool Read(content::mojom::BluetoothDeviceIdDataView input,
25 content::BluetoothDeviceId* output) {
26 std::string result;
27
28 if (!input.ReadDeviceId(&result))
29 return false;
30 if (!content::BluetoothDeviceId::IsValid(result))
31 return false;
32
33 *output = content::BluetoothDeviceId(std::move(result));
34 return true;
35 }
36 };
37
38 } // namespace mojo
39
40 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698