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

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

Issue 2253293002: Mojo C++ bindings: change the first template parameter of StructTraits and UnionTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@91_extra
Patch Set: rebase Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/common/bluetooth/web_bluetooth_device_id.h" 10 #include "content/common/bluetooth/web_bluetooth_device_id.h"
11 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 11 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 template <> 15 template <>
16 struct StructTraits<blink::mojom::WebBluetoothDeviceId, 16 struct StructTraits<blink::mojom::WebBluetoothDeviceIdDataView,
17 content::WebBluetoothDeviceId> { 17 content::WebBluetoothDeviceId> {
18 static const std::string& device_id( 18 static const std::string& device_id(
19 const content::WebBluetoothDeviceId& device_id) { 19 const content::WebBluetoothDeviceId& device_id) {
20 return device_id.str(); 20 return device_id.str();
21 } 21 }
22 22
23 static bool Read(blink::mojom::WebBluetoothDeviceIdDataView input, 23 static bool Read(blink::mojom::WebBluetoothDeviceIdDataView input,
24 content::WebBluetoothDeviceId* output) { 24 content::WebBluetoothDeviceId* output) {
25 std::string result; 25 std::string result;
26 26
27 if (!input.ReadDeviceId(&result)) 27 if (!input.ReadDeviceId(&result))
28 return false; 28 return false;
29 if (!content::WebBluetoothDeviceId::IsValid(result)) 29 if (!content::WebBluetoothDeviceId::IsValid(result))
30 return false; 30 return false;
31 31
32 *output = content::WebBluetoothDeviceId(std::move(result)); 32 *output = content::WebBluetoothDeviceId(std::move(result));
33 return true; 33 return true;
34 } 34 }
35 }; 35 };
36 36
37 } // namespace mojo 37 } // namespace mojo
38 38
39 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_ 39 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_DEVICE_ID_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698