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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" | 26 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
27 #include "chrome/browser/signin/easy_unlock_service.h" | 27 #include "chrome/browser/signin/easy_unlock_service.h" |
28 #include "chrome/browser/signin/easy_unlock_service_regular.h" | 28 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
29 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h" | 29 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h" |
30 #include "chrome/common/extensions/api/easy_unlock_private.h" | 30 #include "chrome/common/extensions/api/easy_unlock_private.h" |
31 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
32 #include "components/cryptauth/cryptauth_device_manager.h" | 32 #include "components/cryptauth/cryptauth_device_manager.h" |
33 #include "components/cryptauth/cryptauth_enrollment_manager.h" | 33 #include "components/cryptauth/cryptauth_enrollment_manager.h" |
34 #include "components/cryptauth/cryptauth_enrollment_utils.h" | 34 #include "components/cryptauth/cryptauth_enrollment_utils.h" |
35 #include "components/cryptauth/proto/cryptauth_api.pb.h" | 35 #include "components/cryptauth/proto/cryptauth_api.pb.h" |
| 36 #include "components/cryptauth/remote_device.h" |
36 #include "components/cryptauth/secure_message_delegate.h" | 37 #include "components/cryptauth/secure_message_delegate.h" |
37 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" | 38 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" |
38 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" | 39 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" |
39 #include "components/proximity_auth/bluetooth_throttler_impl.h" | 40 #include "components/proximity_auth/bluetooth_throttler_impl.h" |
40 #include "components/proximity_auth/bluetooth_util.h" | 41 #include "components/proximity_auth/bluetooth_util.h" |
41 #include "components/proximity_auth/logging/logging.h" | 42 #include "components/proximity_auth/logging/logging.h" |
42 #include "components/proximity_auth/proximity_auth_client.h" | 43 #include "components/proximity_auth/proximity_auth_client.h" |
43 #include "components/proximity_auth/remote_device.h" | |
44 #include "components/proximity_auth/screenlock_bridge.h" | 44 #include "components/proximity_auth/screenlock_bridge.h" |
45 #include "components/proximity_auth/screenlock_state.h" | 45 #include "components/proximity_auth/screenlock_state.h" |
46 #include "components/proximity_auth/switches.h" | 46 #include "components/proximity_auth/switches.h" |
47 #include "components/signin/core/account_id/account_id.h" | 47 #include "components/signin/core/account_id/account_id.h" |
48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
50 #include "extensions/browser/browser_context_keyed_api_factory.h" | 50 #include "extensions/browser/browser_context_keyed_api_factory.h" |
51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
52 #include "ui/gfx/geometry/rect.h" | 52 #include "ui/gfx/geometry/rect.h" |
53 #include "ui/gfx/range/range.h" | 53 #include "ui/gfx/range/range.h" |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1083 |
1084 bool EasyUnlockPrivateFindSetupConnectionFunction::RunAsync() { | 1084 bool EasyUnlockPrivateFindSetupConnectionFunction::RunAsync() { |
1085 std::unique_ptr<easy_unlock_private::FindSetupConnection::Params> params = | 1085 std::unique_ptr<easy_unlock_private::FindSetupConnection::Params> params = |
1086 easy_unlock_private::FindSetupConnection::Params::Create(*args_); | 1086 easy_unlock_private::FindSetupConnection::Params::Create(*args_); |
1087 EXTENSION_FUNCTION_VALIDATE(params); | 1087 EXTENSION_FUNCTION_VALIDATE(params); |
1088 | 1088 |
1089 // Creates a BLE connection finder to look for any device advertising | 1089 // Creates a BLE connection finder to look for any device advertising |
1090 // |params->setup_service_uuid|. | 1090 // |params->setup_service_uuid|. |
1091 connection_finder_.reset( | 1091 connection_finder_.reset( |
1092 new proximity_auth::BluetoothLowEnergyConnectionFinder( | 1092 new proximity_auth::BluetoothLowEnergyConnectionFinder( |
1093 proximity_auth::RemoteDevice(), params->setup_service_uuid, | 1093 cryptauth::RemoteDevice(), params->setup_service_uuid, |
1094 proximity_auth::BluetoothLowEnergyConnectionFinder::FIND_ANY_DEVICE, | 1094 proximity_auth::BluetoothLowEnergyConnectionFinder::FIND_ANY_DEVICE, |
1095 nullptr, bluetooth_throttler_.get(), 3)); | 1095 nullptr, bluetooth_throttler_.get(), 3)); |
1096 | 1096 |
1097 connection_finder_->Find(base::Bind( | 1097 connection_finder_->Find(base::Bind( |
1098 &EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound, this)); | 1098 &EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound, this)); |
1099 | 1099 |
1100 timer_.reset(new base::OneShotTimer()); | 1100 timer_.reset(new base::OneShotTimer()); |
1101 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(params->time_out), | 1101 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(params->time_out), |
1102 base::Bind(&EasyUnlockPrivateFindSetupConnectionFunction:: | 1102 base::Bind(&EasyUnlockPrivateFindSetupConnectionFunction:: |
1103 OnConnectionFinderTimedOut, | 1103 OnConnectionFinderTimedOut, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 GetConnectionManager(browser_context()) | 1181 GetConnectionManager(browser_context()) |
1182 ->GetDeviceAddress(extension(), params->connection_id); | 1182 ->GetDeviceAddress(extension(), params->connection_id); |
1183 if (device_address.empty()) | 1183 if (device_address.empty()) |
1184 return RespondNow(Error("Invalid connectionId.")); | 1184 return RespondNow(Error("Invalid connectionId.")); |
1185 return RespondNow(ArgumentList( | 1185 return RespondNow(ArgumentList( |
1186 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( | 1186 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( |
1187 device_address))); | 1187 device_address))); |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace extensions | 1190 } // namespace extensions |
OLD | NEW |