find_my_device_controller.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2020 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/components/phonehub/find_my_device_controller.h"
  5. namespace ash {
  6. namespace phonehub {
  7. FindMyDeviceController::FindMyDeviceController() = default;
  8. FindMyDeviceController::~FindMyDeviceController() = default;
  9. void FindMyDeviceController::AddObserver(Observer* observer) {
  10. observer_list_.AddObserver(observer);
  11. }
  12. void FindMyDeviceController::RemoveObserver(Observer* observer) {
  13. observer_list_.RemoveObserver(observer);
  14. }
  15. void FindMyDeviceController::NotifyPhoneRingingStateChanged() {
  16. for (auto& observer : observer_list_)
  17. observer.OnPhoneRingingStateChanged();
  18. }
  19. std::ostream& operator<<(std::ostream& stream,
  20. FindMyDeviceController::Status status) {
  21. switch (status) {
  22. case FindMyDeviceController::Status::kRingingOff:
  23. stream << "[Ringing Off]";
  24. break;
  25. case FindMyDeviceController::Status::kRingingOn:
  26. stream << "[Ringing On]";
  27. break;
  28. case FindMyDeviceController::Status::kRingingNotAvailable:
  29. stream << "[Ringing Not Available]";
  30. break;
  31. }
  32. return stream;
  33. }
  34. } // namespace phonehub
  35. } // namespace ash