Commit 191fe596 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS MultiDevice] Remove unnecessary callback from Mojo function.

The SetAccountStatusChangeDelegate() function previously fired a
callback after the delegate was set, but that was unnecessary. All of
the clients of the function simply passed base::DoNothing() anyway.

This CL removes that unnecessary callback.

Bug: 824568
Change-Id: Iea3e6e0c85eedb6e3cfcb0147b81e433cc5babac
Reviewed-on: https://chromium-review.googlesource.com/1110600
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569765}
parent f2f7de31
...@@ -190,7 +190,7 @@ void MultiDeviceNotificationPresenter::ObserveMultiDeviceSetupIfPossible() { ...@@ -190,7 +190,7 @@ void MultiDeviceNotificationPresenter::ObserveMultiDeviceSetupIfPossible() {
delegate_ptr; delegate_ptr;
binding_.Bind(mojo::MakeRequest(&delegate_ptr)); binding_.Bind(mojo::MakeRequest(&delegate_ptr));
multidevice_setup_ptr_->SetAccountStatusChangeDelegate( multidevice_setup_ptr_->SetAccountStatusChangeDelegate(
std::move(delegate_ptr), base::DoNothing()); std::move(delegate_ptr));
} }
void MultiDeviceNotificationPresenter::OnNotificationClicked() { void MultiDeviceNotificationPresenter::OnNotificationClicked() {
......
...@@ -101,10 +101,8 @@ class FakeMultiDeviceSetup ...@@ -101,10 +101,8 @@ class FakeMultiDeviceSetup
// mojom::MultiDeviceSetup: // mojom::MultiDeviceSetup:
void SetAccountStatusChangeDelegate( void SetAccountStatusChangeDelegate(
chromeos::multidevice_setup::mojom::AccountStatusChangeDelegatePtr chromeos::multidevice_setup::mojom::AccountStatusChangeDelegatePtr
delegate, delegate) override {
SetAccountStatusChangeDelegateCallback callback) override {
delegate_ = std::move(delegate); delegate_ = std::move(delegate);
std::move(callback).Run();
} }
void TriggerEventForDebugging( void TriggerEventForDebugging(
......
...@@ -13,10 +13,8 @@ FakeMultiDeviceSetup::FakeMultiDeviceSetup() = default; ...@@ -13,10 +13,8 @@ FakeMultiDeviceSetup::FakeMultiDeviceSetup() = default;
FakeMultiDeviceSetup::~FakeMultiDeviceSetup() = default; FakeMultiDeviceSetup::~FakeMultiDeviceSetup() = default;
void FakeMultiDeviceSetup::SetAccountStatusChangeDelegate( void FakeMultiDeviceSetup::SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) {
SetAccountStatusChangeDelegateCallback callback) {
delegate_ = std::move(delegate); delegate_ = std::move(delegate);
std::move(callback).Run();
} }
void FakeMultiDeviceSetup::TriggerEventForDebugging( void FakeMultiDeviceSetup::TriggerEventForDebugging(
......
...@@ -31,8 +31,7 @@ class FakeMultiDeviceSetup : public mojom::MultiDeviceSetup { ...@@ -31,8 +31,7 @@ class FakeMultiDeviceSetup : public mojom::MultiDeviceSetup {
private: private:
// mojom::MultiDeviceSetup: // mojom::MultiDeviceSetup:
void SetAccountStatusChangeDelegate( void SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) override;
SetAccountStatusChangeDelegateCallback callback) override;
void TriggerEventForDebugging( void TriggerEventForDebugging(
mojom::EventTypeForDebugging type, mojom::EventTypeForDebugging type,
TriggerEventForDebuggingCallback callback) override; TriggerEventForDebuggingCallback callback) override;
......
...@@ -63,10 +63,8 @@ MultiDeviceSetupImpl::MultiDeviceSetupImpl( ...@@ -63,10 +63,8 @@ MultiDeviceSetupImpl::MultiDeviceSetupImpl(
MultiDeviceSetupImpl::~MultiDeviceSetupImpl() = default; MultiDeviceSetupImpl::~MultiDeviceSetupImpl() = default;
void MultiDeviceSetupImpl::SetAccountStatusChangeDelegate( void MultiDeviceSetupImpl::SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) {
SetAccountStatusChangeDelegateCallback callback) {
delegate_notifier_->SetAccountStatusChangeDelegatePtr(std::move(delegate)); delegate_notifier_->SetAccountStatusChangeDelegatePtr(std::move(delegate));
std::move(callback).Run();
} }
void MultiDeviceSetupImpl::TriggerEventForDebugging( void MultiDeviceSetupImpl::TriggerEventForDebugging(
......
...@@ -54,8 +54,7 @@ class MultiDeviceSetupImpl : public mojom::MultiDeviceSetup { ...@@ -54,8 +54,7 @@ class MultiDeviceSetupImpl : public mojom::MultiDeviceSetup {
// mojom::MultiDeviceSetup: // mojom::MultiDeviceSetup:
void SetAccountStatusChangeDelegate( void SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) override;
SetAccountStatusChangeDelegateCallback callback) override;
void TriggerEventForDebugging( void TriggerEventForDebugging(
mojom::EventTypeForDebugging type, mojom::EventTypeForDebugging type,
TriggerEventForDebuggingCallback callback) override; TriggerEventForDebuggingCallback callback) override;
......
...@@ -149,8 +149,7 @@ class MultiDeviceSetupImplTest : public testing::Test { ...@@ -149,8 +149,7 @@ class MultiDeviceSetupImplTest : public testing::Test {
EXPECT_FALSE(fake_account_status_change_delegate_notifier()->delegate()); EXPECT_FALSE(fake_account_status_change_delegate_notifier()->delegate());
multidevice_setup_->SetAccountStatusChangeDelegate( multidevice_setup_->SetAccountStatusChangeDelegate(
fake_account_status_change_delegate_->GenerateInterfacePtr(), fake_account_status_change_delegate_->GenerateInterfacePtr());
base::DoNothing());
EXPECT_TRUE(fake_account_status_change_delegate_notifier()->delegate()); EXPECT_TRUE(fake_account_status_change_delegate_notifier()->delegate());
} }
......
...@@ -63,11 +63,10 @@ MultiDeviceSetupInitializer::MultiDeviceSetupInitializer( ...@@ -63,11 +63,10 @@ MultiDeviceSetupInitializer::MultiDeviceSetupInitializer(
MultiDeviceSetupInitializer::~MultiDeviceSetupInitializer() = default; MultiDeviceSetupInitializer::~MultiDeviceSetupInitializer() = default;
void MultiDeviceSetupInitializer::SetAccountStatusChangeDelegate( void MultiDeviceSetupInitializer::SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) {
SetAccountStatusChangeDelegateCallback callback) {
if (multidevice_setup_impl_) { if (multidevice_setup_impl_) {
multidevice_setup_impl_->SetAccountStatusChangeDelegate( multidevice_setup_impl_->SetAccountStatusChangeDelegate(
std::move(delegate), std::move(callback)); std::move(delegate));
return; return;
} }
...@@ -76,8 +75,6 @@ void MultiDeviceSetupInitializer::SetAccountStatusChangeDelegate( ...@@ -76,8 +75,6 @@ void MultiDeviceSetupInitializer::SetAccountStatusChangeDelegate(
<< "service was initialized; will be set once initialization is " << "service was initialized; will be set once initialization is "
<< "complete."; << "complete.";
pending_delegate_ = std::move(delegate); pending_delegate_ = std::move(delegate);
std::move(callback).Run();
} }
void MultiDeviceSetupInitializer::TriggerEventForDebugging( void MultiDeviceSetupInitializer::TriggerEventForDebugging(
...@@ -111,7 +108,7 @@ void MultiDeviceSetupInitializer::InitializeImplementation() { ...@@ -111,7 +108,7 @@ void MultiDeviceSetupInitializer::InitializeImplementation() {
return; return;
multidevice_setup_impl_->SetAccountStatusChangeDelegate( multidevice_setup_impl_->SetAccountStatusChangeDelegate(
std::move(pending_delegate_), base::DoNothing()); std::move(pending_delegate_));
} }
} // namespace multidevice_setup } // namespace multidevice_setup
......
...@@ -51,8 +51,7 @@ class MultiDeviceSetupInitializer ...@@ -51,8 +51,7 @@ class MultiDeviceSetupInitializer
// mojom::MultiDeviceSetup: // mojom::MultiDeviceSetup:
void SetAccountStatusChangeDelegate( void SetAccountStatusChangeDelegate(
mojom::AccountStatusChangeDelegatePtr delegate, mojom::AccountStatusChangeDelegatePtr delegate) override;
SetAccountStatusChangeDelegateCallback callback) override;
void TriggerEventForDebugging( void TriggerEventForDebugging(
mojom::EventTypeForDebugging type, mojom::EventTypeForDebugging type,
TriggerEventForDebuggingCallback callback) override; TriggerEventForDebuggingCallback callback) override;
......
...@@ -110,8 +110,7 @@ class MultiDeviceSetupServiceTest : public testing::Test { ...@@ -110,8 +110,7 @@ class MultiDeviceSetupServiceTest : public testing::Test {
std::make_unique<FakeAccountStatusChangeDelegate>(); std::make_unique<FakeAccountStatusChangeDelegate>();
multidevice_setup_ptr_->SetAccountStatusChangeDelegate( multidevice_setup_ptr_->SetAccountStatusChangeDelegate(
fake_account_status_change_delegate_->GenerateInterfacePtr(), fake_account_status_change_delegate_->GenerateInterfacePtr());
base::DoNothing());
multidevice_setup_ptr_.FlushForTesting(); multidevice_setup_ptr_.FlushForTesting();
} }
......
...@@ -39,7 +39,7 @@ interface MultiDeviceSetup { ...@@ -39,7 +39,7 @@ interface MultiDeviceSetup {
// Registers the "account status change" delegate to be used by the service. // Registers the "account status change" delegate to be used by the service.
// Only one delegate can be set; this function should not be called more than // Only one delegate can be set; this function should not be called more than
// once. // once.
SetAccountStatusChangeDelegate(AccountStatusChangeDelegate delegate) => (); SetAccountStatusChangeDelegate(AccountStatusChangeDelegate delegate);
// Triggers an event to be dispatched by the service. This API function is // Triggers an event to be dispatched by the service. This API function is
// intended to be used only for debugging in the chrome://proximity-auth page. // intended to be used only for debugging in the chrome://proximity-auth page.
......
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