#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/extensions/app_icon_loader.h"
#include "chrome/common/content_settings.h"
#include "content/public/browser/notification_source.h"
#include "ui/message_center/notifier_settings.h"
-class CancelableTaskTracker;
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/user_manager.h"
+#endif
+
class Profile;
class ProfileInfoCache;
+namespace base {
+class CancelableTaskTracker;
+}
+
namespace chrome {
struct FaviconImageResult;
}
class MessageCenterSettingsController
: public message_center::NotifierSettingsProvider,
public content::NotificationObserver,
+#if defined(OS_CHROMEOS)
+ public chromeos::UserManager::UserSessionStateObserver,
+#endif
public extensions::AppIconLoader::Delegate {
public:
explicit MessageCenterSettingsController(
const message_center::NotifierId& notifier_id,
const std::string* notification_id) OVERRIDE;
+#if defined(OS_CHROMEOS)
+ // Overridden from chromeos::UserManager::UserSessionStateObserver.
+ virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE;
+#endif
+
// Overridden from extensions::AppIconLoader::Delegate.
virtual void SetAppImage(const std::string& id,
const gfx::ImageSkia& image) OVERRIDE;
void OnFaviconLoaded(const GURL& url,
const chrome::FaviconImageResult& favicon_result);
- Profile* GetCurrentProfile() const;
+#if defined(OS_CHROMEOS)
+ // Sets up the notifier group for the guest session. This needs to be
+ // separated from RebuildNotifierGroup() and called asynchronously to avoid
+ // the infinite loop of creating profile. See more the comment of
+ // RebuildNotifierGroups().
+ void CreateNotifierGroupForGuestLogin();
+#endif
void RebuildNotifierGroups();
ObserverList<message_center::NotifierSettingsObserver> observers_;
// The task tracker for loading favicons.
- scoped_ptr<CancelableTaskTracker> favicon_tracker_;
+ scoped_ptr<base::CancelableTaskTracker> favicon_tracker_;
scoped_ptr<extensions::AppIconLoader> app_icon_loader_;
- std::map<string16, ContentSettingsPattern> patterns_;
+ std::map<base::string16, ContentSettingsPattern> patterns_;
// The list of all configurable notifier groups. This is each profile that is
// loaded (and in the ProfileInfoCache - so no incognito profiles go here).
ProfileInfoCache* profile_info_cache_;
+ base::WeakPtrFactory<MessageCenterSettingsController> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsController);
};