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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_NOTIFICATION_UI_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/public/pref_observer.h"
14 #include "base/timer.h" 15 #include "base/timer.h"
15 #include "chrome/browser/api/prefs/pref_member.h" 16 #include "chrome/browser/api/prefs/pref_member.h"
16 #include "chrome/browser/notifications/balloon.h" 17 #include "chrome/browser/notifications/balloon.h"
17 #include "chrome/browser/notifications/balloon_collection.h" 18 #include "chrome/browser/notifications/balloon_collection.h"
18 #include "chrome/browser/notifications/notification_prefs_manager.h" 19 #include "chrome/browser/notifications/notification_prefs_manager.h"
19 #include "chrome/browser/notifications/notification_ui_manager.h" 20 #include "chrome/browser/notifications/notification_ui_manager.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 23
23 class Notification; 24 class Notification;
24 class PrefService; 25 class PrefService;
25 class Profile; 26 class Profile;
26 class QueuedNotification; 27 class QueuedNotification;
27 28
28 // The notification manager manages use of the desktop for notifications. 29 // The notification manager manages use of the desktop for notifications.
29 // It maintains a queue of pending notifications when space becomes constrained. 30 // It maintains a queue of pending notifications when space becomes constrained.
30 class NotificationUIManagerImpl 31 class NotificationUIManagerImpl
31 : public NotificationUIManager, 32 : public NotificationUIManager,
32 public NotificationPrefsManager, 33 public NotificationPrefsManager,
33 public BalloonCollection::BalloonSpaceChangeListener, 34 public BalloonCollection::BalloonSpaceChangeListener,
34 public content::NotificationObserver { 35 public content::NotificationObserver,
36 public PrefObserver {
35 public: 37 public:
36 explicit NotificationUIManagerImpl(PrefService* local_state); 38 explicit NotificationUIManagerImpl(PrefService* local_state);
37 virtual ~NotificationUIManagerImpl(); 39 virtual ~NotificationUIManagerImpl();
38 40
39 // Initializes the UI manager with a balloon collection; this object 41 // Initializes the UI manager with a balloon collection; this object
40 // takes ownership of the balloon collection. 42 // takes ownership of the balloon collection.
41 void Initialize(BalloonCollection* balloon_collection); 43 void Initialize(BalloonCollection* balloon_collection);
42 44
43 // NotificationUIManager: 45 // NotificationUIManager:
44 virtual void Add(const Notification& notification, 46 virtual void Add(const Notification& notification,
(...skipping 11 matching lines...) Expand all
56 GetPositionPreference() const OVERRIDE; 58 GetPositionPreference() const OVERRIDE;
57 virtual void SetPositionPreference( 59 virtual void SetPositionPreference(
58 BalloonCollection::PositionPreference preference) OVERRIDE; 60 BalloonCollection::PositionPreference preference) OVERRIDE;
59 61
60 private: 62 private:
61 // content::NotificationObserver override. 63 // content::NotificationObserver override.
62 virtual void Observe(int type, 64 virtual void Observe(int type,
63 const content::NotificationSource& source, 65 const content::NotificationSource& source,
64 const content::NotificationDetails& details) OVERRIDE; 66 const content::NotificationDetails& details) OVERRIDE;
65 67
68 // PrefObserver override.
69 virtual void OnPreferenceChanged(PrefServiceBase* service,
70 const std::string& pref_name) OVERRIDE;
71
66 // Attempts to display notifications from the show_queue if the user 72 // Attempts to display notifications from the show_queue if the user
67 // is active. 73 // is active.
68 void CheckAndShowNotifications(); 74 void CheckAndShowNotifications();
69 75
70 // Attempts to display notifications from the show_queue. 76 // Attempts to display notifications from the show_queue.
71 void ShowNotifications(); 77 void ShowNotifications();
72 78
73 // BalloonCollectionObserver implementation. 79 // BalloonCollectionObserver implementation.
74 virtual void OnBalloonSpaceChanged() OVERRIDE; 80 virtual void OnBalloonSpaceChanged() OVERRIDE;
75 81
(...skipping 18 matching lines...) Expand all
94 IntegerPrefMember position_pref_; 100 IntegerPrefMember position_pref_;
95 101
96 // Used by screen-saver and full-screen handling support. 102 // Used by screen-saver and full-screen handling support.
97 bool is_user_active_; 103 bool is_user_active_;
98 base::RepeatingTimer<NotificationUIManagerImpl> user_state_check_timer_; 104 base::RepeatingTimer<NotificationUIManagerImpl> user_state_check_timer_;
99 105
100 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerImpl); 106 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerImpl);
101 }; 107 };
102 108
103 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_IMPL_H_ 109 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/ssl_config_service_manager_pref.cc ('k') | chrome/browser/notifications/notification_ui_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698