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

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

Issue 4635007: When an extension is uninstalled, close all desktop notifications from that e... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_DESKTOP_NOTIFICATION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/ref_counted.h"
12 #include "base/string16.h" 14 #include "base/string16.h"
13 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/prefs/pref_change_registrar.h" 15 #include "chrome/browser/prefs/pref_change_registrar.h"
15 #include "chrome/common/content_settings.h" 16 #include "chrome/common/content_settings.h"
16 #include "chrome/common/notification_observer.h" 17 #include "chrome/common/notification_observer.h"
17 #include "chrome/common/notification_registrar.h" 18 #include "chrome/common/notification_registrar.h"
18 #include "chrome/common/notification_service.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" 20 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h"
21 21
22 class Notification;
22 class NotificationUIManager; 23 class NotificationUIManager;
23 class NotificationsPrefsCache; 24 class NotificationsPrefsCache;
24 class PrefService; 25 class PrefService;
25 class Profile; 26 class Profile;
26 class Task;
27 class TabContents; 27 class TabContents;
28 struct ViewHostMsg_ShowNotification_Params; 28 struct ViewHostMsg_ShowNotification_Params;
29 29
30 // The DesktopNotificationService is an object, owned by the Profile, 30 // The DesktopNotificationService is an object, owned by the Profile,
31 // which provides the creation of desktop "toasts" to web pages and workers. 31 // which provides the creation of desktop "toasts" to web pages and workers.
32 class DesktopNotificationService : public NotificationObserver { 32 class DesktopNotificationService : public NotificationObserver {
33 public: 33 public:
34 enum DesktopNotificationSource { 34 enum DesktopNotificationSource {
35 PageNotification, 35 PageNotification,
36 WorkerNotification 36 WorkerNotification
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 static void RegisterUserPrefs(PrefService* user_prefs); 115 static void RegisterUserPrefs(PrefService* user_prefs);
116 116
117 ContentSetting GetContentSetting(const GURL& origin); 117 ContentSetting GetContentSetting(const GURL& origin);
118 118
119 private: 119 private:
120 void InitPrefs(); 120 void InitPrefs();
121 void StartObserving(); 121 void StartObserving();
122 void StopObserving(); 122 void StopObserving();
123 123
124 void OnPrefsChanged(const std::string& pref_name);
125
124 // Takes a notification object and shows it in the UI. 126 // Takes a notification object and shows it in the UI.
125 void ShowNotification(const Notification& notification); 127 void ShowNotification(const Notification& notification);
126 128
127 // Save a permission change to the profile. 129 // Save a permission change to the profile.
128 void PersistPermissionChange(const GURL& origin, bool is_allowed); 130 void PersistPermissionChange(const GURL& origin, bool is_allowed);
129 131
130 // Returns a display name for an origin, to be used in permission infobar 132 // Returns a display name for an origin, to be used in permission infobar
131 // or on the frame of the notification toast. Different from the origin 133 // or on the frame of the notification toast. Different from the origin
132 // itself when dealing with extensions. 134 // itself when dealing with extensions.
133 string16 DisplayNameForOrigin(const GURL& origin); 135 string16 DisplayNameForOrigin(const GURL& origin);
134 136
135 // The profile which owns this object. 137 // The profile which owns this object.
136 Profile* profile_; 138 Profile* profile_;
137 139
138 // A cache of preferences which is accessible only on the IO thread 140 // A cache of preferences which is accessible only on the IO thread
139 // to service synchronous IPCs. 141 // to service synchronous IPCs.
140 scoped_refptr<NotificationsPrefsCache> prefs_cache_; 142 scoped_refptr<NotificationsPrefsCache> prefs_cache_;
141 143
142 // Non-owned pointer to the notification manager which manages the 144 // Non-owned pointer to the notification manager which manages the
143 // UI for desktop toasts. 145 // UI for desktop toasts.
144 NotificationUIManager* ui_manager_; 146 NotificationUIManager* ui_manager_;
145 147
146 PrefChangeRegistrar registrar_; 148 PrefChangeRegistrar prefs_registrar_;
149 NotificationRegistrar notification_registrar_;
147 150
148 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); 151 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
149 }; 152 };
150 153
151 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 154 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/balloon_collection_win.cc ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698