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

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

Issue 20066003: Update notification settings to allow for multiprofile situations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And remove unneeded include. Created 7 years, 4 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/message_center_settings_controller.h
diff --git a/chrome/browser/notifications/message_center_settings_controller.h b/chrome/browser/notifications/message_center_settings_controller.h
index 1a660995b21b066ff82a7a4115a24dade19fc4ed..4adc1360d6ec157f034a3d8865f79d3e74c1e357 100644
--- a/chrome/browser/notifications/message_center_settings_controller.h
+++ b/chrome/browser/notifications/message_center_settings_controller.h
@@ -10,28 +10,36 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "chrome/browser/extensions/app_icon_loader.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/content_settings.h"
+#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_source.h"
#include "ui/message_center/notifier_settings.h"
class CancelableTaskTracker;
+class ProfileInfoCache;
namespace chrome {
struct FaviconImageResult;
}
+namespace message_center {
+class ProfileNotifierGroup;
+}
+
// The class to bridge between the settings UI of notifiers and the preference
// storage.
class MessageCenterSettingsController
: public message_center::NotifierSettingsProvider,
- public extensions::AppIconLoader::Delegate,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public extensions::AppIconLoader::Delegate {
public:
- MessageCenterSettingsController();
+ explicit MessageCenterSettingsController(
+ ProfileInfoCache* profile_info_cache);
virtual ~MessageCenterSettingsController();
// Overridden from message_center::NotifierSettingsProvider.
@@ -39,12 +47,16 @@ class MessageCenterSettingsController
message_center::NotifierSettingsObserver* observer) OVERRIDE;
virtual void RemoveObserver(
message_center::NotifierSettingsObserver* observer) OVERRIDE;
- virtual void GetNotifierList(
- std::vector<message_center::Notifier*>* notifiers)
+ virtual size_t GetNotifierGroupCount() const OVERRIDE;
+ virtual const message_center::NotifierGroup& GetNotifierGroupAt(
+ size_t index) const OVERRIDE;
+ virtual void SwitchToNotifierGroup(size_t index) OVERRIDE;
+ virtual const message_center::NotifierGroup& GetActiveNotifierGroup() const
OVERRIDE;
- virtual void SetNotifierEnabled(
- const message_center::Notifier& notifier,
- bool enabled) OVERRIDE;
+ virtual void GetNotifierList(
+ std::vector<message_center::Notifier*>* notifiers) OVERRIDE;
+ virtual void SetNotifierEnabled(const message_center::Notifier& notifier,
+ bool enabled) OVERRIDE;
virtual void OnNotifierSettingsClosing() OVERRIDE;
// Overridden from extensions::AppIconLoader::Delegate.
@@ -60,6 +72,8 @@ class MessageCenterSettingsController
void OnFaviconLoaded(const GURL& url,
const chrome::FaviconImageResult& favicon_result);
+ void RebuildNotifierGroups();
+
// The views displaying notifier settings.
ObserverList<message_center::NotifierSettingsObserver> observers_;
@@ -70,12 +84,14 @@ class MessageCenterSettingsController
std::map<string16, ContentSettingsPattern> patterns_;
- // The Registrar used to register for notifications.
+ // The list of all configurable notifier groups. This is each profile that is
+ // loaded (and in the ProfileInfoCache - so no incognito profiles go here).
+ ScopedVector<message_center::ProfileNotifierGroup> notifier_groups_;
+ size_t current_notifier_group_;
+
content::NotificationRegistrar registrar_;
- // TODO(sidharthms): Fix this for multi-profile.
- // The profile associated with message center settings.
- Profile* profile_;
+ ProfileInfoCache* profile_info_cache_;
DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsController);
};

Powered by Google App Engine
This is Rietveld 408576698