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

Side by Side Diff: content/common/bluetooth/web_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: Rebase Created 4 years, 4 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_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "content/common/bluetooth/web_bluetooth_device_id.h"
11 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
12
13 namespace mojo {
14
15 template <>
16 struct StructTraits<blink::mojom::WebBluetoothDeviceId,
17 content::WebBluetoothDeviceId> {
18 static const std::string& device_id(
19 const content::WebBluetoothDeviceId& device_id) {
20 return device_id.str();
21 }
22
23 static bool Read(blink::mojom::WebBluetoothDeviceIdDataView input,
24 content::WebBluetoothDeviceId* output) {
25 std::string result;
26
27 if (!input.ReadDeviceId(&result))
28 return false;
29 if (!content::WebBluetoothDeviceId::IsValid(result))
30 return false;
31
32 *output = content::WebBluetoothDeviceId(std::move(result));
33 return true;
34 }
35 };
36
37 } // namespace mojo
38
39 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « content/common/bluetooth/web_bluetooth_device_id.typemap ('k') | content/common/bluetooth/web_bluetooth_device_id_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698