| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/bluetooth/bluetooth_low_energy_win.h" | 5 #include "device/bluetooth/bluetooth_low_energy_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 CHECK_GE(character_size, 1u); | 588 CHECK_GE(character_size, 1u); |
| 589 WCHAR* value_string = reinterpret_cast<WCHAR*>(value.get()); | 589 WCHAR* value_string = reinterpret_cast<WCHAR*>(value.get()); |
| 590 value_string[character_size - 1] = 0; | 590 value_string[character_size - 1] = 0; |
| 591 break; | 591 break; |
| 592 } | 592 } |
| 593 case REG_DWORD: { | 593 case REG_DWORD: { |
| 594 CHECK_EQ(value_size, sizeof(DWORD)); | 594 CHECK_EQ(value_size, sizeof(DWORD)); |
| 595 break; | 595 break; |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 return base::WrapUnique(new DeviceRegistryPropertyValue( | 598 return base::WrapUnique( |
| 599 property_type, std::move(value), value_size)); | 599 new DeviceRegistryPropertyValue(property_type, std::move(value))); |
| 600 } | 600 } |
| 601 | 601 |
| 602 DeviceRegistryPropertyValue::DeviceRegistryPropertyValue( | 602 DeviceRegistryPropertyValue::DeviceRegistryPropertyValue( |
| 603 DWORD property_type, | 603 DWORD property_type, |
| 604 std::unique_ptr<uint8_t[]> value, | 604 std::unique_ptr<uint8_t[]> value) |
| 605 size_t value_size) | 605 : property_type_(property_type), value_(std::move(value)) {} |
| 606 : property_type_(property_type), | |
| 607 value_(std::move(value)), | |
| 608 value_size_(value_size) {} | |
| 609 | 606 |
| 610 DeviceRegistryPropertyValue::~DeviceRegistryPropertyValue() { | 607 DeviceRegistryPropertyValue::~DeviceRegistryPropertyValue() { |
| 611 } | 608 } |
| 612 | 609 |
| 613 std::string DeviceRegistryPropertyValue::AsString() const { | 610 std::string DeviceRegistryPropertyValue::AsString() const { |
| 614 CHECK_EQ(property_type_, static_cast<DWORD>(REG_SZ)); | 611 CHECK_EQ(property_type_, static_cast<DWORD>(REG_SZ)); |
| 615 WCHAR* value_string = reinterpret_cast<WCHAR*>(value_.get()); | 612 WCHAR* value_string = reinterpret_cast<WCHAR*>(value_.get()); |
| 616 return base::SysWideToUTF8(value_string); | 613 return base::SysWideToUTF8(value_string); |
| 617 } | 614 } |
| 618 | 615 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | | 863 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | |
| 867 base::File::FLAG_WRITE); | 864 base::File::FLAG_WRITE); |
| 868 if (!file.IsValid()) | 865 if (!file.IsValid()) |
| 869 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); | 866 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); |
| 870 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor, | 867 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor, |
| 871 new_value, BLUETOOTH_GATT_FLAG_NONE); | 868 new_value, BLUETOOTH_GATT_FLAG_NONE); |
| 872 } | 869 } |
| 873 | 870 |
| 874 } // namespace win | 871 } // namespace win |
| 875 } // namespace device | 872 } // namespace device |
| OLD | NEW |