account_status_change_delegate_notifier.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/services/multidevice_setup/account_status_change_delegate_notifier.h"
  5. #include "ash/components/multidevice/logging/logging.h"
  6. #include "base/logging.h"
  7. namespace ash {
  8. namespace multidevice_setup {
  9. AccountStatusChangeDelegateNotifier::AccountStatusChangeDelegateNotifier() =
  10. default;
  11. AccountStatusChangeDelegateNotifier::~AccountStatusChangeDelegateNotifier() =
  12. default;
  13. void AccountStatusChangeDelegateNotifier::SetAccountStatusChangeDelegateRemote(
  14. mojo::PendingRemote<mojom::AccountStatusChangeDelegate> delegate_remote) {
  15. if (delegate_remote_.is_bound()) {
  16. PA_LOG(ERROR) << "AccountStatusChangeDelegateNotifier::"
  17. << "SetAccountStatusChangeDelegateRemote(): Tried to set "
  18. << "delegate, but one already existed.";
  19. NOTREACHED();
  20. }
  21. delegate_remote_.Bind(std::move(delegate_remote));
  22. OnDelegateSet();
  23. }
  24. // No default implementation.
  25. void AccountStatusChangeDelegateNotifier::OnDelegateSet() {}
  26. void AccountStatusChangeDelegateNotifier::FlushForTesting() {
  27. if (delegate_remote_)
  28. delegate_remote_.FlushForTesting();
  29. }
  30. } // namespace multidevice_setup
  31. } // namespace ash