Refactor MessageCenterSettingsController.
The CL does refactoring for MessageCenterSettingsController to get rid
of #ifdef macros for CHROME_OS.
1. Define NotifierSource abstract class that provides a list of specific
type of notifiers.
2. Define subclass for each notifier type (APPLICATION, WEB_PAGE,
SYSTEM_COMPONENT, ARC_APPLICATION).
3. Let MessageCenterSettingsController delegate to each source.
BUG=620184
TEST=None
Review-Url: https://codereview.chromium.org/2064363002
Cr-Commit-Position: refs/heads/master@{#400867}
diff --git a/chrome/browser/notifications/notifier_source.h b/chrome/browser/notifications/notifier_source.h
new file mode 100644
index 0000000..7c9f4f2e7
--- /dev/null
+++ b/chrome/browser/notifications/notifier_source.h
@@ -0,0 +1,58 @@
+// 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:
+ class Observer {
+ public:
+ virtual void OnIconImageUpdated(const message_center::NotifierId& id,
+ const gfx::Image& image) = 0;
+ virtual void OnNotifierEnabledChanged(const message_center::NotifierId& id,
+ bool enabled) = 0;
+ };
+
+ NotifierSource() = default;
+ virtual ~NotifierSource() = default;
+
+ // Returns notifiers.
+ // If the source starts loading for icon images, it needs to call
+ // Observer::OnIconImageUpdated 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
+ // Observer::OnNotifierEnabledChanged.
+ 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;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NotifierSource);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFIER_SOURCE_H_