blob: c5280466a49ade450eee3ba2dc65eaa6b8c18aa0 [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
5#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_
6#define CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_
7
8#include <memory>
9#include <vector>
10
11#include "base/macros.h"
12#include "ui/message_center/notifier_settings.h"
13
14class Profile;
15
16namespace message_center {
17struct Notifier;
hironod36c21d2016-06-21 01:25:2218}
19
20class NotifierSource {
21 public:
22 class Observer {
23 public:
24 virtual void OnIconImageUpdated(const message_center::NotifierId& id,
25 const gfx::Image& image) = 0;
26 virtual void OnNotifierEnabledChanged(const message_center::NotifierId& id,
27 bool enabled) = 0;
28 };
29
30 NotifierSource() = default;
31 virtual ~NotifierSource() = default;
32
33 // Returns notifiers.
34 // If the source starts loading for icon images, it needs to call
35 // Observer::OnIconImageUpdated after the icon is loaded.
36 virtual std::vector<std::unique_ptr<message_center::Notifier>>
37 GetNotifierList(Profile* profile) = 0;
38
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
46 // Release temporary resouces tagged with notifier list that is returned last
47 // time.
48 virtual void OnNotifierSettingsClosing() {}
49
50 // Notifier type provided by the source.
51 virtual message_center::NotifierId::NotifierType GetNotifierType() = 0;
52
53 private:
54 DISALLOW_COPY_AND_ASSIGN(NotifierSource);
55};
56
57#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_