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

Side by Side Diff: chrome/browser/notifications/message_center_settings_controller.h

Issue 19699014: Crash on message center settings change fixed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/notifications/message_center_settings_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/browser/extensions/app_icon_loader.h" 14 #include "chrome/browser/extensions/app_icon_loader.h"
15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/content_settings.h" 16 #include "chrome/common/content_settings.h"
17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h"
16 #include "ui/message_center/notifier_settings.h" 19 #include "ui/message_center/notifier_settings.h"
17 20
18 class CancelableTaskTracker; 21 class CancelableTaskTracker;
19 22
20 namespace chrome { 23 namespace chrome {
21 struct FaviconImageResult; 24 struct FaviconImageResult;
22 } 25 }
23 26
24 // The class to bridge between the settings UI of notifiers and the preference 27 // The class to bridge between the settings UI of notifiers and the preference
25 // storage. 28 // storage.
26 class MessageCenterSettingsController 29 class MessageCenterSettingsController
27 : public message_center::NotifierSettingsProvider, 30 : public message_center::NotifierSettingsProvider,
28 public extensions::AppIconLoader::Delegate { 31 public extensions::AppIconLoader::Delegate,
32 public content::NotificationObserver {
29 public: 33 public:
30 MessageCenterSettingsController(); 34 MessageCenterSettingsController();
31 virtual ~MessageCenterSettingsController(); 35 virtual ~MessageCenterSettingsController();
32 36
33 // Overridden from message_center::NotifierSettingsProvider. 37 // Overridden from message_center::NotifierSettingsProvider.
34 virtual void AddObserver( 38 virtual void AddObserver(
35 message_center::NotifierSettingsObserver* observer) OVERRIDE; 39 message_center::NotifierSettingsObserver* observer) OVERRIDE;
36 virtual void RemoveObserver( 40 virtual void RemoveObserver(
37 message_center::NotifierSettingsObserver* observer) OVERRIDE; 41 message_center::NotifierSettingsObserver* observer) OVERRIDE;
38 virtual void GetNotifierList( 42 virtual void GetNotifierList(
39 std::vector<message_center::Notifier*>* notifiers) 43 std::vector<message_center::Notifier*>* notifiers)
40 OVERRIDE; 44 OVERRIDE;
41 virtual void SetNotifierEnabled( 45 virtual void SetNotifierEnabled(
42 const message_center::Notifier& notifier, 46 const message_center::Notifier& notifier,
43 bool enabled) OVERRIDE; 47 bool enabled) OVERRIDE;
44 virtual void OnNotifierSettingsClosing() OVERRIDE; 48 virtual void OnNotifierSettingsClosing() OVERRIDE;
45 49
46 // Overridden from extensions::AppIconLoader::Delegate. 50 // Overridden from extensions::AppIconLoader::Delegate.
47 virtual void SetAppImage(const std::string& id, 51 virtual void SetAppImage(const std::string& id,
48 const gfx::ImageSkia& image) OVERRIDE; 52 const gfx::ImageSkia& image) OVERRIDE;
49 53
50 private: 54 private:
55 // Overridden from content::NotificationObserver.
56 virtual void Observe(int type,
57 const content::NotificationSource& source,
58 const content::NotificationDetails& details) OVERRIDE;
59
51 void OnFaviconLoaded(const GURL& url, 60 void OnFaviconLoaded(const GURL& url,
52 const chrome::FaviconImageResult& favicon_result); 61 const chrome::FaviconImageResult& favicon_result);
53 62
54 // The views displaying notifier settings. 63 // The views displaying notifier settings.
55 ObserverList<message_center::NotifierSettingsObserver> observers_; 64 ObserverList<message_center::NotifierSettingsObserver> observers_;
56 65
57 // The task tracker for loading favicons. 66 // The task tracker for loading favicons.
58 scoped_ptr<CancelableTaskTracker> favicon_tracker_; 67 scoped_ptr<CancelableTaskTracker> favicon_tracker_;
59 68
60 scoped_ptr<extensions::AppIconLoader> app_icon_loader_; 69 scoped_ptr<extensions::AppIconLoader> app_icon_loader_;
61 70
62 std::map<string16, ContentSettingsPattern> patterns_; 71 std::map<string16, ContentSettingsPattern> patterns_;
63 72
73 // The Registrar used to register for notifications.
74 content::NotificationRegistrar registrar_;
75
76 // TODO(sidharthms): Fix this for multi-profile.
77 // The profile associated with message center settings.
78 Profile* profile_;
79
64 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsController); 80 DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsController);
65 }; 81 };
66 82
67 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_ 83 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_SETTINGS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/message_center_settings_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698