Commit cfbaa984 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

extensions/EasyUnlockPrivateApi: Remove so much dead code.

These methods are now unused after removing the Bluetooth Classic
implementation of EasyUnlock.

R=khorimoto@chromium.org

Bug: none
Test: none
Change-Id: I5a2a30c7dbd83bc51441f7525030ea94526df32b
Reviewed-on: https://chromium-review.googlesource.com/1000728Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549263}
parent 3e446577
...@@ -41,9 +41,6 @@ class EasyUnlockAppManagerImpl : public EasyUnlockAppManager { ...@@ -41,9 +41,6 @@ class EasyUnlockAppManagerImpl : public EasyUnlockAppManager {
void LoadApp() override; void LoadApp() override;
void DisableAppIfLoaded() override; void DisableAppIfLoaded() override;
void ReloadApp() override; void ReloadApp() override;
bool SendUserUpdatedEvent(const std::string& user_id,
bool is_logged_in,
bool data_ready) override;
bool SendAuthAttemptEvent() override; bool SendAuthAttemptEvent() override;
private: private:
...@@ -138,41 +135,6 @@ void EasyUnlockAppManagerImpl::ReloadApp() { ...@@ -138,41 +135,6 @@ void EasyUnlockAppManagerImpl::ReloadApp() {
extension_service->ReloadExtension(app_id_); extension_service->ReloadExtension(app_id_);
} }
bool EasyUnlockAppManagerImpl::SendUserUpdatedEvent(const std::string& user_id,
bool is_logged_in,
bool data_ready) {
ExtensionService* extension_service = extension_system_->extension_service();
if (!extension_service)
return false;
extensions::EventRouter* event_router =
extensions::EventRouter::Get(extension_service->GetBrowserContext());
if (!event_router)
return false;
extensions::events::HistogramValue histogram_value =
extensions::events::EASY_UNLOCK_PRIVATE_ON_USER_INFO_UPDATED;
std::string event_name =
extensions::api::easy_unlock_private::OnUserInfoUpdated::kEventName;
if (!event_router->ExtensionHasEventListener(app_id_, event_name))
return false;
extensions::api::easy_unlock_private::UserInfo info;
info.user_id = user_id;
info.logged_in = is_logged_in;
info.data_ready = data_ready;
std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(info.ToValue());
std::unique_ptr<extensions::Event> event(
new extensions::Event(histogram_value, event_name, std::move(args)));
event_router->DispatchEventToExtension(app_id_, std::move(event));
return true;
}
bool EasyUnlockAppManagerImpl::SendAuthAttemptEvent() { bool EasyUnlockAppManagerImpl::SendAuthAttemptEvent() {
ExtensionService* extension_service = extension_system_->extension_service(); ExtensionService* extension_service = extension_system_->extension_service();
if (!extension_service) if (!extension_service)
......
...@@ -48,11 +48,6 @@ class EasyUnlockAppManager { ...@@ -48,11 +48,6 @@ class EasyUnlockAppManager {
// Reloads Easy Unlock app. // Reloads Easy Unlock app.
virtual void ReloadApp() = 0; virtual void ReloadApp() = 0;
// Sends easyUnlockPrivate.onUserInfoUpdate event to Easy Unlock app.
virtual bool SendUserUpdatedEvent(const std::string& user_id,
bool is_logged_in,
bool data_ready) = 0;
// Sends screenlockPrivate.onAuthAttempted event to Easy Unlock app. // Sends screenlockPrivate.onAuthAttempted event to Easy Unlock app.
virtual bool SendAuthAttemptEvent() = 0; virtual bool SendAuthAttemptEvent() = 0;
}; };
......
...@@ -139,9 +139,6 @@ class EasyUnlockAppEventConsumer ...@@ -139,9 +139,6 @@ class EasyUnlockAppEventConsumer
void OnDispatchEventToExtension(const std::string& extension_id, void OnDispatchEventToExtension(const std::string& extension_id,
const extensions::Event& event) override { const extensions::Event& event) override {
if (event.event_name == if (event.event_name ==
easy_unlock_private_api::OnUserInfoUpdated::kEventName) {
ConsumeUserInfoUpdated(event.event_args.get());
} else if (event.event_name ==
screenlock_private_api::OnAuthAttempted::kEventName) { screenlock_private_api::OnAuthAttempted::kEventName) {
ConsumeAuthAttempted(event.event_args.get()); ConsumeAuthAttempted(event.event_args.get());
} else { } else {
...@@ -233,11 +230,6 @@ class EasyUnlockAppManagerTest : public testing::Test { ...@@ -233,11 +230,6 @@ class EasyUnlockAppManagerTest : public testing::Test {
.AppendASCII("easy_unlock"); .AppendASCII("easy_unlock");
} }
int UserUpdatedCount() const {
return event_router_->GetEventCount(
easy_unlock_private_api::OnUserInfoUpdated::kEventName);
}
int AuthAttemptedCount() const { int AuthAttemptedCount() const {
return event_router_->GetEventCount( return event_router_->GetEventCount(
screenlock_private_api::OnAuthAttempted::kEventName); screenlock_private_api::OnAuthAttempted::kEventName);
...@@ -471,72 +463,6 @@ TEST_F(EasyUnlockAppManagerTest, LaunchSetupWhenNotLoaded) { ...@@ -471,72 +463,6 @@ TEST_F(EasyUnlockAppManagerTest, LaunchSetupWhenNotLoaded) {
EXPECT_EQ(0, AppLaunchedCount()); EXPECT_EQ(0, AppLaunchedCount());
} }
TEST_F(EasyUnlockAppManagerTest, SendUserUpdated) {
SetExtensionSystemReady();
app_manager_->LoadApp();
event_router_->AddLazyEventListener(
easy_unlock_private_api::OnUserInfoUpdated::kEventName,
extension_misc::kEasyUnlockAppId);
ASSERT_EQ(0, UserUpdatedCount());
EXPECT_TRUE(app_manager_->SendUserUpdatedEvent("user", true /* logged_in */,
false /* data_ready */));
EXPECT_EQ(1, UserUpdatedCount());
EXPECT_EQ("user", event_consumer_.user_id());
EXPECT_TRUE(event_consumer_.user_logged_in());
EXPECT_FALSE(event_consumer_.user_data_ready());
}
TEST_F(EasyUnlockAppManagerTest, SendUserUpdatedInvertedFlags) {
SetExtensionSystemReady();
app_manager_->LoadApp();
event_router_->AddLazyEventListener(
easy_unlock_private_api::OnUserInfoUpdated::kEventName,
extension_misc::kEasyUnlockAppId);
ASSERT_EQ(0, UserUpdatedCount());
EXPECT_TRUE(app_manager_->SendUserUpdatedEvent("user", false /* logged_in */,
true /* data_ready */));
EXPECT_EQ(1, UserUpdatedCount());
EXPECT_EQ("user", event_consumer_.user_id());
EXPECT_FALSE(event_consumer_.user_logged_in());
EXPECT_TRUE(event_consumer_.user_data_ready());
}
TEST_F(EasyUnlockAppManagerTest, SendUserUpdatedNoRegisteredListeners) {
SetExtensionSystemReady();
app_manager_->LoadApp();
ASSERT_EQ(0, UserUpdatedCount());
EXPECT_FALSE(app_manager_->SendUserUpdatedEvent("user", true, true));
EXPECT_EQ(0, UserUpdatedCount());
}
TEST_F(EasyUnlockAppManagerTest, SendUserUpdatedAppDisabled) {
SetExtensionSystemReady();
app_manager_->LoadApp();
event_router_->AddLazyEventListener(
easy_unlock_private_api::OnUserInfoUpdated::kEventName,
extension_misc::kEasyUnlockAppId);
app_manager_->DisableAppIfLoaded();
ASSERT_EQ(0, UserUpdatedCount());
EXPECT_FALSE(app_manager_->SendUserUpdatedEvent("user", true, true));
EXPECT_EQ(0, UserUpdatedCount());
}
TEST_F(EasyUnlockAppManagerTest, SendAuthAttempted) { TEST_F(EasyUnlockAppManagerTest, SendAuthAttempted) {
SetExtensionSystemReady(); SetExtensionSystemReady();
...@@ -545,8 +471,6 @@ TEST_F(EasyUnlockAppManagerTest, SendAuthAttempted) { ...@@ -545,8 +471,6 @@ TEST_F(EasyUnlockAppManagerTest, SendAuthAttempted) {
screenlock_private_api::OnAuthAttempted::kEventName, screenlock_private_api::OnAuthAttempted::kEventName,
extension_misc::kEasyUnlockAppId); extension_misc::kEasyUnlockAppId);
ASSERT_EQ(0, UserUpdatedCount());
EXPECT_TRUE(app_manager_->SendAuthAttemptEvent()); EXPECT_TRUE(app_manager_->SendAuthAttemptEvent());
EXPECT_EQ(1, AuthAttemptedCount()); EXPECT_EQ(1, AuthAttemptedCount());
} }
......
...@@ -70,13 +70,6 @@ class FakeAppManager : public EasyUnlockAppManager { ...@@ -70,13 +70,6 @@ class FakeAppManager : public EasyUnlockAppManager {
void ReloadApp() override { ADD_FAILURE() << "Not reached"; } void ReloadApp() override { ADD_FAILURE() << "Not reached"; }
bool SendUserUpdatedEvent(const std::string& user_id,
bool is_logged_in,
bool data_ready) override {
ADD_FAILURE() << "Not reached";
return false;
}
bool SendAuthAttemptEvent() override { bool SendAuthAttemptEvent() override {
++auth_attempt_count_; ++auth_attempt_count_;
return !auth_attempt_should_fail_; return !auth_attempt_should_fail_;
......
...@@ -530,14 +530,12 @@ void EasyUnlockService::ReloadAppAndLockScreen() { ...@@ -530,14 +530,12 @@ void EasyUnlockService::ReloadAppAndLockScreen() {
// Make sure lock screen state set by the extension gets reset. // Make sure lock screen state set by the extension gets reset.
ResetScreenlockState(); ResetScreenlockState();
app_manager_->ReloadApp(); app_manager_->ReloadApp();
NotifyUserUpdated();
} }
void EasyUnlockService::UpdateAppState() { void EasyUnlockService::UpdateAppState() {
if (IsAllowed()) { if (IsAllowed()) {
EnsureTpmKeyPresentIfNeeded(); EnsureTpmKeyPresentIfNeeded();
app_manager_->LoadApp(); app_manager_->LoadApp();
NotifyUserUpdated();
if (proximity_auth_system_) if (proximity_auth_system_)
proximity_auth_system_->Start(); proximity_auth_system_->Start();
...@@ -568,18 +566,6 @@ void EasyUnlockService::DisableAppWithoutResettingScreenlockState() { ...@@ -568,18 +566,6 @@ void EasyUnlockService::DisableAppWithoutResettingScreenlockState() {
app_manager_->DisableAppIfLoaded(); app_manager_->DisableAppIfLoaded();
} }
void EasyUnlockService::NotifyUserUpdated() {
const AccountId& account_id = GetAccountId();
if (!account_id.is_valid())
return;
// Notify the easy unlock app that the user info changed.
bool logged_in = GetType() == TYPE_REGULAR;
bool data_ready = logged_in || GetRemoteDevices() != NULL;
app_manager_->SendUserUpdatedEvent(account_id.GetUserEmail(), logged_in,
data_ready);
}
void EasyUnlockService::NotifyTurnOffOperationStatusChanged() { void EasyUnlockService::NotifyTurnOffOperationStatusChanged() {
for (EasyUnlockServiceObserver& observer : observers_) for (EasyUnlockServiceObserver& observer : observers_)
observer.OnTurnOffOperationStatusChanged(); observer.OnTurnOffOperationStatusChanged();
......
...@@ -260,9 +260,6 @@ class EasyUnlockService : public KeyedService { ...@@ -260,9 +260,6 @@ class EasyUnlockService : public KeyedService {
// the lock screen UI should remain unchanged until the screen unlocks. // the lock screen UI should remain unchanged until the screen unlocks.
void DisableAppWithoutResettingScreenlockState(); void DisableAppWithoutResettingScreenlockState();
// Notifies the easy unlock app that the user state has been updated.
void NotifyUserUpdated();
// Notifies observers that the turn off flow status changed. // Notifies observers that the turn off flow status changed.
void NotifyTurnOffOperationStatusChanged(); void NotifyTurnOffOperationStatusChanged();
......
...@@ -453,14 +453,6 @@ void EasyUnlockServiceRegular::StartAutoPairing( ...@@ -453,14 +453,6 @@ void EasyUnlockServiceRegular::StartAutoPairing(
} }
auto_pairing_callback_ = callback; auto_pairing_callback_ = callback;
std::unique_ptr<base::ListValue> args(new base::ListValue());
std::unique_ptr<extensions::Event> event(new extensions::Event(
extensions::events::EASY_UNLOCK_PRIVATE_ON_START_AUTO_PAIRING,
extensions::api::easy_unlock_private::OnStartAutoPairing::kEventName,
std::move(args)));
extensions::EventRouter::Get(profile())->DispatchEventWithLazyListener(
extension_misc::kEasyUnlockAppId, std::move(event));
} }
void EasyUnlockServiceRegular::SetAutoPairingResult(bool success, void EasyUnlockServiceRegular::SetAutoPairingResult(bool success,
......
...@@ -443,8 +443,6 @@ void EasyUnlockServiceSignin::OnFocusedUserChanged( ...@@ -443,8 +443,6 @@ void EasyUnlockServiceSignin::OnFocusedUserChanged(
if (should_update_app_state) { if (should_update_app_state) {
UpdateAppState(); UpdateAppState();
} else {
NotifyUserUpdated();
} }
LoadCurrentUserDataIfNeeded(); LoadCurrentUserDataIfNeeded();
...@@ -512,11 +510,6 @@ void EasyUnlockServiceSignin::OnUserDataLoaded( ...@@ -512,11 +510,6 @@ void EasyUnlockServiceSignin::OnUserDataLoaded(
} }
} }
// If the fetched data belongs to the currently focused user, notify the app
// that it has to refresh it's user data.
if (account_id == account_id_)
NotifyUserUpdated();
if (devices.empty()) if (devices.empty())
return; return;
......
...@@ -122,13 +122,6 @@ class TestAppManager : public EasyUnlockAppManager { ...@@ -122,13 +122,6 @@ class TestAppManager : public EasyUnlockAppManager {
++reload_count_; ++reload_count_;
} }
bool SendUserUpdatedEvent(const std::string& user_id,
bool is_logged_in,
bool data_ready) override {
// TODO(tbarzic): Make this a bit smarter and add some test to utilize it.
return true;
}
bool SendAuthAttemptEvent() override { bool SendAuthAttemptEvent() override {
ADD_FAILURE() << "Not reached."; ADD_FAILURE() << "Not reached.";
return false; return false;
......
...@@ -80,35 +80,6 @@ EasyUnlockPrivateConnectionManager* GetConnectionManager( ...@@ -80,35 +80,6 @@ EasyUnlockPrivateConnectionManager* GetConnectionManager(
->get_connection_manager(); ->get_connection_manager();
} }
ScreenlockState ToScreenlockState(easy_unlock_private::State state) {
switch (state) {
case easy_unlock_private::STATE_NO_BLUETOOTH:
return ScreenlockState::NO_BLUETOOTH;
case easy_unlock_private::STATE_BLUETOOTH_CONNECTING:
return ScreenlockState::BLUETOOTH_CONNECTING;
case easy_unlock_private::STATE_NO_PHONE:
return ScreenlockState::NO_PHONE;
case easy_unlock_private::STATE_PHONE_NOT_AUTHENTICATED:
return ScreenlockState::PHONE_NOT_AUTHENTICATED;
case easy_unlock_private::STATE_PHONE_LOCKED:
return ScreenlockState::PHONE_LOCKED;
case easy_unlock_private::STATE_PHONE_UNLOCKABLE:
return ScreenlockState::PHONE_NOT_LOCKABLE;
case easy_unlock_private::STATE_PHONE_UNSUPPORTED:
return ScreenlockState::PHONE_UNSUPPORTED;
case easy_unlock_private::STATE_RSSI_TOO_LOW:
case easy_unlock_private::STATE_TX_POWER_TOO_HIGH:
// Note: TX Power is deprecated, so we merge it with the RSSI state.
return ScreenlockState::RSSI_TOO_LOW;
case easy_unlock_private::STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH:
return ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW;
case easy_unlock_private::STATE_AUTHENTICATED:
return ScreenlockState::AUTHENTICATED;
default:
return ScreenlockState::INACTIVE;
}
}
} // namespace } // namespace
// static // static
...@@ -456,82 +427,6 @@ void EasyUnlockPrivateUnwrapSecureMessageFunction::OnData( ...@@ -456,82 +427,6 @@ void EasyUnlockPrivateUnwrapSecureMessageFunction::OnData(
SendResponse(true); SendResponse(true);
} }
EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::
EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction() {}
EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::
~EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction() {}
bool EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::RunAsync() {
std::unique_ptr<easy_unlock_private::SeekBluetoothDeviceByAddress::Params>
params(easy_unlock_private::SeekBluetoothDeviceByAddress::Params::Create(
*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
proximity_auth::bluetooth_util::SeekDeviceByAddress(
params->device_address,
base::Bind(
&EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekSuccess,
this),
base::Bind(
&EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekFailure,
this),
base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BACKGROUND,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})
.get());
return true;
}
void EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekSuccess() {
SendResponse(true);
}
void EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekFailure(
const std::string& error_message) {
SetError(error_message);
SendResponse(false);
}
EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
~EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
void EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
ConnectToService(device::BluetoothDevice* device,
const device::BluetoothUUID& uuid) {
device->ConnectToServiceInsecurely(
uuid,
base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
OnConnect,
this),
base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
OnConnectError,
this));
}
EasyUnlockPrivateUpdateScreenlockStateFunction::
EasyUnlockPrivateUpdateScreenlockStateFunction() {}
EasyUnlockPrivateUpdateScreenlockStateFunction::
~EasyUnlockPrivateUpdateScreenlockStateFunction() {}
ExtensionFunction::ResponseAction
EasyUnlockPrivateUpdateScreenlockStateFunction::Run() {
std::unique_ptr<easy_unlock_private::UpdateScreenlockState::Params> params(
easy_unlock_private::UpdateScreenlockState::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
if (chromeos::EasyUnlockService::Get(profile)->UpdateScreenlockState(
ToScreenlockState(params->state))) {
return RespondNow(NoArguments());
}
return RespondNow(Error("Not allowed"));
}
EasyUnlockPrivateSetPermitAccessFunction:: EasyUnlockPrivateSetPermitAccessFunction::
EasyUnlockPrivateSetPermitAccessFunction() { EasyUnlockPrivateSetPermitAccessFunction() {
} }
...@@ -767,69 +662,6 @@ void EasyUnlockPrivateGetRemoteDevicesFunction::OnPSKDerivedForDevice( ...@@ -767,69 +662,6 @@ void EasyUnlockPrivateGetRemoteDevicesFunction::OnPSKDerivedForDevice(
} }
} }
EasyUnlockPrivateGetSignInChallengeFunction::
EasyUnlockPrivateGetSignInChallengeFunction() {
}
EasyUnlockPrivateGetSignInChallengeFunction::
~EasyUnlockPrivateGetSignInChallengeFunction() {
}
bool EasyUnlockPrivateGetSignInChallengeFunction::RunAsync() {
std::unique_ptr<easy_unlock_private::GetSignInChallenge::Params> params(
easy_unlock_private::GetSignInChallenge::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
const std::string challenge =
chromeos::EasyUnlockService::Get(profile)->GetChallenge();
if (!challenge.empty() && !params->nonce.empty()) {
chromeos::EasyUnlockTpmKeyManager* key_manager =
chromeos::EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile);
if (!key_manager) {
SetError("No EasyUnlockTpmKeyManager.");
return false;
}
key_manager->SignUsingTpmKey(
chromeos::EasyUnlockService::Get(profile)->GetAccountId(),
std::string(params->nonce.begin(), params->nonce.end()),
base::Bind(&EasyUnlockPrivateGetSignInChallengeFunction::OnDone, this,
challenge));
} else {
OnDone(challenge, std::string());
}
return true;
}
void EasyUnlockPrivateGetSignInChallengeFunction::OnDone(
const std::string& challenge,
const std::string& signed_nonce) {
results_ = easy_unlock_private::GetSignInChallenge::Results::Create(
std::vector<char>(challenge.begin(), challenge.end()),
std::vector<char>(signed_nonce.begin(), signed_nonce.end()));
SendResponse(true);
}
EasyUnlockPrivateTrySignInSecretFunction::
EasyUnlockPrivateTrySignInSecretFunction() {
}
EasyUnlockPrivateTrySignInSecretFunction::
~EasyUnlockPrivateTrySignInSecretFunction() {
}
ExtensionFunction::ResponseAction
EasyUnlockPrivateTrySignInSecretFunction::Run() {
std::unique_ptr<easy_unlock_private::TrySignInSecret::Params> params(
easy_unlock_private::TrySignInSecret::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
chromeos::EasyUnlockService::Get(profile)->FinalizeSignin(std::string(
params->sign_in_secret.begin(), params->sign_in_secret.end()));
return RespondNow(NoArguments());
}
EasyUnlockPrivateGetUserInfoFunction::EasyUnlockPrivateGetUserInfoFunction() { EasyUnlockPrivateGetUserInfoFunction::EasyUnlockPrivateGetUserInfoFunction() {
} }
...@@ -858,49 +690,6 @@ ExtensionFunction::ResponseAction EasyUnlockPrivateGetUserInfoFunction::Run() { ...@@ -858,49 +690,6 @@ ExtensionFunction::ResponseAction EasyUnlockPrivateGetUserInfoFunction::Run() {
ArgumentList(easy_unlock_private::GetUserInfo::Results::Create(users))); ArgumentList(easy_unlock_private::GetUserInfo::Results::Create(users)));
} }
EasyUnlockPrivateGetConnectionInfoFunction::
EasyUnlockPrivateGetConnectionInfoFunction() {
}
EasyUnlockPrivateGetConnectionInfoFunction::
~EasyUnlockPrivateGetConnectionInfoFunction() {
}
bool EasyUnlockPrivateGetConnectionInfoFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
std::unique_ptr<easy_unlock_private::GetConnectionInfo::Params> params =
easy_unlock_private::GetConnectionInfo::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
device::BluetoothDevice* device = adapter->GetDevice(params->device_address);
std::string error;
if (!device)
error = "Invalid Bluetooth device.";
else if (!device->IsConnected())
error = "Bluetooth device not connected.";
if (!error.empty()) {
SetError(error);
SendResponse(false);
return true;
}
device->GetConnectionInfo(base::Bind(
&EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo, this));
return false;
}
void EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo(
const device::BluetoothDevice::ConnectionInfo& connection_info) {
std::unique_ptr<base::ListValue> results(new base::ListValue());
results->AppendInteger(connection_info.rssi);
results->AppendInteger(connection_info.transmit_power);
results->AppendInteger(connection_info.max_transmit_power);
SetResultList(std::move(results));
SendResponse(true);
}
EasyUnlockPrivateShowErrorBubbleFunction:: EasyUnlockPrivateShowErrorBubbleFunction::
EasyUnlockPrivateShowErrorBubbleFunction() { EasyUnlockPrivateShowErrorBubbleFunction() {
} }
...@@ -960,31 +749,6 @@ EasyUnlockPrivateHideErrorBubbleFunction::Run() { ...@@ -960,31 +749,6 @@ EasyUnlockPrivateHideErrorBubbleFunction::Run() {
#endif #endif
} }
EasyUnlockPrivateSetAutoPairingResultFunction::
EasyUnlockPrivateSetAutoPairingResultFunction() {
}
EasyUnlockPrivateSetAutoPairingResultFunction::
~EasyUnlockPrivateSetAutoPairingResultFunction() {
}
ExtensionFunction::ResponseAction
EasyUnlockPrivateSetAutoPairingResultFunction::Run() {
std::unique_ptr<easy_unlock_private::SetAutoPairingResult::Params> params =
easy_unlock_private::SetAutoPairingResult::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
std::string error_message;
if (params->result.error_message)
error_message = *params->result.error_message;
Profile* profile = Profile::FromBrowserContext(browser_context());
chromeos::EasyUnlockService::Get(profile)->SetAutoPairingResult(
params->result.success, error_message);
return RespondNow(NoArguments());
}
EasyUnlockPrivateFindSetupConnectionFunction:: EasyUnlockPrivateFindSetupConnectionFunction::
EasyUnlockPrivateFindSetupConnectionFunction() {} EasyUnlockPrivateFindSetupConnectionFunction() {}
...@@ -1036,26 +800,6 @@ bool EasyUnlockPrivateFindSetupConnectionFunction::RunAsync() { ...@@ -1036,26 +800,6 @@ bool EasyUnlockPrivateFindSetupConnectionFunction::RunAsync() {
return true; return true;
} }
EasyUnlockPrivateSetupConnectionStatusFunction::
EasyUnlockPrivateSetupConnectionStatusFunction() {}
EasyUnlockPrivateSetupConnectionStatusFunction::
~EasyUnlockPrivateSetupConnectionStatusFunction() {}
ExtensionFunction::ResponseAction
EasyUnlockPrivateSetupConnectionStatusFunction::Run() {
std::unique_ptr<easy_unlock_private::SetupConnectionStatus::Params> params =
easy_unlock_private::SetupConnectionStatus::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
api::easy_unlock_private::ConnectionStatus status =
GetConnectionManager(browser_context())
->ConnectionStatus(extension(), params->connection_id);
if (status == api::easy_unlock_private::CONNECTION_STATUS_NONE)
return RespondNow(Error("Invalid connectionId"));
return RespondNow(ArgumentList(
easy_unlock_private::SetupConnectionStatus::Results::Create(status)));
}
EasyUnlockPrivateSetupConnectionDisconnectFunction:: EasyUnlockPrivateSetupConnectionDisconnectFunction::
EasyUnlockPrivateSetupConnectionDisconnectFunction() {} EasyUnlockPrivateSetupConnectionDisconnectFunction() {}
...@@ -1094,27 +838,4 @@ EasyUnlockPrivateSetupConnectionSendFunction::Run() { ...@@ -1094,27 +838,4 @@ EasyUnlockPrivateSetupConnectionSendFunction::Run() {
return RespondNow(NoArguments()); return RespondNow(NoArguments());
} }
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction::
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction() {}
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction::
~EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction() {}
ExtensionFunction::ResponseAction
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction::Run() {
std::unique_ptr<easy_unlock_private::SetupConnectionGetDeviceAddress::Params>
params =
easy_unlock_private::SetupConnectionGetDeviceAddress::Params::Create(
*args_);
EXTENSION_FUNCTION_VALIDATE(params);
std::string device_address =
GetConnectionManager(browser_context())
->GetDeviceAddress(extension(), params->connection_id);
if (device_address.empty())
return RespondNow(Error("Invalid connectionId."));
return RespondNow(ArgumentList(
easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create(
device_address)));
}
} // namespace extensions } // namespace extensions
...@@ -170,63 +170,6 @@ class EasyUnlockPrivateUnwrapSecureMessageFunction ...@@ -170,63 +170,6 @@ class EasyUnlockPrivateUnwrapSecureMessageFunction
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateUnwrapSecureMessageFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateUnwrapSecureMessageFunction);
}; };
class EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction
: public AsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.seekBluetoothDeviceByAddress",
EASYUNLOCKPRIVATE_SEEKBLUETOOTHDEVICEBYADDRESS)
EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction();
private:
~EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction() override;
// AsyncExtensionFunction:
bool RunAsync() override;
// Callbacks that are called when the seek operation succeeds or fails.
void OnSeekSuccess();
void OnSeekFailure(const std::string& error_message);
DISALLOW_COPY_AND_ASSIGN(
EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction);
};
class EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction
: public api::BluetoothSocketAbstractConnectFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"easyUnlockPrivate.connectToBluetoothServiceInsecurely",
EASYUNLOCKPRIVATE_CONNECTTOBLUETOOTHSERVICEINSECURELY)
EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction();
private:
~EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() override;
// BluetoothSocketAbstractConnectFunction:
void ConnectToService(device::BluetoothDevice* device,
const device::BluetoothUUID& uuid) override;
DISALLOW_COPY_AND_ASSIGN(
EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction);
};
class EasyUnlockPrivateUpdateScreenlockStateFunction
: public UIThreadExtensionFunction {
public:
EasyUnlockPrivateUpdateScreenlockStateFunction();
protected:
~EasyUnlockPrivateUpdateScreenlockStateFunction() override;
ResponseAction Run() override;
private:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.updateScreenlockState",
EASYUNLOCKPRIVATE_UPDATESCREENLOCKSTATE)
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateUpdateScreenlockStateFunction);
};
class EasyUnlockPrivateSetPermitAccessFunction class EasyUnlockPrivateSetPermitAccessFunction
: public UIThreadExtensionFunction { : public UIThreadExtensionFunction {
public: public:
...@@ -339,41 +282,6 @@ class EasyUnlockPrivateGetRemoteDevicesFunction ...@@ -339,41 +282,6 @@ class EasyUnlockPrivateGetRemoteDevicesFunction
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction);
}; };
class EasyUnlockPrivateGetSignInChallengeFunction :
public AsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getSignInChallenge",
EASYUNLOCKPRIVATE_GETSIGNINCHALLENGE)
EasyUnlockPrivateGetSignInChallengeFunction();
private:
~EasyUnlockPrivateGetSignInChallengeFunction() override;
// AsyncExtensionFunction:
bool RunAsync() override;
// Called when the challenge and the signed nonce have been generated.
void OnDone(const std::string& challenge, const std::string& signed_nonce);
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetSignInChallengeFunction);
};
class EasyUnlockPrivateTrySignInSecretFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.trySignInSecret",
EASYUNLOCKPRIVATE_TRYSIGNINSECRET)
EasyUnlockPrivateTrySignInSecretFunction();
private:
~EasyUnlockPrivateTrySignInSecretFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateTrySignInSecretFunction);
};
class EasyUnlockPrivateGetUserInfoFunction : public UIThreadExtensionFunction { class EasyUnlockPrivateGetUserInfoFunction : public UIThreadExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getUserInfo", DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getUserInfo",
...@@ -389,25 +297,6 @@ class EasyUnlockPrivateGetUserInfoFunction : public UIThreadExtensionFunction { ...@@ -389,25 +297,6 @@ class EasyUnlockPrivateGetUserInfoFunction : public UIThreadExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetUserInfoFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetUserInfoFunction);
}; };
class EasyUnlockPrivateGetConnectionInfoFunction
: public api::BluetoothExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getConnectionInfo",
EASYUNLOCKPRIVATE_GETCONNECTIONINFO)
EasyUnlockPrivateGetConnectionInfoFunction();
private:
~EasyUnlockPrivateGetConnectionInfoFunction() override;
// BluetoothExtensionFunction:
bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) override;
void OnConnectionInfo(
const device::BluetoothDevice::ConnectionInfo& connection_info);
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetConnectionInfoFunction);
};
class EasyUnlockPrivateShowErrorBubbleFunction class EasyUnlockPrivateShowErrorBubbleFunction
: public UIThreadExtensionFunction { : public UIThreadExtensionFunction {
public: public:
...@@ -440,22 +329,6 @@ class EasyUnlockPrivateHideErrorBubbleFunction ...@@ -440,22 +329,6 @@ class EasyUnlockPrivateHideErrorBubbleFunction
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateHideErrorBubbleFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateHideErrorBubbleFunction);
}; };
class EasyUnlockPrivateSetAutoPairingResultFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setAutoPairingResult",
EASYUNLOCKPRIVATE_SETAUTOPAIRINGRESULT)
EasyUnlockPrivateSetAutoPairingResultFunction();
private:
~EasyUnlockPrivateSetAutoPairingResultFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetAutoPairingResultFunction);
};
class EasyUnlockPrivateFindSetupConnectionFunction class EasyUnlockPrivateFindSetupConnectionFunction
: public AsyncExtensionFunction { : public AsyncExtensionFunction {
public: public:
...@@ -486,22 +359,6 @@ class EasyUnlockPrivateFindSetupConnectionFunction ...@@ -486,22 +359,6 @@ class EasyUnlockPrivateFindSetupConnectionFunction
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateFindSetupConnectionFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateFindSetupConnectionFunction);
}; };
class EasyUnlockPrivateSetupConnectionStatusFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setupConnectionStatus",
EASYUNLOCKPRIVATE_SETUPCONNECTIONSTATUS)
EasyUnlockPrivateSetupConnectionStatusFunction();
private:
~EasyUnlockPrivateSetupConnectionStatusFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetupConnectionStatusFunction);
};
class EasyUnlockPrivateSetupConnectionDisconnectFunction class EasyUnlockPrivateSetupConnectionDisconnectFunction
: public UIThreadExtensionFunction { : public UIThreadExtensionFunction {
public: public:
...@@ -534,24 +391,6 @@ class EasyUnlockPrivateSetupConnectionSendFunction ...@@ -534,24 +391,6 @@ class EasyUnlockPrivateSetupConnectionSendFunction
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetupConnectionSendFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetupConnectionSendFunction);
}; };
class EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"easyUnlockPrivate.setupConnectionGetDeviceAddress",
EASYUNLOCKPRIVATE_SETUPCONNECTIONGETDEVICEADDRESS)
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction();
private:
~EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(
EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction);
};
} // namespace extensions } // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_API_H_ #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_API_H_
...@@ -61,7 +61,6 @@ using extensions::EasyUnlockPrivateCreateSecureMessageFunction; ...@@ -61,7 +61,6 @@ using extensions::EasyUnlockPrivateCreateSecureMessageFunction;
using extensions::EasyUnlockPrivateConnectionManager; using extensions::EasyUnlockPrivateConnectionManager;
using extensions::EasyUnlockPrivateGenerateEcP256KeyPairFunction; using extensions::EasyUnlockPrivateGenerateEcP256KeyPairFunction;
using extensions::EasyUnlockPrivatePerformECDHKeyAgreementFunction; using extensions::EasyUnlockPrivatePerformECDHKeyAgreementFunction;
using extensions::EasyUnlockPrivateSetAutoPairingResultFunction;
using extensions::EasyUnlockPrivateUnwrapSecureMessageFunction; using extensions::EasyUnlockPrivateUnwrapSecureMessageFunction;
using extensions::Extension; using extensions::Extension;
using extensions::ExtensionBuilder; using extensions::ExtensionBuilder;
...@@ -503,57 +502,6 @@ struct AutoPairingResult { ...@@ -503,57 +502,6 @@ struct AutoPairingResult {
std::string error; std::string error;
}; };
// Test factory to register EasyUnlockService.
std::unique_ptr<KeyedService> BuildTestEasyUnlockService(
content::BrowserContext* context) {
std::unique_ptr<chromeos::EasyUnlockServiceRegular> service(
new chromeos::EasyUnlockServiceRegular(
Profile::FromBrowserContext(context)));
service->Initialize(chromeos::EasyUnlockAppManager::Create(
extensions::ExtensionSystem::Get(context), -1 /* manifest id */,
base::FilePath()));
return std::move(service);
}
TEST_F(EasyUnlockPrivateApiTest, AutoPairing) {
extensions::TestEventRouter* event_router =
extensions::CreateAndUseTestEventRouter(profile());
event_router->set_expected_extension_id(extension_misc::kEasyUnlockAppId);
chromeos::EasyUnlockServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile(), &BuildTestEasyUnlockService);
AutoPairingResult result;
// Dispatch OnStartAutoPairing event on EasyUnlockService::StartAutoPairing.
chromeos::EasyUnlockService* service =
chromeos::EasyUnlockService::Get(profile());
service->StartAutoPairing(base::Bind(&AutoPairingResult::SetResult,
base::Unretained(&result)));
EXPECT_EQ(1,
event_router->GetEventCount(extensions::api::easy_unlock_private::
OnStartAutoPairing::kEventName));
// Test SetAutoPairingResult call with failure.
scoped_refptr<EasyUnlockPrivateSetAutoPairingResultFunction> function(
new EasyUnlockPrivateSetAutoPairingResultFunction());
ASSERT_TRUE(extension_function_test_utils::RunFunction(
function.get(), "[{\"success\":false, \"errorMessage\":\"fake_error\"}]",
browser(), extensions::api_test_utils::NONE));
EXPECT_FALSE(result.success);
EXPECT_EQ("fake_error", result.error);
// Test SetAutoPairingResult call with success.
service->StartAutoPairing(base::Bind(&AutoPairingResult::SetResult,
base::Unretained(&result)));
function = new EasyUnlockPrivateSetAutoPairingResultFunction();
ASSERT_TRUE(extension_function_test_utils::RunFunction(
function.get(), "[{\"success\":true}]", browser(),
extensions::api_test_utils::NONE));
EXPECT_TRUE(result.success);
EXPECT_TRUE(result.error.empty());
}
// Tests that no BrowserContext dependencies of EasyUnlockPrivateApi (and its // Tests that no BrowserContext dependencies of EasyUnlockPrivateApi (and its
// dependencies) are referenced after the BrowserContext is torn down. The test // dependencies) are referenced after the BrowserContext is torn down. The test
// fails with a crash if such a condition exists. // fails with a crash if such a condition exists.
......
...@@ -18,45 +18,6 @@ namespace easyUnlockPrivate { ...@@ -18,45 +18,6 @@ namespace easyUnlockPrivate {
AES_256_CBC AES_256_CBC
}; };
// Available states for the Easy Unlock app.
enum State {
// Screen is either not locked, or the Easy Unlock is not enabled.
INACTIVE,
// The Bluetooth is not enabled.
NO_BLUETOOTH,
// Bluetooth is being activated.
BLUETOOTH_CONNECTING,
// There are no phones eligible to unlock the device.
NO_PHONE,
// A phone eligible to unlock the device is detected, but can't be
// authenticated.
PHONE_NOT_AUTHENTICATED,
// A phone eligible to unlock the device is detected, but it's locked and
// thus unable to unlock the device.
PHONE_LOCKED,
// A phone eligible to unlock the device is detected, but it is not allowed
// to unlock the device because it doesn't have lock screen enabled.
PHONE_UNLOCKABLE,
// A phone eligible to unlock the device is detected, but it is not allowed
// to unlock the device because it does not report its lock screen state.
PHONE_UNSUPPORTED,
// A phone eligible to unlock the device is detected, but its received
// signal strength is too low, i.e. the phone is roughly more than 30 feet
// away, and therefore is not allowed to unlock the device.
RSSI_TOO_LOW,
// A phone eligible to unlock the device is found, but the local device's
// transmission power is too high, indicating that the phone is (probably)
// more than 1 foot away, and therefore is not allowed to unlock the device.
TX_POWER_TOO_HIGH,
// A phone eligible to unlock the device is found; but (a) the phone is
// locked, and (b) the local device's transmission power is too high,
// indicating that the phone is (probably) more than 1 foot away, and
// therefore is not allowed to unlock the device.
PHONE_LOCKED_AND_TX_POWER_TOO_HIGH,
// The device can be unlocked using Easy Unlock.
AUTHENTICATED
};
// Type of a permit. All lower case to match permit.PermitRecord.Type. // Type of a permit. All lower case to match permit.PermitRecord.Type.
enum PermitType {access, license}; enum PermitType {access, license};
...@@ -182,15 +143,6 @@ namespace easyUnlockPrivate { ...@@ -182,15 +143,6 @@ namespace easyUnlockPrivate {
long height; long height;
}; };
// Auto pairing reuslt.
dictionary AutoPairingResult {
// Whether the auto pairing is completed successfully.
boolean success;
// Optional error message to indicate the failure.
DOMString? errorMessage;
};
// Callback for crypto methods that return a single array buffer. // Callback for crypto methods that return a single array buffer.
callback DataCallback = void(optional ArrayBuffer data); callback DataCallback = void(optional ArrayBuffer data);
...@@ -216,25 +168,6 @@ namespace easyUnlockPrivate { ...@@ -216,25 +168,6 @@ namespace easyUnlockPrivate {
// most one user. // most one user.
callback GetUserInfoCallback = void(UserInfo[] users); callback GetUserInfoCallback = void(UserInfo[] users);
// Callback for |getSignInChallenge()| method.
// In case challenge could not be created both |challenge| and |signedNonce|
// will be empty.
// If the requested nonce could not be signed, |signedNonce| will be empty.
// |challenge|: The sign in challenge to be used when signing in the user
// currently associated with the Easy Unlock service.
// |signedNonce|: Nonce signed by Chrome OS TPM, provided as an argument to
// the |getSignInChallenge()| function and signed by the TPM key
// associated with the user.
callback SignInChallengeCallback = void(optional ArrayBuffer challenge,
optional ArrayBuffer signedNonce);
// Callback for the |getConnectionInfo()| method.
// |rssi|: The received signal strength from the remote device in dB.
// |transmit_power| The local transmission power to the remote device in dB.
// |max_transmit_power| The maximum transmission power that can be achieved.
callback ConnectionInfoCallback = void(
long rssi, long transmit_power, long max_transmit_power);
// Callback for the |FindSetupConnectionCallback| method. // Callback for the |FindSetupConnectionCallback| method.
// |connectionId|: The identifier of the connection found. To be used in // |connectionId|: The identifier of the connection found. To be used in
// future calls refering to this connection. // future calls refering to this connection.
...@@ -242,16 +175,6 @@ namespace easyUnlockPrivate { ...@@ -242,16 +175,6 @@ namespace easyUnlockPrivate {
callback FindSetupConnectionCallback = void(long connectionId, callback FindSetupConnectionCallback = void(long connectionId,
DOMString deviceAddress); DOMString deviceAddress);
// Callback for the |setupConnectionStatus()| method.
// |status|: The status of the connection with |connection_id|.
callback SetupConnectionStatusCallback = void(ConnectionStatus status);
// Callback for the |setupConnectionGetDeviceAddress()| method.
// |deviceAddress|: The bluetooth address of the connection with
// |connectionId|.
callback SetupConnectionGetDeviceAddressCallback = void(
DOMString deviceAddress);
interface Functions { interface Functions {
// Gets localized strings required to render the API. // Gets localized strings required to render the API.
// //
...@@ -314,35 +237,6 @@ namespace easyUnlockPrivate { ...@@ -314,35 +237,6 @@ namespace easyUnlockPrivate {
UnwrapSecureMessageOptions options, UnwrapSecureMessageOptions options,
DataCallback callback); DataCallback callback);
// Connects to the SDP service on a device, given just the device's
// Bluetooth address. This function is useful as a faster alternative to
// Bluetooth discovery, when you already know the remote device's Bluetooth
// address. A successful call to this function has the side-effect of
// registering the device with the Bluetooth daemon, making it available for
// future outgoing connections.
// |deviceAddress|: The Bluetooth address of the device to connect to.
// |callback|: Called to indicate success or failure.
static void seekBluetoothDeviceByAddress(DOMString deviceAddress,
optional EmptyCallback callback);
// Connects the socket to a remote Bluetooth device over an insecure
// connection, i.e. a connection that requests no bonding and no
// man-in-the-middle protection. Other than the reduced security setting,
// behaves identically to the chrome.bluetoothSocket.connect() function.
// |socketId|: The socket identifier, as issued by the
// chrome.bluetoothSocket API.
// |deviceAddress|: The Bluetooth address of the device to connect to.
// |uuid|: The UUID of the service to connect to.
// |callback|: Called when the connect attempt is complete.
static void connectToBluetoothServiceInsecurely(long socketId,
DOMString deviceAddress,
DOMString uuid,
EmptyCallback callback);
// Updates the screenlock state to reflect the Easy Unlock app state.
static void updateScreenlockState(State state,
optional EmptyCallback callback);
// Saves the permit record for the local device. // Saves the permit record for the local device.
// |permitAccess|: The permit record to be saved. // |permitAccess|: The permit record to be saved.
// |callback|: Called to indicate success or failure. // |callback|: Called to indicate success or failure.
...@@ -364,27 +258,10 @@ namespace easyUnlockPrivate { ...@@ -364,27 +258,10 @@ namespace easyUnlockPrivate {
// Gets the remote device list. // Gets the remote device list.
static void getRemoteDevices(GetRemoteDevicesCallback callback); static void getRemoteDevices(GetRemoteDevicesCallback callback);
// Gets the sign-in challenge for the current user.
// |nonce|: Nonce that should be signed by the Chrome OS TPM. The signed
// nonce is returned with the sign-in challenge.
static void getSignInChallenge(ArrayBuffer nonce,
SignInChallengeCallback callback);
// Tries to sign-in the current user with a secret obtained by decrypting
// the sign-in challenge. Check chrome.runtime.lastError for failures. Upon
// success, the user session will be started.
static void trySignInSecret(ArrayBuffer signInSecret,
EmptyCallback callback);
// Retrieves information about the user associated with the Easy unlock // Retrieves information about the user associated with the Easy unlock
// service. // service.
static void getUserInfo(GetUserInfoCallback callback); static void getUserInfo(GetUserInfoCallback callback);
// Gets the connection info for the Bluetooth device identified by
// deviceAddress.
static void getConnectionInfo(DOMString deviceAddress,
ConnectionInfoCallback callback);
// Shows an error bubble with the given |message|, anchored to an edge of // Shows an error bubble with the given |message|, anchored to an edge of
// the given |anchorRect| -- typically the right edge, but possibly a // the given |anchorRect| -- typically the right edge, but possibly a
// different edge if there is not space for the bubble to the right of the // different edge if there is not space for the bubble to the right of the
...@@ -399,14 +276,6 @@ namespace easyUnlockPrivate { ...@@ -399,14 +276,6 @@ namespace easyUnlockPrivate {
// Hides the currently visible error bubble, if there is one. // Hides the currently visible error bubble, if there is one.
static void hideErrorBubble(); static void hideErrorBubble();
// Sets the result of auto pairing triggered from onStartAutoPairing
// event. If auto pairing is completed successfully, |result.success|
// should be true so that Easy bootstrap flow would finish and starts
// the user session. Otherwise, |result.success| is set to false with
// an optional error message to be displayed to the user.
static void setAutoPairingResult(AutoPairingResult result,
optional EmptyCallback callback);
// Finds and connects the remote BLE device that is advertising: // Finds and connects the remote BLE device that is advertising:
// |setupServiceUUID|. Returns when a connection is found or |timeOut| // |setupServiceUUID|. Returns when a connection is found or |timeOut|
// seconds have elapsed. // seconds have elapsed.
...@@ -414,10 +283,6 @@ namespace easyUnlockPrivate { ...@@ -414,10 +283,6 @@ namespace easyUnlockPrivate {
long timeOut, long timeOut,
FindSetupConnectionCallback callback); FindSetupConnectionCallback callback);
// Returns the status of the connection with |connectionId|.
static void setupConnectionStatus(long connectionId,
SetupConnectionStatusCallback callback);
// Disconnects the connection with |connectionId|. // Disconnects the connection with |connectionId|.
static void setupConnectionDisconnect(long connectionId, static void setupConnectionDisconnect(long connectionId,
optional EmptyCallback callback); optional EmptyCallback callback);
...@@ -426,22 +291,9 @@ namespace easyUnlockPrivate { ...@@ -426,22 +291,9 @@ namespace easyUnlockPrivate {
static void setupConnectionSend(long connectionId, static void setupConnectionSend(long connectionId,
ArrayBuffer data, ArrayBuffer data,
optional EmptyCallback callback); optional EmptyCallback callback);
// Gets the Bluetooth address of the connection with |connectionId|
static void setupConnectionGetDeviceAddress(long connectionId,
SetupConnectionGetDeviceAddressCallback callback);
}; };
interface Events { interface Events {
// Event fired when the data for the user currently associated with
// Easy unlock service is updated.
// |userInfo| The updated user information.
static void onUserInfoUpdated(UserInfo userInfo);
// Event fired at the end of Easy bootstrap to start auto pairing so
// that a proper cryptohome key could be generated for the user.
static void onStartAutoPairing();
// Event fired when |connectionId| change status. // Event fired when |connectionId| change status.
static void onConnectionStatusChanged(long connectionId, static void onConnectionStatusChanged(long connectionId,
ConnectionStatus oldStatus, ConnectionStatus oldStatus,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment