Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2378)

Unified Diff: chrome/browser/notifications/notifier_source.h

Issue 2064363002: Refactor MessageCenterSettingsController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto associated CL. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/notifier_source.h
diff --git a/chrome/browser/notifications/notifier_source.h b/chrome/browser/notifications/notifier_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..aa28e219edd51acc0ffde6a870ccc4ddf7bd44ec
--- /dev/null
+++ b/chrome/browser/notifications/notifier_source.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/macros.h"
+#include "ui/message_center/notifier_settings.h"
+
+class Profile;
+
+namespace message_center {
+struct Notifier;
+class NotifierSettingsObserver;
+}
+
+class NotifierSource {
+ public:
+ explicit NotifierSource(message_center::NotifierSettingsObserver* parent);
+ virtual ~NotifierSource();
+
+ // Returns notifiers.
+ // If the source starts loading for icon images, it needs to call
+ // parent_->UpdateIconImage after the icon is loaded.
+ virtual std::vector<std::unique_ptr<message_center::Notifier>>
+ GetNotifierList(Profile* profile) = 0;
+
+ // Set notifier enabled. |notifier| must have notifier type that can be
+ // handled by the source. It has responsibility to invoke
+ // parent_->NotifierEnabledChanged.
+ virtual void SetNotifierEnabled(Profile* profile,
+ const message_center::Notifier& notifier,
+ bool enabled) = 0;
+
+ // Release temporary resouces tagged with notifier list that is returned last
+ // time.
+ virtual void OnNotifierSettingsClosing();
+
+ // Notifier type provided by the source.
+ virtual message_center::NotifierId::NotifierType GetNotifierType() = 0;
+
+ protected:
+ // Lifetime of parent must be longer than the source.
+ message_center::NotifierSettingsObserver* const parent_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NotifierSource);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698