test_notifier_settings_controller.cc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2019 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/system/message_center/test_notifier_settings_controller.h"
  5. #include <vector>
  6. #include "ash/public/cpp/notifier_metadata.h"
  7. #include "ash/public/cpp/notifier_settings_observer.h"
  8. #include "base/strings/utf_string_conversions.h"
  9. #include "ui/message_center/public/cpp/notifier_id.h"
  10. namespace ash {
  11. TestNotifierSettingsController::TestNotifierSettingsController() = default;
  12. TestNotifierSettingsController::~TestNotifierSettingsController() = default;
  13. void TestNotifierSettingsController::GetNotifiers() {
  14. std::vector<NotifierMetadata> notifiers;
  15. if (!no_notifiers_) {
  16. notifiers.emplace_back(message_center::NotifierId(
  17. message_center::NotifierType::APPLICATION, "id"),
  18. u"title", true /* enabled */, false /* enforced */,
  19. gfx::ImageSkia());
  20. notifiers.emplace_back(
  21. message_center::NotifierId(message_center::NotifierType::APPLICATION,
  22. "id2"),
  23. u"other title", false /* enabled */, false /* enforced */,
  24. gfx::ImageSkia());
  25. }
  26. for (auto& observer : observers_)
  27. observer.OnNotifiersUpdated(notifiers);
  28. }
  29. void TestNotifierSettingsController::SetNotifierEnabled(
  30. const message_center::NotifierId& notifier_id,
  31. bool enabled) {}
  32. void TestNotifierSettingsController::AddNotifierSettingsObserver(
  33. NotifierSettingsObserver* observer) {
  34. observers_.AddObserver(observer);
  35. }
  36. void TestNotifierSettingsController::RemoveNotifierSettingsObserver(
  37. NotifierSettingsObserver* observer) {
  38. observers_.RemoveObserver(observer);
  39. }
  40. } // namespace ash