OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "modules/bluetooth/BluetoothUUID.h" | 5 #include "modules/bluetooth/BluetoothUUID.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptRegexp.h" | 8 #include "bindings/core/v8/ScriptRegexp.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "platform/UUID.h" | 10 #include "platform/UUID.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 String BluetoothUUID::canonicalUUID(unsigned alias) { | 366 String BluetoothUUID::canonicalUUID(unsigned alias) { |
367 StringBuilder builder; | 367 StringBuilder builder; |
368 builder.reserveCapacity(36 /* 36 chars or 128 bits, length of a UUID */); | 368 builder.reserveCapacity(36 /* 36 chars or 128 bits, length of a UUID */); |
369 appendUnsignedAsHexFixedSize( | 369 appendUnsignedAsHexFixedSize( |
370 alias, builder, 8 /* 8 chars or 32 bits, prefix length */, Lowercase); | 370 alias, builder, 8 /* 8 chars or 32 bits, prefix length */, Lowercase); |
371 | 371 |
372 builder.append("-0000-1000-8000-00805f9b34fb"); | 372 builder.append("-0000-1000-8000-00805f9b34fb"); |
373 return builder.toString(); | 373 return builder.toString(); |
374 } | 374 } |
375 | 375 |
| 376 // static |
| 377 bluetooth::mojom::blink::UUIDPtr BluetoothUUID::createMojoUuid( |
| 378 const String& uuid) { |
| 379 bluetooth::mojom::blink::UUIDPtr result; |
| 380 if (!uuid.isEmpty()) { |
| 381 result = bluetooth::mojom::blink::UUID::New(); |
| 382 result->uuid = uuid; |
| 383 } |
| 384 return result; |
| 385 } |
| 386 |
376 } // namespace blink | 387 } // namespace blink |
OLD | NEW |