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/easy_unlock_private/easy_unlock_private_
api.h" | 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64url.h" | 10 #include "base/base64url.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 strings->SetString( | 352 strings->SetString( |
353 "setupErrorFindingPhone", | 353 "setupErrorFindingPhone", |
354 l10n_util::GetStringUTF16(IDS_EASY_UNLOCK_SETUP_ERROR_FINDING_PHONE)); | 354 l10n_util::GetStringUTF16(IDS_EASY_UNLOCK_SETUP_ERROR_FINDING_PHONE)); |
355 strings->SetString("setupErrorSyncPhoneState", | 355 strings->SetString("setupErrorSyncPhoneState", |
356 l10n_util::GetStringUTF16( | 356 l10n_util::GetStringUTF16( |
357 IDS_EASY_UNLOCK_SETUP_ERROR_SYNC_PHONE_STATE_FAILED)); | 357 IDS_EASY_UNLOCK_SETUP_ERROR_SYNC_PHONE_STATE_FAILED)); |
358 strings->SetString("setupErrorConnectingToPhone", | 358 strings->SetString("setupErrorConnectingToPhone", |
359 l10n_util::GetStringUTF16( | 359 l10n_util::GetStringUTF16( |
360 IDS_EASY_UNLOCK_SETUP_ERROR_CONNECTING_TO_PHONE)); | 360 IDS_EASY_UNLOCK_SETUP_ERROR_CONNECTING_TO_PHONE)); |
361 | 361 |
362 SetResult(strings.release()); | 362 SetResult(std::move(strings)); |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 EasyUnlockPrivatePerformECDHKeyAgreementFunction:: | 366 EasyUnlockPrivatePerformECDHKeyAgreementFunction:: |
367 EasyUnlockPrivatePerformECDHKeyAgreementFunction() {} | 367 EasyUnlockPrivatePerformECDHKeyAgreementFunction() {} |
368 | 368 |
369 EasyUnlockPrivatePerformECDHKeyAgreementFunction:: | 369 EasyUnlockPrivatePerformECDHKeyAgreementFunction:: |
370 ~EasyUnlockPrivatePerformECDHKeyAgreementFunction() {} | 370 ~EasyUnlockPrivatePerformECDHKeyAgreementFunction() {} |
371 | 371 |
372 bool EasyUnlockPrivatePerformECDHKeyAgreementFunction::RunAsync() { | 372 bool EasyUnlockPrivatePerformECDHKeyAgreementFunction::RunAsync() { |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 bool EasyUnlockPrivateGetRemoteDevicesFunction::RunAsync() { | 699 bool EasyUnlockPrivateGetRemoteDevicesFunction::RunAsync() { |
700 // Return the remote devices stored with the native CryptAuthDeviceManager if | 700 // Return the remote devices stored with the native CryptAuthDeviceManager if |
701 // we are trying out the BLE experiment. | 701 // we are trying out the BLE experiment. |
702 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 702 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
703 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) { | 703 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) { |
704 ReturnDevicesForExperiment(); | 704 ReturnDevicesForExperiment(); |
705 } else { | 705 } else { |
706 Profile* profile = Profile::FromBrowserContext(browser_context()); | 706 Profile* profile = Profile::FromBrowserContext(browser_context()); |
707 const base::ListValue* devices = | 707 const base::ListValue* devices = |
708 EasyUnlockService::Get(profile)->GetRemoteDevices(); | 708 EasyUnlockService::Get(profile)->GetRemoteDevices(); |
709 SetResult(devices ? devices->DeepCopy() : new base::ListValue()); | 709 SetResult(devices ? devices->CreateDeepCopy() |
| 710 : base::MakeUnique<base::ListValue>()); |
710 SendResponse(true); | 711 SendResponse(true); |
711 } | 712 } |
712 | 713 |
713 return true; | 714 return true; |
714 } | 715 } |
715 | 716 |
716 std::string EasyUnlockPrivateGetRemoteDevicesFunction::GetUserPrivateKey() { | 717 std::string EasyUnlockPrivateGetRemoteDevicesFunction::GetUserPrivateKey() { |
717 Profile* profile = Profile::FromBrowserContext(browser_context()); | 718 Profile* profile = Profile::FromBrowserContext(browser_context()); |
718 proximity_auth::ProximityAuthClient* client = | 719 proximity_auth::ProximityAuthClient* client = |
719 EasyUnlockService::Get(profile)->proximity_auth_client(); | 720 EasyUnlockService::Get(profile)->proximity_auth_client(); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 ->GetDeviceAddress(extension(), params->connection_id); | 1178 ->GetDeviceAddress(extension(), params->connection_id); |
1178 results_ = | 1179 results_ = |
1179 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( | 1180 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( |
1180 device_address); | 1181 device_address); |
1181 if (device_address.empty()) | 1182 if (device_address.empty()) |
1182 SetError("Invalid connectionId."); | 1183 SetError("Invalid connectionId."); |
1183 return true; | 1184 return true; |
1184 } | 1185 } |
1185 | 1186 |
1186 } // namespace extensions | 1187 } // namespace extensions |
OLD | NEW |