blob: fce6a31adfdf8ebf30a999fb3ba8713e2138cf0d [file] [log] [blame]
hironod36c21d2016-06-21 01:25:221// Copyright (c) 2016 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
Evan Staded6d837f2017-09-29 02:51:025#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_CONTROLLER_H_
6#define CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_CONTROLLER_H_
hironod36c21d2016-06-21 01:25:227
8#include <memory>
9#include <vector>
10
Evan Stade55575d82017-11-02 00:52:3611#include "ash/public/interfaces/ash_message_center_controller.mojom.h"
hironod36c21d2016-06-21 01:25:2212#include "base/macros.h"
Evan Stade889ce4712018-01-28 15:26:2613#include "ui/message_center/public/cpp/notifier_id.h"
hironod36c21d2016-06-21 01:25:2214
15class Profile;
16
Evan Staded6d837f2017-09-29 02:51:0217// An interface to control Notifiers, grouped by NotifierType. Controllers are
18// responsible for both collating display data and toggling settings in response
19// to user inputs.
20class NotifierController {
hironod36c21d2016-06-21 01:25:2221 public:
22 class Observer {
23 public:
24 virtual void OnIconImageUpdated(const message_center::NotifierId& id,
Evan Stade55575d82017-11-02 00:52:3625 const gfx::ImageSkia& image) = 0;
hironod36c21d2016-06-21 01:25:2226 virtual void OnNotifierEnabledChanged(const message_center::NotifierId& id,
27 bool enabled) = 0;
28 };
29
Evan Staded6d837f2017-09-29 02:51:0230 NotifierController() = default;
31 virtual ~NotifierController() = default;
hironod36c21d2016-06-21 01:25:2232
Evan Staded6d837f2017-09-29 02:51:0233 // Returns notifiers to display in the settings UI. Not all notifiers appear
34 // in settings. If the source starts loading for icon images, it needs to call
hironod36c21d2016-06-21 01:25:2235 // Observer::OnIconImageUpdated after the icon is loaded.
Evan Stade55575d82017-11-02 00:52:3636 virtual std::vector<ash::mojom::NotifierUiDataPtr> GetNotifierList(
37 Profile* profile) = 0;
hironod36c21d2016-06-21 01:25:2238
Evan Stade844ad7f2017-09-20 18:05:3139 // Set notifier enabled. |notifier_id| must have notifier type that can be
hironod36c21d2016-06-21 01:25:2240 // handled by the source. It has responsibility to invoke
41 // Observer::OnNotifierEnabledChanged.
42 virtual void SetNotifierEnabled(Profile* profile,
Evan Stade844ad7f2017-09-20 18:05:3143 const message_center::NotifierId& notifier_id,
hironod36c21d2016-06-21 01:25:2244 bool enabled) = 0;
45
hironod36c21d2016-06-21 01:25:2246 private:
Evan Staded6d837f2017-09-29 02:51:0247 DISALLOW_COPY_AND_ASSIGN(NotifierController);
hironod36c21d2016-06-21 01:25:2248};
49
Evan Staded6d837f2017-09-29 02:51:0250#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_CONTROLLER_H_