| OLD | NEW | 
|---|
| 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" | 
| 12 #include "base/string16.h" | 13 #include "base/string16.h" | 
| 13 #include "chrome/browser/notifications/notification.h" | 14 #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 "chrome/common/notification_service.h" | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 114 | 115 | 
| 115   static void RegisterUserPrefs(PrefService* user_prefs); | 116   static void RegisterUserPrefs(PrefService* user_prefs); | 
| 116 | 117 | 
| 117   ContentSetting GetContentSetting(const GURL& origin); | 118   ContentSetting GetContentSetting(const GURL& origin); | 
| 118 | 119 | 
| 119  private: | 120  private: | 
| 120   void InitPrefs(); | 121   void InitPrefs(); | 
| 121   void StartObserving(); | 122   void StartObserving(); | 
| 122   void StopObserving(); | 123   void StopObserving(); | 
| 123 | 124 | 
|  | 125   void OnPrefsChanged(const std::string& pref_name); | 
|  | 126 | 
| 124   // Takes a notification object and shows it in the UI. | 127   // Takes a notification object and shows it in the UI. | 
| 125   void ShowNotification(const Notification& notification); | 128   void ShowNotification(const Notification& notification); | 
| 126 | 129 | 
| 127   // Save a permission change to the profile. | 130   // Save a permission change to the profile. | 
| 128   void PersistPermissionChange(const GURL& origin, bool is_allowed); | 131   void PersistPermissionChange(const GURL& origin, bool is_allowed); | 
| 129 | 132 | 
| 130   // Returns a display name for an origin, to be used in permission infobar | 133   // 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 | 134   // or on the frame of the notification toast.  Different from the origin | 
| 132   // itself when dealing with extensions. | 135   // itself when dealing with extensions. | 
| 133   string16 DisplayNameForOrigin(const GURL& origin); | 136   string16 DisplayNameForOrigin(const GURL& origin); | 
| 134 | 137 | 
| 135   // The profile which owns this object. | 138   // The profile which owns this object. | 
| 136   Profile* profile_; | 139   Profile* profile_; | 
| 137 | 140 | 
| 138   // A cache of preferences which is accessible only on the IO thread | 141   // A cache of preferences which is accessible only on the IO thread | 
| 139   // to service synchronous IPCs. | 142   // to service synchronous IPCs. | 
| 140   scoped_refptr<NotificationsPrefsCache> prefs_cache_; | 143   scoped_refptr<NotificationsPrefsCache> prefs_cache_; | 
| 141 | 144 | 
| 142   // Non-owned pointer to the notification manager which manages the | 145   // Non-owned pointer to the notification manager which manages the | 
| 143   // UI for desktop toasts. | 146   // UI for desktop toasts. | 
| 144   NotificationUIManager* ui_manager_; | 147   NotificationUIManager* ui_manager_; | 
| 145 | 148 | 
| 146   PrefChangeRegistrar registrar_; | 149   PrefChangeRegistrar prefs_registrar_; | 
|  | 150   NotificationRegistrar notification_registrar_; | 
| 147 | 151 | 
| 148   DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 152   DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 
| 149 }; | 153 }; | 
| 150 | 154 | 
| 151 #endif  // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 155 #endif  // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 
| OLD | NEW | 
|---|