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 "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" | 5 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_api.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | |
9 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_api_adver
tisement.h" | 16 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_api_adver
tisement.h" |
17 #include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" | 17 #include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" |
18 #include "chrome/common/extensions/api/bluetooth_low_energy.h" | 18 #include "chrome/common/extensions/api/bluetooth_low_energy.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data( | 928 scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data( |
929 new device::BluetoothAdvertisement::Data( | 929 new device::BluetoothAdvertisement::Data( |
930 params->advertisement.type == | 930 params->advertisement.type == |
931 apibtle::AdvertisementType::ADVERTISEMENT_TYPE_BROADCAST | 931 apibtle::AdvertisementType::ADVERTISEMENT_TYPE_BROADCAST |
932 ? device::BluetoothAdvertisement::AdvertisementType:: | 932 ? device::BluetoothAdvertisement::AdvertisementType:: |
933 ADVERTISEMENT_TYPE_BROADCAST | 933 ADVERTISEMENT_TYPE_BROADCAST |
934 : device::BluetoothAdvertisement::AdvertisementType:: | 934 : device::BluetoothAdvertisement::AdvertisementType:: |
935 ADVERTISEMENT_TYPE_PERIPHERAL)); | 935 ADVERTISEMENT_TYPE_PERIPHERAL)); |
936 | 936 |
937 advertisement_data->set_service_uuids( | 937 advertisement_data->set_service_uuids( |
938 params->advertisement.service_uuids.Pass()); | 938 std::move(params->advertisement.service_uuids)); |
939 advertisement_data->set_solicit_uuids( | 939 advertisement_data->set_solicit_uuids( |
940 params->advertisement.solicit_uuids.Pass()); | 940 std::move(params->advertisement.solicit_uuids)); |
941 if (params->advertisement.manufacturer_data) { | 941 if (params->advertisement.manufacturer_data) { |
942 advertisement_data->set_manufacturer_data( | 942 advertisement_data->set_manufacturer_data( |
943 CreateManufacturerData(params->advertisement.manufacturer_data.get()) | 943 CreateManufacturerData(params->advertisement.manufacturer_data.get())); |
944 .Pass()); | |
945 } | 944 } |
946 if (params->advertisement.service_data) { | 945 if (params->advertisement.service_data) { |
947 advertisement_data->set_service_data( | 946 advertisement_data->set_service_data( |
948 CreateServiceData(params->advertisement.service_data.get()).Pass()); | 947 CreateServiceData(params->advertisement.service_data.get())); |
949 } | 948 } |
950 | 949 |
951 event_router->adapter()->RegisterAdvertisement( | 950 event_router->adapter()->RegisterAdvertisement( |
952 advertisement_data.Pass(), | 951 std::move(advertisement_data), |
953 base::Bind( | 952 base::Bind( |
954 &BluetoothLowEnergyRegisterAdvertisementFunction::SuccessCallback, | 953 &BluetoothLowEnergyRegisterAdvertisementFunction::SuccessCallback, |
955 this), | 954 this), |
956 base::Bind( | 955 base::Bind( |
957 &BluetoothLowEnergyRegisterAdvertisementFunction::ErrorCallback, | 956 &BluetoothLowEnergyRegisterAdvertisementFunction::ErrorCallback, |
958 this)); | 957 this)); |
959 | 958 |
960 return true; | 959 return true; |
961 } | 960 } |
962 | 961 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 SetError(kStatusAdvertisementDoesNotExist); | 1051 SetError(kStatusAdvertisementDoesNotExist); |
1053 break; | 1052 break; |
1054 default: | 1053 default: |
1055 SetError(kErrorOperationFailed); | 1054 SetError(kErrorOperationFailed); |
1056 } | 1055 } |
1057 SendResponse(false); | 1056 SendResponse(false); |
1058 } | 1057 } |
1059 | 1058 |
1060 } // namespace api | 1059 } // namespace api |
1061 } // namespace extensions | 1060 } // namespace extensions |
OLD | NEW |